80 public function run() {
85 if ( isset( $this->params[
'table'] ) && !isset( $this->params[
'pages'] ) ) {
86 $this->params[
'recursive'] =
true;
90 if ( !empty( $this->params[
'recursive'] ) ) {
94 $extraParams[
'causeAction'] = $this->params[
'causeAction'];
95 $extraParams[
'causeAgent'] = $this->params[
'causeAgent'];
98 $jobs = BacklinkJobUtils::partitionBacklinkJob(
103 [
'params' => $extraParams ]
107 } elseif ( isset( $this->params[
'pages'] ) ) {
113 $t->getArticleID() => [ $t->getNamespace(), $t->getDBkey() ]
125 $pageIds = array_keys( $pages );
130 $rootTsUnix =
wfTimestampOrNull( TS_UNIX, $this->params[
'rootJobTimestamp'] ??
null );
139 $newTouchedUnix = time();
141 $casTsUnix = $rootTsUnix ?? $newTouchedUnix;
144 $config = $services->getMainConfig();
146 $dbProvider = $services->getConnectionProvider();
147 $dbw = $dbProvider->getPrimaryDatabase();
148 $ticket = $dbProvider->getEmptyTransactionTicket( __METHOD__ );
152 foreach ( $batches as $batch ) {
153 $dbw->newUpdateQueryBuilder()
155 ->set( [
'page_touched' => $dbw->timestamp( $newTouchedUnix ) ] )
156 ->where( [
'page_id' => $batch ] )
157 ->andWhere( $dbw->expr(
'page_touched',
'<', $dbw->timestamp( $casTsUnix ) ) )
158 ->caller( __METHOD__ )->execute();
159 if ( count( $batches ) > 1 ) {
160 $dbProvider->commitAndWaitForReplication( __METHOD__, $ticket );
164 $queryBuilder = $dbw->newSelectQueryBuilder()
165 ->select( [
'page_namespace',
'page_title' ] )
167 ->where( [
'page_id' => $pageIds,
'page_touched' => $dbw->timestamp( $newTouchedUnix ) ] );
169 $queryBuilder->field(
'page_lang' );
171 $titleArray = $services->getTitleFactory()->newTitleArrayFromResult(
172 $queryBuilder->caller( __METHOD__ )->fetchResultSet()
176 $htmlCache = $services->getHtmlCacheUpdater();
177 $htmlCache->purgeTitleUrls(
179 $htmlCache::PURGE_NAIVE | $htmlCache::PURGE_URLS_LINKSUPDATE_ONLY,
180 [ $htmlCache::UNLESS_CACHE_MTIME_AFTER => $casTsUnix + self::NORMAL_MAX_LAG ]