From: Gergő Tisza Date: Tue, 25 Jun 2019 14:30:31 +0000 (+0200) Subject: Fix LocalFile::move X-Git-Tag: 1.34.0-rc.0~1283^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=b71610c069c69b2a991cb43b059642aca1882f4a;p=lhc%2Fweb%2Fwiklou.git Fix LocalFile::move Fixes a wfFindFile/wfLocalFile mixup in I9437494d. Also restore the original behavior in Linker::makeBrokenImageLinkObj for paranoia - findFile has a local cache so calling it and then discarding the results is not completely a noop. Bug: T226448 Change-Id: Ibb9d6f6383eb96ba27e0edd60423552e5cea4688 --- diff --git a/includes/Linker.php b/includes/Linker.php index 198015466f..01f695a31f 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -688,8 +688,8 @@ class Linker { $label = $title->getPrefixedText(); } $encLabel = htmlspecialchars( $label ); - $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title ); - $currentExists = $time ? ( $file != false ) : false; + $currentExists = $time + && MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title ) !== false; if ( ( $wgUploadMissingFileUrl || $wgUploadNavigationUrl || $wgEnableUploads ) && !$currentExists diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 1e1bde38be..d7d6bf78d8 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1906,7 +1906,7 @@ class LocalFile extends File { * @return Status */ function move( $target ) { - $localRepo = MediaWikiServices::getInstance()->getRepoGroup(); + $localRepo = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo(); if ( $this->getRepo()->getReadOnlyReason() !== false ) { return $this->readOnlyFatalStatus(); } @@ -1923,8 +1923,8 @@ class LocalFile extends File { wfDebugLog( 'imagemove', "Finished moving {$this->name}" ); // Purge the source and target files... - $oldTitleFile = $localRepo->findFile( $this->title ); - $newTitleFile = $localRepo->findFile( $target ); + $oldTitleFile = $localRepo->newFile( $this->title ); + $newTitleFile = $localRepo->newFile( $target ); // To avoid slow purges in the transaction, move them outside... DeferredUpdates::addUpdate( new AutoCommitUpdate(