From 513b286058d1b419bbece8b199535835cce8cff3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 6 Oct 2009 20:23:12 +0000 Subject: [PATCH] * (bug 21026) Fixed file redirects on shared repos on non-English client wikis 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 | 1 + includes/filerepo/LocalRepo.php | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 76889c9c93..2f2d34b272 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 00ca5cdbb6..3eca504831 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -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 ); } -- 2.20.1