* (bug 21026) Fixed file redirects on shared repos on non-English client wikis
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Oct 2009 20:23:12 +0000 (20:23 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Oct 2009 20:23:12 +0000 (20:23 +0000)
memcached key name for image redirect info caching was including the local wiki's namespace translations, so non-English client sites that cached negative lookups didn't get them cleared when the redirect entry is updated from the master site. The negative lookup would continue to be used until it expired, leading to confusing brokenness.
Changed the cache keys to use the bare name, since we only care about NS_FILE cases we can tack it back on to the title after we load it up.

RELEASE-NOTES
includes/filerepo/LocalRepo.php

index 76889c9..2f2d34b 100644 (file)
@@ -545,6 +545,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   searching for special pages
 * (bug 20524) Hideuser: Show nice error when trying to block hidden user without 
   hideuser right
+* (bug 21026) Fixed file redirects on shared repos on non-English client wikis
 
 == API changes in 1.16 ==
 
index 00ca5cd..3eca504 100644 (file)
@@ -83,9 +83,9 @@ class LocalRepo extends FSRepo {
                        $title = Title::makeTitle( NS_FILE, $title->getText() );
                }
 
-               $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getPrefixedDBkey() ) );
+               $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
                if ( $memcKey === false ) {
-                       $memcKey = $this->getLocalCacheKey( 'image_redirect', md5( $title->getPrefixedDBkey() ) );
+                       $memcKey = $this->getLocalCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
                        $expiry = 300; // no invalidation, 5 minutes
                } else {
                        $expiry = 86400; // has invalidation, 1 day
@@ -95,7 +95,7 @@ class LocalRepo extends FSRepo {
                        // Does not exist
                        return false;
                } elseif ( strval( $cachedValue ) !== '' ) {
-                       return Title::newFromText( $cachedValue );
+                       return Title::newFromText( $cachedValue, NS_FILE );
                } // else $cachedValue is false or null: cache miss
 
                $id = $this->getArticleID( $title );
@@ -111,9 +111,9 @@ class LocalRepo extends FSRepo {
                        __METHOD__
                );
 
-               if( $row ) {
+               if( $row && $row->rd_namespace == NS_FILE ) {
                        $targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title );
-                       $wgMemc->set( $memcKey, $targetTitle->getPrefixedDBkey(), $expiry );
+                       $wgMemc->set( $memcKey, $targetTitle->getDBkey(), $expiry );
                        return $targetTitle;
                } else {
                        $wgMemc->set( $memcKey, '', $expiry );
@@ -193,7 +193,7 @@ class LocalRepo extends FSRepo {
         */     
        function invalidateImageRedirect( $title ) {
                global $wgMemc;
-               $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getPrefixedDBkey() ) );
+               $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
                if ( $memcKey ) {
                        $wgMemc->delete( $memcKey );
                }