MediaWiki  master
HtmlFileCacheUpdate.php
Go to the documentation of this file.
1 <?php
23 use Wikimedia\Assert\Assert;
24 
33  private $pages;
34 
38  private function __construct( array $pages ) {
39  $this->pages = $pages;
40  }
41 
42  public function merge( MergeableUpdate $update ) {
44  Assert::parameterType( __CLASS__, $update, '$update' );
45  '@phan-var self $update';
46 
47  $this->pages = array_merge( $this->pages, $update->pages );
48  }
49 
56  public static function newFromTitles( $pages ) {
57  wfDeprecated( __METHOD__, '1.37' );
58  return self::newFromPages( $pages );
59  }
60 
67  public static function newFromPages( $pages ) {
68  $pagesByKey = [];
69  foreach ( $pages as $pg ) {
70  $key = CacheKeyHelper::getKeyForPage( $pg );
71  $pagesByKey[$key] = $pg;
72  }
73 
74  return new self( $pagesByKey );
75  }
76 
77  public function doUpdate() {
78  foreach ( $this->pages as $pg ) {
80  }
81  }
82 }
Page\PageIdentity
Interface for objects (potentially) representing an editable wiki page.
Definition: PageIdentity.php:64
HtmlFileCacheUpdate\__construct
__construct(array $pages)
Definition: HtmlFileCacheUpdate.php:38
HtmlFileCacheUpdate\newFromPages
static newFromPages( $pages)
Definition: HtmlFileCacheUpdate.php:67
HTMLFileCache\clearFileCache
static clearFileCache( $page)
Clear the file caches for a page for all actions.
Definition: HTMLFileCache.php:227
HtmlFileCacheUpdate\newFromTitles
static newFromTitles( $pages)
Definition: HtmlFileCacheUpdate.php:56
MergeableUpdate
Interface that deferrable updates can implement to signal that updates can be combined.
Definition: MergeableUpdate.php:21
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Definition: GlobalFunctions.php:989
HtmlFileCacheUpdate
HTMLFileCache purge update for a set of titles.
Definition: HtmlFileCacheUpdate.php:31
HtmlFileCacheUpdate\doUpdate
doUpdate()
Perform the actual work.
Definition: HtmlFileCacheUpdate.php:77
HtmlFileCacheUpdate\$pages
PageIdentity[] $pages
List of pages.
Definition: HtmlFileCacheUpdate.php:33
MediaWiki\Cache\CacheKeyHelper
Helper class for mapping value objects representing basic entities to cache keys.
Definition: CacheKeyHelper.php:43
DeferrableUpdate
Interface that deferrable updates should implement.
Definition: DeferrableUpdate.php:11
HtmlFileCacheUpdate\merge
merge(MergeableUpdate $update)
Merge this enqueued update with a new MergeableUpdate of the same qualified class name.
Definition: HtmlFileCacheUpdate.php:42