121 public function purgeUrls( $urls, $flags = self::PURGE_PRESEND, array $unless = [] ) {
122 $minFreshCacheMtime = $unless[self::UNLESS_CACHE_MTIME_AFTER] ??
null;
123 if ( $minFreshCacheMtime && time() > ( $minFreshCacheMtime + $this->cdnMaxAge ) ) {
127 $urls = is_string( $urls ) ? [ $urls ] : $urls;
129 $reboundDelay = $this->fieldHasFlag( $flags, self::PURGE_REBOUND )
130 ? $this->reboundDelay
133 $update =
new CdnCacheUpdate( $urls, [
'reboundDelay' => $reboundDelay ] );
134 if ( $this->fieldHasFlag( $flags, self::PURGE_PRESEND ) ) {
135 DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
153 public function purgeTitleUrls( $pages, $flags = self::PURGE_PRESEND, array $unless = [] ) {
154 $pages = is_iterable( $pages ) ? $pages : [ $pages ];
155 $pageIdentities = [];
157 foreach ( $pages as $page ) {
159 $title = $this->titleFactory->newFromPageReference( $page );
161 if ( $title->canExist() ) {
162 $pageIdentities[] = $title;
166 if ( !$pageIdentities ) {
170 if ( $this->useFileCache ) {
172 if ( $this->fieldHasFlag( $flags, self::PURGE_PRESEND ) ) {
173 DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
179 $minFreshCacheMtime = $unless[self::UNLESS_CACHE_MTIME_AFTER] ??
null;
180 if ( !$minFreshCacheMtime || time() <= ( $minFreshCacheMtime + $this->cdnMaxAge ) ) {
182 foreach ( $pageIdentities as $pi ) {
184 $urls = array_merge( $urls, $this->
getUrls( $pi, $flags ) );
198 $title = $this->titleFactory->newFromPageReference( $page );
200 if ( !$title->canExist() ) {
207 $title->getInternalURL()
215 if ( !$this->fieldHasFlag( $flags, self::PURGE_URLS_LINKSUPDATE_ONLY ) ) {
216 $urls[] = $title->getInternalURL(
'action=history' );
219 if ( $title->isUserJsConfigPage() || $title->isSiteJsConfigPage() ) {
220 $urls[] = $title->getInternalURL(
'action=raw&ctype=text/javascript' );
221 } elseif ( $title->isUserJsonConfigPage() || $title->isSiteJsonConfigPage() ) {
222 $urls[] = $title->getInternalURL(
'action=raw&ctype=application/json' );
223 } elseif ( $title->isUserCssConfigPage() || $title->isSiteCssConfigPage() ) {
224 $urls[] = $title->getInternalURL(
'action=raw&ctype=text/css' );
230 $mode = $flags & self::PURGE_URLS_LINKSUPDATE_ONLY;
231 $this->hookRunner->onHtmlCacheUpdaterAppendUrls( $title, $mode, $append );
232 $urls = array_merge( $urls, $append );
236 $this->hookRunner->onHtmlCacheUpdaterVaryUrls( $urls, $append );
237 $urls = array_merge( $urls, $append );
240 $this->hookRunner->onTitleSquidURLs( $title, $urls );