135 public function purgeUrls( $urls, $flags = self::PURGE_PRESEND, array $unless = [] ) {
136 $minFreshCacheMtime = $unless[self::UNLESS_CACHE_MTIME_AFTER] ??
null;
137 if ( $minFreshCacheMtime && time() > ( $minFreshCacheMtime + $this->cdnMaxAge ) ) {
141 $urls = is_string( $urls ) ? [ $urls ] : $urls;
143 $reboundDelay = $this->fieldHasFlag( $flags, self::PURGE_REBOUND )
144 ? $this->reboundDelay
147 $update =
new CdnCacheUpdate( $urls, [
'reboundDelay' => $reboundDelay ] );
148 if ( $this->fieldHasFlag( $flags, self::PURGE_PRESEND ) ) {
149 DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
167 public function purgeTitleUrls( $pages, $flags = self::PURGE_PRESEND, array $unless = [] ) {
168 $pages = is_iterable( $pages ) ? $pages : [ $pages ];
169 $pageIdentities = [];
171 foreach ( $pages as $page ) {
173 $title = $this->titleFactory->newFromPageReference( $page );
175 if ( $title->canExist() ) {
176 $pageIdentities[] = $title;
180 if ( !$pageIdentities ) {
184 if ( $this->useFileCache ) {
186 if ( $this->fieldHasFlag( $flags, self::PURGE_PRESEND ) ) {
187 DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
193 $minFreshCacheMtime = $unless[self::UNLESS_CACHE_MTIME_AFTER] ??
null;
194 if ( !$minFreshCacheMtime || time() <= ( $minFreshCacheMtime + $this->cdnMaxAge ) ) {
196 foreach ( $pageIdentities as $pi ) {
198 $urls = array_merge( $urls, $this->
getUrls( $pi, $flags ) );
212 $title = $this->titleFactory->newFromPageReference( $page );
214 if ( !$title->canExist() ) {
221 $title->getInternalURL()
229 if ( !$this->fieldHasFlag( $flags, self::PURGE_URLS_LINKSUPDATE_ONLY ) ) {
230 $urls[] = $title->getInternalURL(
'action=history' );
233 if ( $title->isUserJsConfigPage() || $title->isSiteJsConfigPage() ) {
234 $urls[] = $title->getInternalURL(
'action=raw&ctype=text/javascript' );
235 } elseif ( $title->isUserJsonConfigPage() || $title->isSiteJsonConfigPage() ) {
236 $urls[] = $title->getInternalURL(
'action=raw&ctype=application/json' );
237 } elseif ( $title->isUserCssConfigPage() || $title->isSiteCssConfigPage() ) {
238 $urls[] = $title->getInternalURL(
'action=raw&ctype=text/css' );
244 $mode = $flags & self::PURGE_URLS_LINKSUPDATE_ONLY;
245 $this->hookRunner->onHtmlCacheUpdaterAppendUrls( $title, $mode, $append );
246 $urls = array_merge( $urls, $append );
250 $this->hookRunner->onHtmlCacheUpdaterVaryUrls( $urls, $append );
251 $urls = array_merge( $urls, $append );
254 $this->hookRunner->onTitleSquidURLs( $title, $urls );