diff options
Diffstat (limited to 'includes/cache')
-rw-r--r-- | includes/cache/HTMLFileCache.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/includes/cache/HTMLFileCache.php b/includes/cache/HTMLFileCache.php index b8dbdf7109f1..58ca2dcd5e3f 100644 --- a/includes/cache/HTMLFileCache.php +++ b/includes/cache/HTMLFileCache.php @@ -35,21 +35,28 @@ class HTMLFileCache extends FileCacheBase { * @param string $action * @throws MWException * @return HTMLFileCache + * + * @deprecated Since 1.24, instantiate this class directly */ public static function newFromTitle( $title, $action ) { - $cache = new self(); + return new self( $title, $action ); + } + /** + * @param Title|string $title Title object or prefixed DB key string + * @param string $action + * @throws MWException + */ + public function __construct( $title, $action ) { $allowedTypes = self::cacheablePageActions(); if ( !in_array( $action, $allowedTypes ) ) { - throw new MWException( "Invalid filecache type given." ); + throw new MWException( 'Invalid file cache type given.' ); } - $cache->mKey = ( $title instanceof Title ) + $this->mKey = ( $title instanceof Title ) ? $title->getPrefixedDBkey() : (string)$title; - $cache->mType = (string)$action; - $cache->mExt = 'html'; - - return $cache; + $this->mType = (string)$action; + $this->mExt = 'html'; } /** @@ -215,7 +222,7 @@ class HTMLFileCache extends FileCacheBase { } foreach ( self::cacheablePageActions() as $type ) { - $fc = self::newFromTitle( $title, $type ); + $fc = new self( $title, $type ); $fc->clearCache(); } |