]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/specials/SpecialWantedfiles.php
MediaWiki 1.16.1-scripts
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialWantedfiles.php
1 <?php
2 /*
3  * @file
4  * @ingroup SpecialPage
5  */
6
7 /**
8  * Querypage that lists the most wanted files - implements Special:Wantedfiles
9  *
10  * @ingroup SpecialPage
11  *
12  * @author Soxred93 <soxred93@gmail.com>
13  * @copyright Copyright © 2008, Soxred93
14  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
15  */
16 class WantedFilesPage extends WantedQueryPage {
17
18         function getName() {
19                 return 'Wantedfiles';
20         }
21
22         function getSQL() {
23                 $dbr = wfGetDB( DB_SLAVE );
24                 list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' );
25                 $name = $dbr->addQuotes( $this->getName() );
26                 return
27                         "
28                         SELECT
29                                 $name as type,
30                                 " . NS_FILE . " as namespace,
31                                 il_to as title,
32                                 COUNT(*) as value
33                         FROM $imagelinks
34                         LEFT JOIN $page ON il_to = page_title AND page_namespace = ". NS_FILE ."
35                         WHERE page_title IS NULL
36                         GROUP BY il_to
37                         ";
38         }
39 }
40
41 /**
42  * constructor
43  */
44 function wfSpecialWantedFiles() {
45         list( $limit, $offset ) = wfCheckLimits();
46
47         $wpp = new WantedFilesPage();
48
49         $wpp->doQuery( $offset, $limit );
50 }