r57434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57433‎ | r57434 | r57435 >
Date:20:23, 6 October 2009
Author:brion
Status:ok
Tags:
Comment:
* (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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalRepo.php
@@ -83,9 +83,9 @@
8484 $title = Title::makeTitle( NS_FILE, $title->getText() );
8585 }
8686
87 - $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getPrefixedDBkey() ) );
 87+ $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
8888 if ( $memcKey === false ) {
89 - $memcKey = $this->getLocalCacheKey( 'image_redirect', md5( $title->getPrefixedDBkey() ) );
 89+ $memcKey = $this->getLocalCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
9090 $expiry = 300; // no invalidation, 5 minutes
9191 } else {
9292 $expiry = 86400; // has invalidation, 1 day
@@ -95,7 +95,7 @@
9696 // Does not exist
9797 return false;
9898 } elseif ( strval( $cachedValue ) !== '' ) {
99 - return Title::newFromText( $cachedValue );
 99+ return Title::newFromText( $cachedValue, NS_FILE );
100100 } // else $cachedValue is false or null: cache miss
101101
102102 $id = $this->getArticleID( $title );
@@ -111,9 +111,9 @@
112112 __METHOD__
113113 );
114114
115 - if( $row ) {
 115+ if( $row && $row->rd_namespace == NS_FILE ) {
116116 $targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title );
117 - $wgMemc->set( $memcKey, $targetTitle->getPrefixedDBkey(), $expiry );
 117+ $wgMemc->set( $memcKey, $targetTitle->getDBkey(), $expiry );
118118 return $targetTitle;
119119 } else {
120120 $wgMemc->set( $memcKey, '', $expiry );
@@ -193,7 +193,7 @@
194194 */
195195 function invalidateImageRedirect( $title ) {
196196 global $wgMemc;
197 - $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getPrefixedDBkey() ) );
 197+ $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
198198 if ( $memcKey ) {
199199 $wgMemc->delete( $memcKey );
200200 }
Index: trunk/phase3/RELEASE-NOTES
@@ -545,6 +545,7 @@
546546 searching for special pages
547547 * (bug 20524) Hideuser: Show nice error when trying to block hidden user without
548548 hideuser right
 549+* (bug 21026) Fixed file redirects on shared repos on non-English client wikis
549550
550551 == API changes in 1.16 ==
551552

Follow-up revisions

RevisionCommit summaryAuthorDate
r57435Merge r57434 from trunk: fix for bug 21026 prob w/ shared repo redirects in m...brion20:26, 6 October 2009

Status & tagging log