diff options
Diffstat (limited to 'includes/cache/HTMLFileCache.php')
-rw-r--r-- | includes/cache/HTMLFileCache.php | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/includes/cache/HTMLFileCache.php b/includes/cache/HTMLFileCache.php index a0d61b259efd..6d0b87e6e66c 100644 --- a/includes/cache/HTMLFileCache.php +++ b/includes/cache/HTMLFileCache.php @@ -220,20 +220,32 @@ class HTMLFileCache extends FileCacheBase { } /** + * @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; |