X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FHTMLFileCache.php;h=6d0b87e6e66c15e98da89b0f49af29a9db0d5301;hb=35da1bbd7cb8b4414c4fbcf331473f1024bc638d;hp=a0d61b259efd7c3058992252efa859de4fb57300;hpb=b235c8be4ba75590871db5fe04c6a315d5008f9d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/HTMLFileCache.php b/includes/cache/HTMLFileCache.php index a0d61b259e..6d0b87e6e6 100644 --- a/includes/cache/HTMLFileCache.php +++ b/includes/cache/HTMLFileCache.php @@ -219,21 +219,33 @@ class HTMLFileCache extends FileCacheBase { return $text; } + /** + * @param string[] $prefixedDbKeys List of prefixed DB keys for pages to purge + * @since 1.34 + */ + public static function purge( array $prefixedDbKeys ) { + foreach ( $prefixedDbKeys as $prefixedDbKey ) { + foreach ( self::cacheablePageActions() as $type ) { + $fc = new self( $prefixedDbKey, $type ); + $fc->clearCache(); + } + } + } + /** * Clear the file caches for a page for all actions - * @param Title $title + * @param Traversable|Title[]|Title $titles * @return bool Whether $wgUseFileCache is enabled */ - public static function clearFileCache( Title $title ) { + public static function clearFileCache( $titles ) { $config = MediaWikiServices::getInstance()->getMainConfig(); - if ( !$config->get( 'UseFileCache' ) ) { return false; } - foreach ( self::cacheablePageActions() as $type ) { - $fc = new self( $title, $type ); - $fc->clearCache(); + $titleIterator = ( $titles instanceof Title ) ? [ $titles ] : $titles; + foreach ( $titleIterator as $title ) { + self::purge( [ $title->getPrefixedDBkey() ] ); } return true;