* @ingroup Cache
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Job to purge the cache for all pages that link to or use another page or file
*
$touchTimestamp = wfTimestampNow();
$dbw = wfGetDB( DB_MASTER );
- $factory = wfGetLBFactory();
+ $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
// Update page_touched (skipping pages already touched since the root job).
// Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
__METHOD__
) );
- // Update CDN
- $u = CdnCacheUpdate::newFromTitles( $titleArray );
- $u->doUpdate();
+ // Update CDN; call purge() directly so as to not bother with secondary purges
+ $urls = [];
+ foreach ( $titleArray as $title ) {
+ /** @var Title $title */
+ $urls = array_merge( $urls, $title->getCdnUrls() );
+ }
+ CdnCacheUpdate::purge( $urls );
// Update file cache
if ( $wgUseFileCache ) {
}
public function workItemCount() {
- return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
+ if ( !empty( $this->params['recursive'] ) ) {
+ return 0; // nothing actually purged
+ } elseif ( isset( $this->params['pages'] ) ) {
+ return count( $this->params['pages'] );
+ }
+
+ return 1; // one title
}
}