129 public function purgeUrls( $urls, $flags = self::PURGE_PRESEND, array $unless = [] ) {
130 $minFreshCacheMtime = $unless[self::UNLESS_CACHE_MTIME_AFTER] ??
null;
131 if ( $minFreshCacheMtime && time() > ( $minFreshCacheMtime + $this->cdnMaxAge ) ) {
135 $urls = is_string( $urls ) ? [ $urls ] : $urls;
137 $reboundDelay = $this->fieldHasFlag( $flags, self::PURGE_REBOUND )
138 ? $this->reboundDelay
141 $update =
new CdnCacheUpdate( $urls, [
'reboundDelay' => $reboundDelay ] );
142 if ( $this->fieldHasFlag( $flags, self::PURGE_PRESEND ) ) {
143 DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
161 public function purgeTitleUrls( $pages, $flags = self::PURGE_PRESEND, array $unless = [] ) {
162 $pages = is_iterable( $pages ) ? $pages : [ $pages ];
163 $pageIdentities = [];
165 foreach ( $pages as $page ) {
167 $title = $this->titleFactory->castFromPageReference( $page );
169 if (
$title->canExist() ) {
170 $pageIdentities[] =
$title;
174 if ( !$pageIdentities ) {
178 if ( $this->useFileCache ) {
181 if ( $this->fieldHasFlag( $flags, self::PURGE_PRESEND ) ) {
182 DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
188 $minFreshCacheMtime = $unless[self::UNLESS_CACHE_MTIME_AFTER] ??
null;
189 if ( !$minFreshCacheMtime || time() <= ( $minFreshCacheMtime + $this->cdnMaxAge ) ) {
191 foreach ( $pageIdentities as $pi ) {
194 $urls = array_merge( $urls, $this->
getUrls( $pi, $flags ) );
208 $title = $this->titleFactory->castFromPageReference( $page );
210 if ( !
$title->canExist() ) {
225 if ( !$this->fieldHasFlag( $flags, self::PURGE_URLS_LINKSUPDATE_ONLY ) ) {
226 $urls[] =
$title->getInternalURL(
'action=history' );
229 if (
$title->isUserJsConfigPage() ||
$title->isSiteJsConfigPage() ) {
230 $urls[] =
$title->getInternalURL(
'action=raw&ctype=text/javascript' );
231 } elseif (
$title->isUserJsonConfigPage() ||
$title->isSiteJsonConfigPage() ) {
232 $urls[] =
$title->getInternalURL(
'action=raw&ctype=application/json' );
233 } elseif (
$title->isUserCssConfigPage() ||
$title->isSiteCssConfigPage() ) {
234 $urls[] =
$title->getInternalURL(
'action=raw&ctype=text/css' );
240 $mode = $flags & self::PURGE_URLS_LINKSUPDATE_ONLY;
242 $this->hookRunner->onHtmlCacheUpdaterAppendUrls(
$title, $mode, $append );
243 $urls = array_merge( $urls, $append );
247 $this->hookRunner->onHtmlCacheUpdaterVaryUrls( $urls, $append );
248 $urls = array_merge( $urls, $append );
252 $this->hookRunner->onTitleSquidURLs(
$title, $urls );