Add the other existing $skin.css/.js to the message files too to be consistent
[mediawiki.git] / includes / SpecialMissingFiles.php
blobd2da51c741e416beb3e9a9272d483a1e76bbbe88
1 <?php
2 /**
3 * A querypage to list the missing files - implements Special:Missingfiles
5 * @addtogroup SpecialPage
7 * @author Matěj Grabovský <65s.mg@atlas.cz>
8 * @copyright Copyright © 2008, Matěj Grabovský
9 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11 class MissingFilesPage extends QueryPage {
12 function getName() {
13 return 'Missingfiles';
16 function isExpensive() {
17 return true;
20 function isSyndicated() {
21 return false;
24 function getSQL() {
25 $dbr = wfGetDB( DB_SLAVE );
26 list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' );
27 $name = $dbr->addQuotes( $this->getName() );
29 return "SELECT $name as type,
30 " . NS_IMAGE . " 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_IMAGE ."
35 WHERE page_title IS NULL
36 GROUP BY 1,2,3
40 function sortDescending() {
41 return true;
44 /**
45 * Fetch user page links and cache their existence
47 function preprocessResults( $db, $res ) {
48 $batch = new LinkBatch;
50 while ( $row = $db->fetchObject( $res ) )
51 $batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) );
53 $batch->execute();
55 // Back to start for display
56 if ( $db->numRows( $res ) > 0 )
58 // If there are no rows we get an error seeking.
59 $db->dataSeek( $res, 0 );
62 public function formatResult( $skin, $result ) {
63 global $wgLang, $wgContLang;
65 $nt = Title::makeTitle( $result->namespace, $result->title );
66 $text = $wgContLang->convert( $nt->getText() );
68 $plink = $this->isCached()
69 ? '<s>' . $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) . '</s>'
70 : $skin->makeBrokenImageLinkObj( $nt, htmlspecialchars( $text ) );
72 $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value ) );
73 $nlinks = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Whatlinkshere' ), $label, 'target=' . $nt->getPrefixedUrl() );
74 return wfSpecialList( $plink, $nlinks );
78 /**
79 * Constructor
81 function wfSpecialMissingFiles() {
82 list( $limit, $offset ) = wfCheckLimits();
84 $wpp = new MissingFilesPage();
86 $wpp->doQuery( $offset, $limit );