76 public function run() {
77 $updateRowsPerJob = MediaWikiServices::getInstance()->getMainConfig()->get(
78 MainConfigNames::UpdateRowsPerJob );
79 $updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get(
80 MainConfigNames::UpdateRowsPerQuery );
81 if ( isset( $this->params[
'table'] ) && !isset( $this->params[
'pages'] ) ) {
82 $this->params[
'recursive'] =
true;
86 if ( !empty( $this->params[
'recursive'] ) ) {
90 $extraParams[
'causeAction'] = $this->params[
'causeAction'];
91 $extraParams[
'causeAgent'] = $this->params[
'causeAgent'];
99 [
'params' => $extraParams ]
101 MediaWikiServices::getInstance()->getJobQueueGroup()->push( $jobs );
103 } elseif ( isset( $this->params[
'pages'] ) ) {
109 $t->getArticleID() => [
$t->getNamespace(),
$t->getDBkey() ]
121 $pageIds = array_keys( $pages );
126 $rootTsUnix =
wfTimestampOrNull( TS_UNIX, $this->params[
'rootJobTimestamp'] ??
null );
135 $newTouchedUnix = time();
137 $casTsUnix = $rootTsUnix ?? $newTouchedUnix;
139 $services = MediaWikiServices::getInstance();
140 $config = $services->getMainConfig();
142 $lbFactory = $services->getDBLoadBalancerFactory();
143 $dbw = $lbFactory->getMainLB()->getConnectionRef(
DB_PRIMARY );
144 $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
147 $batches = array_chunk( $pageIds, $config->get( MainConfigNames::UpdateRowsPerQuery ) );
148 foreach ( $batches as $batch ) {
149 $dbw->update(
'page',
150 [
'page_touched' => $dbw->timestamp( $newTouchedUnix ) ],
153 "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $casTsUnix ) )
157 if ( count( $batches ) > 1 ) {
158 $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
165 [
'page_namespace',
'page_title' ],
166 $config->get( MainConfigNames::PageLanguageUseDB ) ? [
'page_lang' ] : []
168 [
'page_id' => $pageIds,
'page_touched' => $dbw->timestamp( $newTouchedUnix ) ],
173 $htmlCache = MediaWikiServices::getInstance()->getHtmlCacheUpdater();
174 $htmlCache->purgeTitleUrls(
176 $htmlCache::PURGE_NAIVE | $htmlCache::PURGE_URLS_LINKSUPDATE_ONLY,
177 [ $htmlCache::UNLESS_CACHE_MTIME_AFTER => $casTsUnix + self::NORMAL_MAX_LAG ]