Index: trunk/phase3/includes/SpecialMissingfiles.php =================================================================== --- trunk/phase3/includes/SpecialMissingfiles.php (revision 0) +++ trunk/phase3/includes/SpecialMissingfiles.php (revision 0) @@ -0,0 +1,87 @@ + + * @copyright Copyright © 2008, Matěj Grabovský + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later + */ +class MissingFilesPage extends QueryPage { + function getName() { + return 'Missingfiles'; + } + + function isExpensive() { + return true; + } + + function isSyndicated() { + return false; + } + + function getSQL() { + $dbr = wfGetDB( DB_SLAVE ); + list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' ); + $name = $dbr->addQuotes( $this->getName() ); + + return "SELECT $name as type, + " . NS_IMAGE . " as namespace, + il_to as title, + COUNT(*) as value + FROM $imagelinks + LEFT JOIN $page ON il_to = page_title AND page_namespace = ". NS_IMAGE ." + WHERE page_title IS NULL + GROUP BY 1,2,3 + "; + } + + function sortDescending() { + return true; + } + + /** + * Fetch user page links and cache their existence + */ + function preprocessResults( $db, $res ) { + $batch = new LinkBatch; + + while ( $row = $db->fetchObject( $res ) ) + $batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) ); + + $batch->execute(); + + // Back to start for display + if ( $db->numRows( $res ) > 0 ) + + // If there are no rows we get an error seeking. + $db->dataSeek( $res, 0 ); + } + + public function formatResult( $skin, $result ) { + global $wgLang, $wgContLang; + + $nt = Title::makeTitle( $result->namespace, $result->title ); + $text = $wgContLang->convert( $nt->getText() ); + + $plink = $this->isCached() + ? '' . $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) . '' + : $skin->makeBrokenImageLinkObj( $nt, htmlspecialchars( $text ) ); + + $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value ) ); + $nlinks = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Whatlinkshere' ), $label, 'target=' . $nt->getPrefixedUrl() ); + return wfSpecialList( $plink, $nlinks ); + } +} + +/** + * Constructor + */ +function wfSpecialMissingFiles() { + list( $limit, $offset ) = wfCheckLimits(); + + $wpp = new MissingFilesPage(); + + $wpp->doQuery( $offset, $limit ); +} Property changes on: trunk/phase3/includes/SpecialMissingfiles.php ___________________________________________________________________ Name: svn:eol-style + native Index: trunk/phase3/includes/SpecialPage.php =================================================================== --- trunk/phase3/includes/SpecialPage.php (revision 35582) +++ trunk/phase3/includes/SpecialPage.php (working copy) @@ -107,6 +107,7 @@ 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ), 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ), 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ), + 'Missingfiles' => array( 'SpecialPage', 'MissingFiles' ), 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ), 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ), 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ), Index: trunk/phase3/languages/messages/MessagesEn.php =================================================================== --- trunk/phase3/languages/messages/MessagesEn.php (revision 35582) +++ trunk/phase3/languages/messages/MessagesEn.php (working copy) @@ -376,6 +376,7 @@ 'Unusedimages' => array( 'UnusedImages' ), 'Wantedpages' => array( 'WantedPages', 'BrokenLinks' ), 'Wantedcategories' => array( 'WantedCategories' ), + 'Missingfiles' => array( 'MissingFiles', 'MissingImages' ), 'Mostlinked' => array( 'MostLinked' ), 'Mostlinkedcategories' => array( 'MostLinkedCategories', 'MostUsedCategories' ), 'Mostlinkedtemplates' => array( 'MostLinkedTemplates', 'MostUsedTemplates' ), @@ -1873,6 +1874,8 @@ 'wantedcategories-summary' => '', # only translate this message to other languages if you have to change it 'wantedpages' => 'Wanted pages', 'wantedpages-summary' => '', # only translate this message to other languages if you have to change it +'missingfiles' => 'Missing files', +'missingfiles-summary' => '', # only translate this message to other languages if you have to change it 'mostlinked' => 'Most linked-to pages', 'mostlinked-summary' => '', # only translate this message to other languages if you have to change it 'mostlinkedcategories' => 'Most linked-to categories', Index: trunk/phase3/maintenance/language/messages.inc =================================================================== --- trunk/phase3/maintenance/language/messages.inc (revision 35582) +++ trunk/phase3/maintenance/language/messages.inc (working copy) @@ -1201,6 +1201,10 @@ 'wantedcategories-summary', 'wantedpages', 'wantedpages-summary', + 'missingfiles', + 'missingfiles-summary', + 'missingimages', + 'missingimages-summary', 'mostlinked', 'mostlinked-summary', 'mostlinkedcategories',