MediaWiki master
HtmlFileCacheUpdate.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Deferred;
22
26use Wikimedia\Assert\Assert;
27
36 private $pages;
37
41 private function __construct( array $pages ) {
42 $this->pages = $pages;
43 }
44
45 public function merge( MergeableUpdate $update ) {
47 Assert::parameterType( __CLASS__, $update, '$update' );
48 '@phan-var self $update';
49
50 $this->pages = array_merge( $this->pages, $update->pages );
51 }
52
59 public static function newFromPages( $pages ) {
60 $pagesByKey = [];
61 foreach ( $pages as $pg ) {
62 $key = CacheKeyHelper::getKeyForPage( $pg );
63 $pagesByKey[$key] = $pg;
64 }
65
66 return new self( $pagesByKey );
67 }
68
69 public function doUpdate() {
70 foreach ( $this->pages as $pg ) {
71 HTMLFileCache::clearFileCache( $pg );
72 }
73 }
74}
75
77class_alias( HtmlFileCacheUpdate::class, 'HtmlFileCacheUpdate' );
Page view caching in the file system.
Helper class for mapping value objects representing basic entities to cache keys.
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.
Interface that deferrable updates should implement.
Interface that deferrable updates can implement to signal that updates can be combined.
Interface for objects (potentially) representing an editable wiki page.