Partial workaround for bug 6220: at least make files on shared repositories show...
authorIlmari Karonen <vyznev@users.mediawiki.org>
Sat, 4 Dec 2010 16:10:51 +0000 (16:10 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Sat, 4 Dec 2010 16:10:51 +0000 (16:10 +0000)
RELEASE-NOTES
includes/QueryPage.php
includes/specials/SpecialWantedfiles.php

index 3f0b552..643bcd5 100644 (file)
@@ -447,6 +447,8 @@ LocalSettings.php. The specific bugs are listed below in the general notes.
 * (bug 26160) Upload description set by extensions are not propagated
 * (bug 9675) generateSitemap.php now takes an --urlpath parameter to allow
   absolute URLs in the sitemap index (as required e.g. by Google)
+* Partial workaround for bug 6220: at least make files on shared repositories
+  show up as (struck-out) bluelinks instead of redlinks on Special:WantedFiles
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index a301574..d9fb3bb 100644 (file)
@@ -580,6 +580,17 @@ abstract class WantedQueryPage extends QueryPage {
                        $db->dataSeek( $res, 0 );
        }
        
+       /**
+        * Should formatResult() always check page existence, even if
+        * the results are fresh?  This is a (hopefully temporary)
+        * kluge for Special:WantedFiles, which may contain false
+        * positives for files that exist e.g. in a shared repo (bug
+        * 6220).
+        */
+       function forceExistenceCheck() {
+               return false;
+       }
+
        /**
         * Format an individual result
         *
@@ -590,8 +601,8 @@ abstract class WantedQueryPage extends QueryPage {
        public function formatResult( $skin, $result ) {
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
                if( $title instanceof Title ) {
-                       if( $this->isCached() ) {
-                               $pageLink = $title->exists()
+                       if( $this->isCached() || $this->forceExistenceCheck() ) {
+                               $pageLink = $title->isKnown()
                                        ? '<del>' . $skin->link( $title ) . '</del>'
                                        : $skin->link(
                                                $title,
index 28e82a8..d6c1157 100644 (file)
@@ -35,9 +35,19 @@ class WantedFilesPage extends WantedQueryPage {
                return 'Wantedfiles';
        }
 
+       /**
+        * KLUGE: The results may contain false positives for files
+        * that exist e.g. in a shared repo.  Setting this at least
+        * keeps them from showing up as redlinks in the output, even
+        * if it doesn't fix the real problem (bug 6220).
+        */
+       function forceExistenceCheck() {
+               return true;
+       }
+
        function getSQL() {
                $dbr = wfGetDB( DB_SLAVE );
-               list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' );
+               list( $imagelinks, $image ) = $dbr->tableNamesN( 'imagelinks', 'image' );
                $name = $dbr->addQuotes( $this->getName() );
                return
                        "
@@ -47,8 +57,8 @@ class WantedFilesPage extends WantedQueryPage {
                                il_to as title,
                                COUNT(*) as value
                        FROM $imagelinks
-                       LEFT JOIN $page ON il_to = page_title AND page_namespace = ". NS_FILE ."
-                       WHERE page_title IS NULL
+                       LEFT JOIN $image ON il_to = img_name
+                       WHERE img_name IS NULL
                        GROUP BY il_to
                        ";
        }