aboutsummaryrefslogtreecommitdiffstats
path: root/includes/cache/HTMLFileCache.php
diff options
context:
space:
mode:
authordaniel <dkinzler@wikimedia.org>2021-04-09 15:38:53 +0200
committerdaniel <dkinzler@wikimedia.org>2021-04-14 18:49:45 +0200
commit185d535457b7a1e5da002764ee937209bf68e215 (patch)
treec5ec96cc6e87423d9c0b2c970d07dbe70e26d193 /includes/cache/HTMLFileCache.php
parenta6ddbeb3466750d8d9cd41cbf926d8d9fac7b043 (diff)
downloadmediawikicore-185d535457b7a1e5da002764ee937209bf68e215.tar.gz
mediawikicore-185d535457b7a1e5da002764ee937209bf68e215.zip
HTMLFileCache: replace Title in method signatures
Bug: T278459 Change-Id: I77fb37c1aec17d3e51056f85fdff59821f326cc3
Diffstat (limited to 'includes/cache/HTMLFileCache.php')
-rw-r--r--includes/cache/HTMLFileCache.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/includes/cache/HTMLFileCache.php b/includes/cache/HTMLFileCache.php
index bc5c2f1d4e17..939fa07e490e 100644
--- a/includes/cache/HTMLFileCache.php
+++ b/includes/cache/HTMLFileCache.php
@@ -21,7 +21,9 @@
* @ingroup Cache
*/
+use MediaWiki\Cache\CacheKeyHelper;
use MediaWiki\MediaWikiServices;
+use MediaWiki\Page\PageIdentity;
/**
* Page view caching in the file system.
@@ -36,20 +38,19 @@ class HTMLFileCache extends FileCacheBase {
public const MODE_REBUILD = 2; // background cache rebuild mode
/**
- * @param Title|string $title Title object or prefixed DB key string
+ * @param PageIdentity|string $page PageIdentity object or prefixed DB key string
* @param string $action
+ *
* @throws InvalidArgumentException
*/
- public function __construct( $title, $action ) {
+ public function __construct( $page, $action ) {
parent::__construct();
if ( !in_array( $action, self::cacheablePageActions() ) ) {
throw new InvalidArgumentException( 'Invalid file cache type given.' );
}
- $this->mKey = ( $title instanceof Title )
- ? $title->getPrefixedDBkey()
- : (string)$title;
+ $this->mKey = CacheKeyHelper::getKeyForPage( $page );
$this->mType = (string)$action;
$this->mExt = 'html';
}
@@ -220,17 +221,17 @@ class HTMLFileCache extends FileCacheBase {
/**
* Clear the file caches for a page for all actions
*
- * @param Title|string $title Title or prefixed DB key
+ * @param PageIdentity|string $page PageIdentity object or prefixed DB key string
* @return bool Whether $wgUseFileCache is enabled
*/
- public static function clearFileCache( $title ) {
+ public static function clearFileCache( $page ) {
$config = MediaWikiServices::getInstance()->getMainConfig();
if ( !$config->get( 'UseFileCache' ) ) {
return false;
}
foreach ( self::cacheablePageActions() as $type ) {
- $fc = new self( $title, $type );
+ $fc = new self( $page, $type );
$fc->clearCache();
}