114 $pageIds = array_keys( $pages );
119 $rootTsUnix =
wfTimestampOrNull( TS_UNIX, $this->params[
'rootJobTimestamp'] ??
null );
128 $newTouchedUnix = time();
130 $casTsUnix = $rootTsUnix ?? $newTouchedUnix;
132 $services = MediaWikiServices::getInstance();
133 $config = $services->getMainConfig();
135 $lbFactory = $services->getDBLoadBalancerFactory();
136 $dbw = $lbFactory->getMainLB()->getConnectionRef(
DB_MASTER );
137 $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
140 $batches = array_chunk( $pageIds, $config->get(
'UpdateRowsPerQuery' ) );
141 foreach ( $batches as $batch ) {
142 $dbw->update(
'page',
143 [
'page_touched' => $dbw->timestamp( $newTouchedUnix ) ],
146 "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $casTsUnix ) )
150 if ( count( $batches ) > 1 ) {
151 $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
155 $titleArray = TitleArray::newFromResult( $dbw->select(
158 [
'page_namespace',
'page_title' ],
159 $config->get(
'PageLanguageUseDB' ) ? [
'page_lang' ] : []
161 [
'page_id' => $pageIds,
'page_touched' => $dbw->timestamp( $newTouchedUnix ) ],
166 $htmlCache = MediaWikiServices::getInstance()->getHtmlCacheUpdater();
167 $htmlCache->purgeTitleUrls(
169 $htmlCache::PURGE_NAIVE | $htmlCache::PURGE_URLS_LINKSUPDATE_ONLY,
170 [ $htmlCache::UNLESS_CACHE_MTIME_AFTER => $casTsUnix + self::NORMAL_MAX_LAG ]