Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1203,6 +1203,10 @@ |
1204 | 1204 | 'wantedcategories-summary', |
1205 | 1205 | 'wantedpages', |
1206 | 1206 | 'wantedpages-summary', |
| 1207 | + 'missingfiles', |
| 1208 | + 'missingfiles-summary', |
| 1209 | + 'missingimages', |
| 1210 | + 'missingimages-summary', |
1207 | 1211 | 'mostlinked', |
1208 | 1212 | 'mostlinked-summary', |
1209 | 1213 | 'mostlinkedcategories', |
Index: trunk/phase3/includes/SpecialMissingfiles.php |
— | — | @@ -0,0 +1,87 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * A querypage to list the missing files - implements Special:Missingfiles |
| 5 | + * |
| 6 | + * @addtogroup SpecialPage |
| 7 | + * |
| 8 | + * @author Matěj Grabovský <65s.mg@atlas.cz> |
| 9 | + * @copyright Copyright © 2008, Matěj Grabovský |
| 10 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 11 | + */ |
| 12 | +class MissingFilesPage extends QueryPage { |
| 13 | + function getName() { |
| 14 | + return 'Missingfiles'; |
| 15 | + } |
| 16 | + |
| 17 | + function isExpensive() { |
| 18 | + return true; |
| 19 | + } |
| 20 | + |
| 21 | + function isSyndicated() { |
| 22 | + return false; |
| 23 | + } |
| 24 | + |
| 25 | + function getSQL() { |
| 26 | + $dbr = wfGetDB( DB_SLAVE ); |
| 27 | + list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' ); |
| 28 | + $name = $dbr->addQuotes( $this->getName() ); |
| 29 | + |
| 30 | + return "SELECT $name as type, |
| 31 | + " . NS_IMAGE . " as namespace, |
| 32 | + il_to as title, |
| 33 | + COUNT(*) as value |
| 34 | + FROM $imagelinks |
| 35 | + LEFT JOIN $page ON il_to = page_title AND page_namespace = ". NS_IMAGE ." |
| 36 | + WHERE page_title IS NULL |
| 37 | + GROUP BY 1,2,3 |
| 38 | + "; |
| 39 | + } |
| 40 | + |
| 41 | + function sortDescending() { |
| 42 | + return true; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * Fetch user page links and cache their existence |
| 47 | + */ |
| 48 | + function preprocessResults( $db, $res ) { |
| 49 | + $batch = new LinkBatch; |
| 50 | + |
| 51 | + while ( $row = $db->fetchObject( $res ) ) |
| 52 | + $batch->addObj( Title::makeTitleSafe( $row->namespace, $row->title ) ); |
| 53 | + |
| 54 | + $batch->execute(); |
| 55 | + |
| 56 | + // Back to start for display |
| 57 | + if ( $db->numRows( $res ) > 0 ) |
| 58 | + |
| 59 | + // If there are no rows we get an error seeking. |
| 60 | + $db->dataSeek( $res, 0 ); |
| 61 | + } |
| 62 | + |
| 63 | + public function formatResult( $skin, $result ) { |
| 64 | + global $wgLang, $wgContLang; |
| 65 | + |
| 66 | + $nt = Title::makeTitle( $result->namespace, $result->title ); |
| 67 | + $text = $wgContLang->convert( $nt->getText() ); |
| 68 | + |
| 69 | + $plink = $this->isCached() |
| 70 | + ? '<s>' . $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) . '</s>' |
| 71 | + : $skin->makeBrokenImageLinkObj( $nt, htmlspecialchars( $text ) ); |
| 72 | + |
| 73 | + $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value ) ); |
| 74 | + $nlinks = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Whatlinkshere' ), $label, 'target=' . $nt->getPrefixedUrl() ); |
| 75 | + return wfSpecialList( $plink, $nlinks ); |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +/** |
| 80 | + * Constructor |
| 81 | + */ |
| 82 | +function wfSpecialMissingFiles() { |
| 83 | + list( $limit, $offset ) = wfCheckLimits(); |
| 84 | + |
| 85 | + $wpp = new MissingFilesPage(); |
| 86 | + |
| 87 | + $wpp->doQuery( $offset, $limit ); |
| 88 | +} |
\ No newline at end of file |
Property changes on: trunk/phase3/includes/SpecialMissingfiles.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 89 | + native |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2627,6 +2627,7 @@ |
2628 | 2628 | 'Wantedcategories' => 'maintenance', |
2629 | 2629 | 'Unwatchedpages' => 'maintenance', |
2630 | 2630 | 'Fewestrevisions' => 'maintenance', |
| 2631 | + 'MissingFiles' => 'maintenance', |
2631 | 2632 | |
2632 | 2633 | 'Userlogin' => 'login', |
2633 | 2634 | 'Userlogout' => 'login', |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -107,6 +107,7 @@ |
108 | 108 | 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ), |
109 | 109 | 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ), |
110 | 110 | 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ), |
| 111 | + 'Missingfiles' => array( 'SpecialPage', 'MissingFiles' ), |
111 | 112 | 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ), |
112 | 113 | 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ), |
113 | 114 | 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ), |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -376,6 +376,7 @@ |
377 | 377 | 'Unusedimages' => array( 'UnusedImages' ), |
378 | 378 | 'Wantedpages' => array( 'WantedPages', 'BrokenLinks' ), |
379 | 379 | 'Wantedcategories' => array( 'WantedCategories' ), |
| 380 | + 'Missingfiles' => array( 'MissingFiles', 'MissingImages' ), |
380 | 381 | 'Mostlinked' => array( 'MostLinked' ), |
381 | 382 | 'Mostlinkedcategories' => array( 'MostLinkedCategories', 'MostUsedCategories' ), |
382 | 383 | 'Mostlinkedtemplates' => array( 'MostLinkedTemplates', 'MostUsedTemplates' ), |
— | — | @@ -1875,6 +1876,8 @@ |
1876 | 1877 | 'wantedcategories-summary' => '', # only translate this message to other languages if you have to change it |
1877 | 1878 | 'wantedpages' => 'Wanted pages', |
1878 | 1879 | 'wantedpages-summary' => '', # only translate this message to other languages if you have to change it |
| 1880 | +'missingfiles' => 'Missing files', |
| 1881 | +'missingfiles-summary' => '', # only translate this message to other languages if you have to change it |
1879 | 1882 | 'mostlinked' => 'Most linked-to pages', |
1880 | 1883 | 'mostlinked-summary' => '', # only translate this message to other languages if you have to change it |
1881 | 1884 | 'mostlinkedcategories' => 'Most linked-to categories', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -143,6 +143,8 @@ |
144 | 144 | * The User class now contains a public function called isActiveEditor. Figures |
145 | 145 | out if a user is active based on at least $wgActiveUserEditCount number of |
146 | 146 | edits in the last $wgActiveUserDays days. |
| 147 | +* (bug 13702) Add Special:MissingFiles to list places where an image link is |
| 148 | + used but no such file exists. |
147 | 149 | |
148 | 150 | === Bug fixes in 1.13 === |
149 | 151 | |