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 }
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
static clearFileCache( $page)
Clear the file caches for a page for all actions.
HTMLFileCache purge update for a set of titles.
merge(MergeableUpdate $update)
Merge this enqueued update with a new MergeableUpdate of the same qualified class name.
doUpdate()
Perform the actual work.
static newFromPages( $pages)
static newFromTitles( $pages)
Helper class for mapping value objects representing basic entities to cache keys.
Interface that deferrable updates should implement.
Interface for objects (potentially) representing an editable wiki page.
Interface that deferrable updates can implement to signal that updates can be combined.