X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fpage%2FWikiFilePage.php;h=972a397c5e0f755d1b3bc39a49af8fecc0ea878b;hp=e4b524b811ecf34c11cafb57091ab6d4e8205177;hb=6c9a2923fe1ee3a65cb027be5e781772f2b12fbd;hpb=42347bf5351597c432c696591a093d026062dcf8 diff --git a/includes/page/WikiFilePage.php b/includes/page/WikiFilePage.php index e4b524b811..972a397c5e 100644 --- a/includes/page/WikiFilePage.php +++ b/includes/page/WikiFilePage.php @@ -164,26 +164,38 @@ class WikiFilePage extends WikiPage { return $this->mDupes; } - public function doPurge( $flags = self::PURGE_ALL ) { + /** + * Override handling of action=purge + * @return bool + */ + public function doPurge() { $this->loadFile(); if ( $this->mFile->exists() ) { wfDebug( 'ImagePage::doPurge purging ' . $this->mFile->getName() . "\n" ); DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this->mTitle, 'imagelinks' ) ); - $this->mFile->purgeCache( [ 'forThumbRefresh' => true ] ); } else { wfDebug( 'ImagePage::doPurge no image for ' . $this->mFile->getName() . "; limiting purge to cache only\n" ); - // even if the file supposedly doesn't exist, force any cached information - // to be updated (in case the cached information is wrong) - $this->mFile->purgeCache( [ 'forThumbRefresh' => true ] ); } + + // even if the file supposedly doesn't exist, force any cached information + // to be updated (in case the cached information is wrong) + + // Purge current version and its thumbnails + $this->mFile->purgeCache( [ 'forThumbRefresh' => true ] ); + + // Purge the old versions and their thumbnails + foreach ( $this->mFile->getHistory() as $oldFile ) { + $oldFile->purgeCache( [ 'forThumbRefresh' => true ] ); + } + if ( $this->mRepo ) { // Purge redirect cache $this->mRepo->invalidateImageRedirect( $this->mTitle ); } - return parent::doPurge( $flags ); + return parent::doPurge(); } /**