3 * Updater for link tracking tables after a page edit.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 * See docs/deferred.txt
26 * @todo document (e.g. one-sentence top-level class description).
28 class LinksUpdate
extends SqlDataUpdate
implements EnqueueableDataUpdate
{
29 // @todo make members protected, but make sure extensions don't break
31 /** @var int Page ID of the article linked from */
34 /** @var Title Title object of the article linked from */
37 /** @var ParserOutput */
38 public $mParserOutput;
40 /** @var array Map of title strings to IDs for the links in the document */
43 /** @var array DB keys of the images used, in the array key only */
46 /** @var array Map of title strings to IDs for the template references, including broken ones */
49 /** @var array URLs of external links, array key only */
52 /** @var array Map of category names to sort keys */
55 /** @var array Map of language codes to titles */
58 /** @var array 2-D map of (prefix => DBK => 1) */
61 /** @var array Map of arbitrary name to value */
64 /** @var bool Whether to queue jobs for recursive updates */
67 /** @var Revision Revision for which this update has been triggered */
71 * @var null|array Added links if calculated.
73 private $linkInsertions = null;
76 * @var null|array Deleted links if calculated.
78 private $linkDeletions = null;
88 * @param Title $title Title of the page we're updating
89 * @param ParserOutput $parserOutput Output from a full parse of this page
90 * @param bool $recursive Queue jobs for recursive updates?
93 function __construct( Title
$title, ParserOutput
$parserOutput, $recursive = true ) {
94 parent
::__construct( false ); // no implicit transaction
96 $this->mTitle
= $title;
97 $this->mId
= $title->getArticleID( Title
::GAID_FOR_UPDATE
);
100 throw new InvalidArgumentException(
101 "The Title object yields no ID. Perhaps the page doesn't exist?"
105 $this->mParserOutput
= $parserOutput;
107 $this->mLinks
= $parserOutput->getLinks();
108 $this->mImages
= $parserOutput->getImages();
109 $this->mTemplates
= $parserOutput->getTemplates();
110 $this->mExternals
= $parserOutput->getExternalLinks();
111 $this->mCategories
= $parserOutput->getCategories();
112 $this->mProperties
= $parserOutput->getProperties();
113 $this->mInterwikis
= $parserOutput->getInterwikiLinks();
115 # Convert the format of the interlanguage links
116 # I didn't want to change it in the ParserOutput, because that array is passed all
117 # the way back to the skin, so either a skin API break would be required, or an
118 # inefficient back-conversion.
119 $ill = $parserOutput->getLanguageLinks();
120 $this->mInterlangs
= [];
121 foreach ( $ill as $link ) {
122 list( $key, $title ) = explode( ':', $link, 2 );
123 $this->mInterlangs
[$key] = $title;
126 foreach ( $this->mCategories
as &$sortkey ) {
127 # If the sortkey is longer then 255 bytes,
128 # it truncated by DB, and then doesn't get
129 # matched when comparing existing vs current
130 # categories, causing bug 25254.
131 # Also. substr behaves weird when given "".
132 if ( $sortkey !== '' ) {
133 $sortkey = substr( $sortkey, 0, 255 );
137 $this->mRecursive
= $recursive;
139 Hooks
::run( 'LinksUpdateConstructed', [ &$this ] );
143 * Update link tables with outgoing links from an updated article
145 public function doUpdate() {
146 Hooks
::run( 'LinksUpdate', [ &$this ] );
147 $this->doIncrementalUpdate();
149 $this->mDb
->onTransactionIdle( function() {
150 Hooks
::run( 'LinksUpdateComplete', [ &$this ] );
154 protected function doIncrementalUpdate() {
156 $existing = $this->getExistingLinks();
157 $this->linkDeletions
= $this->getLinkDeletions( $existing );
158 $this->linkInsertions
= $this->getLinkInsertions( $existing );
159 $this->incrTableUpdate( 'pagelinks', 'pl', $this->linkDeletions
, $this->linkInsertions
);
162 $existing = $this->getExistingImages();
164 $imageDeletes = $this->getImageDeletions( $existing );
165 $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes,
166 $this->getImageInsertions( $existing ) );
168 # Invalidate all image description pages which had links added or removed
169 $imageUpdates = $imageDeletes +
array_diff_key( $this->mImages
, $existing );
170 $this->invalidateImageDescriptions( $imageUpdates );
173 $existing = $this->getExistingExternals();
174 $this->incrTableUpdate( 'externallinks', 'el', $this->getExternalDeletions( $existing ),
175 $this->getExternalInsertions( $existing ) );
178 $existing = $this->getExistingInterlangs();
179 $this->incrTableUpdate( 'langlinks', 'll', $this->getInterlangDeletions( $existing ),
180 $this->getInterlangInsertions( $existing ) );
182 # Inline interwiki links
183 $existing = $this->getExistingInterwikis();
184 $this->incrTableUpdate( 'iwlinks', 'iwl', $this->getInterwikiDeletions( $existing ),
185 $this->getInterwikiInsertions( $existing ) );
188 $existing = $this->getExistingTemplates();
189 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
190 $this->getTemplateInsertions( $existing ) );
193 $existing = $this->getExistingCategories();
195 $categoryDeletes = $this->getCategoryDeletions( $existing );
197 $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes,
198 $this->getCategoryInsertions( $existing ) );
200 # Invalidate all categories which were added, deleted or changed (set symmetric difference)
201 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
202 $categoryUpdates = $categoryInserts +
$categoryDeletes;
203 $this->invalidateCategories( $categoryUpdates );
204 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
207 $existing = $this->getExistingProperties();
209 $propertiesDeletes = $this->getPropertyDeletions( $existing );
211 $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
212 $this->getPropertyInsertions( $existing ) );
214 # Invalidate the necessary pages
215 $changed = $propertiesDeletes +
array_diff_assoc( $this->mProperties
, $existing );
216 $this->invalidateProperties( $changed );
218 # Update the links table freshness for this title
219 $this->updateLinksTimestamp();
221 # Refresh links of all pages including this page
222 # This will be in a separate transaction
223 if ( $this->mRecursive
) {
224 $this->queueRecursiveJobs();
230 * Queue recursive jobs for this page
232 * Which means do LinksUpdate on all pages that include the current page,
233 * using the job queue.
235 protected function queueRecursiveJobs() {
236 self
::queueRecursiveJobsForTable( $this->mTitle
, 'templatelinks' );
237 if ( $this->mTitle
->getNamespace() == NS_FILE
) {
238 // Process imagelinks in case the title is or was a redirect
239 self
::queueRecursiveJobsForTable( $this->mTitle
, 'imagelinks' );
242 $bc = $this->mTitle
->getBacklinkCache();
243 // Get jobs for cascade-protected backlinks for a high priority queue.
244 // If meta-templates change to using a new template, the new template
245 // should be implicitly protected as soon as possible, if applicable.
246 // These jobs duplicate a subset of the above ones, but can run sooner.
247 // Which ever runs first generally no-ops the other one.
249 foreach ( $bc->getCascadeProtectedLinks() as $title ) {
250 $jobs[] = RefreshLinksJob
::newPrioritized( $title, [] );
252 JobQueueGroup
::singleton()->push( $jobs );
256 * Queue a RefreshLinks job for any table.
258 * @param Title $title Title to do job for
259 * @param string $table Table to use (e.g. 'templatelinks')
261 public static function queueRecursiveJobsForTable( Title
$title, $table ) {
262 if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
263 $job = new RefreshLinksJob(
268 ] + Job
::newRootJobParams( // "overall" refresh links job info
269 "refreshlinks:{$table}:{$title->getPrefixedText()}"
273 JobQueueGroup
::singleton()->push( $job );
280 function invalidateCategories( $cats ) {
281 $this->invalidatePages( NS_CATEGORY
, array_keys( $cats ) );
285 * Update all the appropriate counts in the category table.
286 * @param array $added Associative array of category name => sort key
287 * @param array $deleted Associative array of category name => sort key
289 function updateCategoryCounts( $added, $deleted ) {
290 $a = WikiPage
::factory( $this->mTitle
);
291 $a->updateCategoryCounts(
292 array_keys( $added ), array_keys( $deleted )
297 * @param array $images
299 function invalidateImageDescriptions( $images ) {
300 $this->invalidatePages( NS_FILE
, array_keys( $images ) );
304 * Update a table by doing a delete query then an insert query
305 * @param string $table Table name
306 * @param string $prefix Field name prefix
307 * @param array $deletions
308 * @param array $insertions Rows to insert
310 function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
311 if ( $table == 'page_props' ) {
312 $fromField = 'pp_page';
314 $fromField = "{$prefix}_from";
316 $where = [ $fromField => $this->mId
];
317 if ( $table == 'pagelinks' ||
$table == 'templatelinks' ||
$table == 'iwlinks' ) {
318 if ( $table == 'iwlinks' ) {
319 $baseKey = 'iwl_prefix';
321 $baseKey = "{$prefix}_namespace";
323 $clause = $this->mDb
->makeWhereFrom2d( $deletions, $baseKey, "{$prefix}_title" );
330 if ( $table == 'langlinks' ) {
331 $toField = 'll_lang';
332 } elseif ( $table == 'page_props' ) {
333 $toField = 'pp_propname';
335 $toField = $prefix . '_to';
337 if ( count( $deletions ) ) {
338 $where[$toField] = array_keys( $deletions );
344 $this->mDb
->delete( $table, $where, __METHOD__
);
346 if ( count( $insertions ) ) {
347 $this->mDb
->insert( $table, $insertions, __METHOD__
, 'IGNORE' );
348 Hooks
::run( 'LinksUpdateAfterInsert', [ $this, $table, $insertions ] );
353 * Get an array of pagelinks insertions for passing to the DB
354 * Skips the titles specified by the 2-D array $existing
355 * @param array $existing
358 private function getLinkInsertions( $existing = [] ) {
360 foreach ( $this->mLinks
as $ns => $dbkeys ) {
361 $diffs = isset( $existing[$ns] )
362 ?
array_diff_key( $dbkeys, $existing[$ns] )
364 foreach ( $diffs as $dbk => $id ) {
366 'pl_from' => $this->mId
,
367 'pl_from_namespace' => $this->mTitle
->getNamespace(),
368 'pl_namespace' => $ns,
378 * Get an array of template insertions. Like getLinkInsertions()
379 * @param array $existing
382 private function getTemplateInsertions( $existing = [] ) {
384 foreach ( $this->mTemplates
as $ns => $dbkeys ) {
385 $diffs = isset( $existing[$ns] ) ?
array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
386 foreach ( $diffs as $dbk => $id ) {
388 'tl_from' => $this->mId
,
389 'tl_from_namespace' => $this->mTitle
->getNamespace(),
390 'tl_namespace' => $ns,
400 * Get an array of image insertions
401 * Skips the names specified in $existing
402 * @param array $existing
405 private function getImageInsertions( $existing = [] ) {
407 $diffs = array_diff_key( $this->mImages
, $existing );
408 foreach ( $diffs as $iname => $dummy ) {
410 'il_from' => $this->mId
,
411 'il_from_namespace' => $this->mTitle
->getNamespace(),
420 * Get an array of externallinks insertions. Skips the names specified in $existing
421 * @param array $existing
424 private function getExternalInsertions( $existing = [] ) {
426 $diffs = array_diff_key( $this->mExternals
, $existing );
427 foreach ( $diffs as $url => $dummy ) {
428 foreach ( wfMakeUrlIndexes( $url ) as $index ) {
430 'el_id' => $this->mDb
->nextSequenceValue( 'externallinks_el_id_seq' ),
431 'el_from' => $this->mId
,
433 'el_index' => $index,
442 * Get an array of category insertions
444 * @param array $existing Mapping existing category names to sort keys. If both
445 * match a link in $this, the link will be omitted from the output
449 private function getCategoryInsertions( $existing = [] ) {
450 global $wgContLang, $wgCategoryCollation;
451 $diffs = array_diff_assoc( $this->mCategories
, $existing );
453 foreach ( $diffs as $name => $prefix ) {
454 $nt = Title
::makeTitleSafe( NS_CATEGORY
, $name );
455 $wgContLang->findVariantLink( $name, $nt, true );
457 if ( $this->mTitle
->getNamespace() == NS_CATEGORY
) {
459 } elseif ( $this->mTitle
->getNamespace() == NS_FILE
) {
465 # Treat custom sortkeys as a prefix, so that if multiple
466 # things are forced to sort as '*' or something, they'll
467 # sort properly in the category rather than in page_id
469 $sortkey = Collation
::singleton()->getSortKey(
470 $this->mTitle
->getCategorySortkey( $prefix ) );
473 'cl_from' => $this->mId
,
475 'cl_sortkey' => $sortkey,
476 'cl_timestamp' => $this->mDb
->timestamp(),
477 'cl_sortkey_prefix' => $prefix,
478 'cl_collation' => $wgCategoryCollation,
487 * Get an array of interlanguage link insertions
489 * @param array $existing Mapping existing language codes to titles
493 private function getInterlangInsertions( $existing = [] ) {
494 $diffs = array_diff_assoc( $this->mInterlangs
, $existing );
496 foreach ( $diffs as $lang => $title ) {
498 'll_from' => $this->mId
,
508 * Get an array of page property insertions
509 * @param array $existing
512 function getPropertyInsertions( $existing = [] ) {
513 $diffs = array_diff_assoc( $this->mProperties
, $existing );
516 foreach ( array_keys( $diffs ) as $name ) {
517 $arr[] = $this->getPagePropRowData( $name );
524 * Returns an associative array to be used for inserting a row into
525 * the page_props table. Besides the given property name, this will
526 * include the page id from $this->mId and any property value from
527 * $this->mProperties.
529 * The array returned will include the pp_sortkey field if this
530 * is present in the database (as indicated by $wgPagePropsHaveSortkey).
531 * The sortkey value is currently determined by getPropertySortKeyValue().
533 * @note this assumes that $this->mProperties[$prop] is defined.
535 * @param string $prop The name of the property.
539 private function getPagePropRowData( $prop ) {
540 global $wgPagePropsHaveSortkey;
542 $value = $this->mProperties
[$prop];
545 'pp_page' => $this->mId
,
546 'pp_propname' => $prop,
547 'pp_value' => $value,
550 if ( $wgPagePropsHaveSortkey ) {
551 $row['pp_sortkey'] = $this->getPropertySortKeyValue( $value );
558 * Determines the sort key for the given property value.
559 * This will return $value if it is a float or int,
560 * 1 or resp. 0 if it is a bool, and null otherwise.
562 * @note In the future, we may allow the sortkey to be specified explicitly
563 * in ParserOutput::setProperty.
565 * @param mixed $value
569 private function getPropertySortKeyValue( $value ) {
570 if ( is_int( $value ) ||
is_float( $value ) ||
is_bool( $value ) ) {
571 return floatval( $value );
578 * Get an array of interwiki insertions for passing to the DB
579 * Skips the titles specified by the 2-D array $existing
580 * @param array $existing
583 private function getInterwikiInsertions( $existing = [] ) {
585 foreach ( $this->mInterwikis
as $prefix => $dbkeys ) {
586 $diffs = isset( $existing[$prefix] )
587 ?
array_diff_key( $dbkeys, $existing[$prefix] )
590 foreach ( $diffs as $dbk => $id ) {
592 'iwl_from' => $this->mId
,
593 'iwl_prefix' => $prefix,
603 * Given an array of existing links, returns those links which are not in $this
604 * and thus should be deleted.
605 * @param array $existing
608 private function getLinkDeletions( $existing ) {
610 foreach ( $existing as $ns => $dbkeys ) {
611 if ( isset( $this->mLinks
[$ns] ) ) {
612 $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks
[$ns] );
614 $del[$ns] = $existing[$ns];
622 * Given an array of existing templates, returns those templates which are not in $this
623 * and thus should be deleted.
624 * @param array $existing
627 private function getTemplateDeletions( $existing ) {
629 foreach ( $existing as $ns => $dbkeys ) {
630 if ( isset( $this->mTemplates
[$ns] ) ) {
631 $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates
[$ns] );
633 $del[$ns] = $existing[$ns];
641 * Given an array of existing images, returns those images which are not in $this
642 * and thus should be deleted.
643 * @param array $existing
646 private function getImageDeletions( $existing ) {
647 return array_diff_key( $existing, $this->mImages
);
651 * Given an array of existing external links, returns those links which are not
652 * in $this and thus should be deleted.
653 * @param array $existing
656 private function getExternalDeletions( $existing ) {
657 return array_diff_key( $existing, $this->mExternals
);
661 * Given an array of existing categories, returns those categories which are not in $this
662 * and thus should be deleted.
663 * @param array $existing
666 private function getCategoryDeletions( $existing ) {
667 return array_diff_assoc( $existing, $this->mCategories
);
671 * Given an array of existing interlanguage links, returns those links which are not
672 * in $this and thus should be deleted.
673 * @param array $existing
676 private function getInterlangDeletions( $existing ) {
677 return array_diff_assoc( $existing, $this->mInterlangs
);
681 * Get array of properties which should be deleted.
682 * @param array $existing
685 function getPropertyDeletions( $existing ) {
686 return array_diff_assoc( $existing, $this->mProperties
);
690 * Given an array of existing interwiki links, returns those links which are not in $this
691 * and thus should be deleted.
692 * @param array $existing
695 private function getInterwikiDeletions( $existing ) {
697 foreach ( $existing as $prefix => $dbkeys ) {
698 if ( isset( $this->mInterwikis
[$prefix] ) ) {
699 $del[$prefix] = array_diff_key( $existing[$prefix], $this->mInterwikis
[$prefix] );
701 $del[$prefix] = $existing[$prefix];
709 * Get an array of existing links, as a 2-D array
713 private function getExistingLinks() {
714 $res = $this->mDb
->select( 'pagelinks', [ 'pl_namespace', 'pl_title' ],
715 [ 'pl_from' => $this->mId
], __METHOD__
, $this->mOptions
);
717 foreach ( $res as $row ) {
718 if ( !isset( $arr[$row->pl_namespace
] ) ) {
719 $arr[$row->pl_namespace
] = [];
721 $arr[$row->pl_namespace
][$row->pl_title
] = 1;
728 * Get an array of existing templates, as a 2-D array
732 private function getExistingTemplates() {
733 $res = $this->mDb
->select( 'templatelinks', [ 'tl_namespace', 'tl_title' ],
734 [ 'tl_from' => $this->mId
], __METHOD__
, $this->mOptions
);
736 foreach ( $res as $row ) {
737 if ( !isset( $arr[$row->tl_namespace
] ) ) {
738 $arr[$row->tl_namespace
] = [];
740 $arr[$row->tl_namespace
][$row->tl_title
] = 1;
747 * Get an array of existing images, image names in the keys
751 private function getExistingImages() {
752 $res = $this->mDb
->select( 'imagelinks', [ 'il_to' ],
753 [ 'il_from' => $this->mId
], __METHOD__
, $this->mOptions
);
755 foreach ( $res as $row ) {
756 $arr[$row->il_to
] = 1;
763 * Get an array of existing external links, URLs in the keys
767 private function getExistingExternals() {
768 $res = $this->mDb
->select( 'externallinks', [ 'el_to' ],
769 [ 'el_from' => $this->mId
], __METHOD__
, $this->mOptions
);
771 foreach ( $res as $row ) {
772 $arr[$row->el_to
] = 1;
779 * Get an array of existing categories, with the name in the key and sort key in the value.
783 private function getExistingCategories() {
784 $res = $this->mDb
->select( 'categorylinks', [ 'cl_to', 'cl_sortkey_prefix' ],
785 [ 'cl_from' => $this->mId
], __METHOD__
, $this->mOptions
);
787 foreach ( $res as $row ) {
788 $arr[$row->cl_to
] = $row->cl_sortkey_prefix
;
795 * Get an array of existing interlanguage links, with the language code in the key and the
796 * title in the value.
800 private function getExistingInterlangs() {
801 $res = $this->mDb
->select( 'langlinks', [ 'll_lang', 'll_title' ],
802 [ 'll_from' => $this->mId
], __METHOD__
, $this->mOptions
);
804 foreach ( $res as $row ) {
805 $arr[$row->ll_lang
] = $row->ll_title
;
812 * Get an array of existing inline interwiki links, as a 2-D array
813 * @return array (prefix => array(dbkey => 1))
815 protected function getExistingInterwikis() {
816 $res = $this->mDb
->select( 'iwlinks', [ 'iwl_prefix', 'iwl_title' ],
817 [ 'iwl_from' => $this->mId
], __METHOD__
, $this->mOptions
);
819 foreach ( $res as $row ) {
820 if ( !isset( $arr[$row->iwl_prefix
] ) ) {
821 $arr[$row->iwl_prefix
] = [];
823 $arr[$row->iwl_prefix
][$row->iwl_title
] = 1;
830 * Get an array of existing categories, with the name in the key and sort key in the value.
832 * @return array Array of property names and values
834 private function getExistingProperties() {
835 $res = $this->mDb
->select( 'page_props', [ 'pp_propname', 'pp_value' ],
836 [ 'pp_page' => $this->mId
], __METHOD__
, $this->mOptions
);
838 foreach ( $res as $row ) {
839 $arr[$row->pp_propname
] = $row->pp_value
;
846 * Return the title object of the page being updated
849 public function getTitle() {
850 return $this->mTitle
;
854 * Returns parser output
856 * @return ParserOutput
858 public function getParserOutput() {
859 return $this->mParserOutput
;
863 * Return the list of images used as generated by the parser
866 public function getImages() {
867 return $this->mImages
;
871 * Set the revision corresponding to this LinksUpdate
875 * @param Revision $revision
877 public function setRevision( Revision
$revision ) {
878 $this->mRevision
= $revision;
882 * Set the User who triggered this LinksUpdate
887 public function setTriggeringUser( User
$user ) {
895 public function getTriggeringUser() {
900 * Invalidate any necessary link lists related to page property changes
901 * @param array $changed
903 private function invalidateProperties( $changed ) {
904 global $wgPagePropLinkInvalidations;
906 foreach ( $changed as $name => $value ) {
907 if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
908 $inv = $wgPagePropLinkInvalidations[$name];
909 if ( !is_array( $inv ) ) {
912 foreach ( $inv as $table ) {
913 DeferredUpdates
::addUpdate( new HTMLCacheUpdate( $this->mTitle
, $table ) );
920 * Fetch page links added by this LinksUpdate. Only available after the update is complete.
922 * @return null|array Array of Titles
924 public function getAddedLinks() {
925 if ( $this->linkInsertions
=== null ) {
929 foreach ( $this->linkInsertions
as $insertion ) {
930 $result[] = Title
::makeTitle( $insertion['pl_namespace'], $insertion['pl_title'] );
937 * Fetch page links removed by this LinksUpdate. Only available after the update is complete.
939 * @return null|array Array of Titles
941 public function getRemovedLinks() {
942 if ( $this->linkDeletions
=== null ) {
946 foreach ( $this->linkDeletions
as $ns => $titles ) {
947 foreach ( $titles as $title => $unused ) {
948 $result[] = Title
::makeTitle( $ns, $title );
956 * Update links table freshness
958 protected function updateLinksTimestamp() {
960 // The link updates made here only reflect the freshness of the parser output
961 $timestamp = $this->mParserOutput
->getCacheTime();
962 $this->mDb
->update( 'page',
963 [ 'page_links_updated' => $this->mDb
->timestamp( $timestamp ) ],
964 [ 'page_id' => $this->mId
],
970 public function getAsJobSpecification() {
973 'userId' => $this->user
->getId(),
974 'userName' => $this->user
->getName(),
980 if ( $this->mRevision
) {
981 $triggeringRevisionId = $this->mRevision
->getId();
983 $triggeringRevisionId = false;
987 'wiki' => $this->mDb
->getWikiID(),
988 'job' => new JobSpecification(
989 'refreshLinksPrioritized',
991 // Reuse the parser cache if it was saved
992 'rootJobTimestamp' => $this->mParserOutput
->getCacheTime(),
993 'useRecursiveLinksUpdate' => $this->mRecursive
,
994 'triggeringUser' => $userInfo,
995 'triggeringRevisionId' => $triggeringRevisionId,
997 [ 'removeDuplicates' => true ],