diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 8fc71029c6e..719b52132a7 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -197,9 +197,9 @@ class LocalRepo extends FileRepo { public function checkRedirect( Title $title ) { $title = File::normalizeTitle( $title, 'exception' ); - $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) ); + $memcKey = $this->getSharedCacheKey( 'file_redirect', md5( $title->getDBkey() ) ); if ( $memcKey === false ) { - $memcKey = $this->getLocalCacheKey( 'image_redirect', md5( $title->getDBkey() ) ); + $memcKey = $this->getLocalCacheKey( 'file_redirect', md5( $title->getDBkey() ) ); $expiry = 300; // no invalidation, 5 minutes } else { $expiry = 86400; // has invalidation, 1 day @@ -497,7 +497,10 @@ class LocalRepo extends FileRepo { * @return string */ public function getSharedCacheKey( ...$args ) { - return $this->wanCache->makeKey( ...$args ); + return $this->wanCache->makeGlobalKey( + WikiMap::getCurrentWikiDbDomain()->getId(), + ...$args + ); } /** @@ -507,7 +510,7 @@ class LocalRepo extends FileRepo { * @return void */ public function invalidateImageRedirect( Title $title ) { - $key = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) ); + $key = $this->getSharedCacheKey( 'file_redirect', md5( $title->getDBkey() ) ); if ( $key ) { $this->getMasterDB()->onTransactionPreCommitOrIdle( function () use ( $key ) { diff --git a/tests/phpunit/includes/filerepo/LocalRepoTest.php b/tests/phpunit/includes/filerepo/LocalRepoTest.php index 34c2d937bb6..79ad7950ec4 100644 --- a/tests/phpunit/includes/filerepo/LocalRepoTest.php +++ b/tests/phpunit/includes/filerepo/LocalRepoTest.php @@ -177,8 +177,8 @@ class LocalRepoTest extends MediaWikiIntegrationTestCase { ->setMethods( [ 'makeKey' ] ) ->getMock(); $mockWan->expects( $this->exactly( 2 ) )->method( 'makeKey' )->withConsecutive( - [ 'image_redirect', md5( 'Redirect' ) ], - [ 'filerepo', 'local', 'image_redirect', md5( 'Redirect' ) ] + [ 'file_redirect', md5( 'Redirect' ) ], + [ 'filerepo', 'local', 'file_redirect', md5( 'Redirect' ) ] )->will( $this->onConsecutiveCalls( false, 'somekey' ) ); $repo = $this->newRepo( [ 'wanCache' => $mockWan ] );