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 Map of arbitrary name to value */
61 /** @var bool Whether to queue jobs for recursive updates */
64 /** @var Revision Revision for which this update has been triggered */
68 * @var null|array Added links if calculated.
70 private $linkInsertions = null;
73 * @var null|array Deleted links if calculated.
75 private $linkDeletions = null;
85 * @param Title $title Title of the page we're updating
86 * @param ParserOutput $parserOutput Output from a full parse of this page
87 * @param bool $recursive Queue jobs for recursive updates?
90 function __construct( Title
$title, ParserOutput
$parserOutput, $recursive = true ) {
91 parent
::__construct( false ); // no implicit transaction
93 $this->mTitle
= $title;
94 $this->mId
= $title->getArticleID( Title
::GAID_FOR_UPDATE
);
97 throw new InvalidArgumentException(
98 "The Title object yields no ID. Perhaps the page doesn't exist?"
102 $this->mParserOutput
= $parserOutput;
104 $this->mLinks
= $parserOutput->getLinks();
105 $this->mImages
= $parserOutput->getImages();
106 $this->mTemplates
= $parserOutput->getTemplates();
107 $this->mExternals
= $parserOutput->getExternalLinks();
108 $this->mCategories
= $parserOutput->getCategories();
109 $this->mProperties
= $parserOutput->getProperties();
110 $this->mInterwikis
= $parserOutput->getInterwikiLinks();
112 # Convert the format of the interlanguage links
113 # I didn't want to change it in the ParserOutput, because that array is passed all
114 # the way back to the skin, so either a skin API break would be required, or an
115 # inefficient back-conversion.
116 $ill = $parserOutput->getLanguageLinks();
117 $this->mInterlangs
= array();
118 foreach ( $ill as $link ) {
119 list( $key, $title ) = explode( ':', $link, 2 );
120 $this->mInterlangs
[$key] = $title;
123 foreach ( $this->mCategories
as &$sortkey ) {
124 # If the sortkey is longer then 255 bytes,
125 # it truncated by DB, and then doesn't get
126 # matched when comparing existing vs current
127 # categories, causing bug 25254.
128 # Also. substr behaves weird when given "".
129 if ( $sortkey !== '' ) {
130 $sortkey = substr( $sortkey, 0, 255 );
134 $this->mRecursive
= $recursive;
136 Hooks
::run( 'LinksUpdateConstructed', array( &$this ) );
140 * Update link tables with outgoing links from an updated article
142 public function doUpdate() {
143 Hooks
::run( 'LinksUpdate', array( &$this ) );
144 $this->doIncrementalUpdate();
147 $this->mDb
->onTransactionIdle( function() use ( $that ) {
148 Hooks
::run( 'LinksUpdateComplete', array( &$that ) );
152 protected function doIncrementalUpdate() {
154 $existing = $this->getExistingLinks();
155 $this->linkDeletions
= $this->getLinkDeletions( $existing );
156 $this->linkInsertions
= $this->getLinkInsertions( $existing );
157 $this->incrTableUpdate( 'pagelinks', 'pl', $this->linkDeletions
, $this->linkInsertions
);
160 $existing = $this->getExistingImages();
162 $imageDeletes = $this->getImageDeletions( $existing );
163 $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes,
164 $this->getImageInsertions( $existing ) );
166 # Invalidate all image description pages which had links added or removed
167 $imageUpdates = $imageDeletes +
array_diff_key( $this->mImages
, $existing );
168 $this->invalidateImageDescriptions( $imageUpdates );
171 $existing = $this->getExistingExternals();
172 $this->incrTableUpdate( 'externallinks', 'el', $this->getExternalDeletions( $existing ),
173 $this->getExternalInsertions( $existing ) );
176 $existing = $this->getExistingInterlangs();
177 $this->incrTableUpdate( 'langlinks', 'll', $this->getInterlangDeletions( $existing ),
178 $this->getInterlangInsertions( $existing ) );
180 # Inline interwiki links
181 $existing = $this->getExistingInterwikis();
182 $this->incrTableUpdate( 'iwlinks', 'iwl', $this->getInterwikiDeletions( $existing ),
183 $this->getInterwikiInsertions( $existing ) );
186 $existing = $this->getExistingTemplates();
187 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
188 $this->getTemplateInsertions( $existing ) );
191 $existing = $this->getExistingCategories();
193 $categoryDeletes = $this->getCategoryDeletions( $existing );
195 $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes,
196 $this->getCategoryInsertions( $existing ) );
198 # Invalidate all categories which were added, deleted or changed (set symmetric difference)
199 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
200 $categoryUpdates = $categoryInserts +
$categoryDeletes;
201 $this->invalidateCategories( $categoryUpdates );
202 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
205 $existing = $this->getExistingProperties();
207 $propertiesDeletes = $this->getPropertyDeletions( $existing );
209 $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
210 $this->getPropertyInsertions( $existing ) );
212 # Invalidate the necessary pages
213 $changed = $propertiesDeletes +
array_diff_assoc( $this->mProperties
, $existing );
214 $this->invalidateProperties( $changed );
216 # Update the links table freshness for this title
217 $this->updateLinksTimestamp();
219 # Refresh links of all pages including this page
220 # This will be in a separate transaction
221 if ( $this->mRecursive
) {
222 $this->queueRecursiveJobs();
228 * Queue recursive jobs for this page
230 * Which means do LinksUpdate on all pages that include the current page,
231 * using the job queue.
233 protected function queueRecursiveJobs() {
234 self
::queueRecursiveJobsForTable( $this->mTitle
, 'templatelinks' );
235 if ( $this->mTitle
->getNamespace() == NS_FILE
) {
236 // Process imagelinks in case the title is or was a redirect
237 self
::queueRecursiveJobsForTable( $this->mTitle
, 'imagelinks' );
240 $bc = $this->mTitle
->getBacklinkCache();
241 // Get jobs for cascade-protected backlinks for a high priority queue.
242 // If meta-templates change to using a new template, the new template
243 // should be implicitly protected as soon as possible, if applicable.
244 // These jobs duplicate a subset of the above ones, but can run sooner.
245 // Which ever runs first generally no-ops the other one.
247 foreach ( $bc->getCascadeProtectedLinks() as $title ) {
248 $jobs[] = RefreshLinksJob
::newPrioritized( $title, array() );
250 JobQueueGroup
::singleton()->push( $jobs );
254 * Queue a RefreshLinks job for any table.
256 * @param Title $title Title to do job for
257 * @param string $table Table to use (e.g. 'templatelinks')
259 public static function queueRecursiveJobsForTable( Title
$title, $table ) {
260 if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
261 $job = new RefreshLinksJob(
266 ) + Job
::newRootJobParams( // "overall" refresh links job info
267 "refreshlinks:{$table}:{$title->getPrefixedText()}"
271 JobQueueGroup
::singleton()->push( $job );
278 function invalidateCategories( $cats ) {
279 $this->invalidatePages( NS_CATEGORY
, array_keys( $cats ) );
283 * Update all the appropriate counts in the category table.
284 * @param array $added Associative array of category name => sort key
285 * @param array $deleted Associative array of category name => sort key
287 function updateCategoryCounts( $added, $deleted ) {
288 $a = WikiPage
::factory( $this->mTitle
);
289 $a->updateCategoryCounts(
290 array_keys( $added ), array_keys( $deleted )
295 * @param array $images
297 function invalidateImageDescriptions( $images ) {
298 $this->invalidatePages( NS_FILE
, array_keys( $images ) );
302 * Update a table by doing a delete query then an insert query
303 * @param string $table Table name
304 * @param string $prefix Field name prefix
305 * @param array $deletions
306 * @param array $insertions Rows to insert
308 function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
309 if ( $table == 'page_props' ) {
310 $fromField = 'pp_page';
312 $fromField = "{$prefix}_from";
314 $where = array( $fromField => $this->mId
);
315 if ( $table == 'pagelinks' ||
$table == 'templatelinks' ||
$table == 'iwlinks' ) {
316 if ( $table == 'iwlinks' ) {
317 $baseKey = 'iwl_prefix';
319 $baseKey = "{$prefix}_namespace";
321 $clause = $this->mDb
->makeWhereFrom2d( $deletions, $baseKey, "{$prefix}_title" );
328 if ( $table == 'langlinks' ) {
329 $toField = 'll_lang';
330 } elseif ( $table == 'page_props' ) {
331 $toField = 'pp_propname';
333 $toField = $prefix . '_to';
335 if ( count( $deletions ) ) {
336 $where[$toField] = array_keys( $deletions );
342 $this->mDb
->delete( $table, $where, __METHOD__
);
344 if ( count( $insertions ) ) {
345 $this->mDb
->insert( $table, $insertions, __METHOD__
, 'IGNORE' );
346 Hooks
::run( 'LinksUpdateAfterInsert', array( $this, $table, $insertions ) );
351 * Get an array of pagelinks insertions for passing to the DB
352 * Skips the titles specified by the 2-D array $existing
353 * @param array $existing
356 private function getLinkInsertions( $existing = array() ) {
358 foreach ( $this->mLinks
as $ns => $dbkeys ) {
359 $diffs = isset( $existing[$ns] )
360 ?
array_diff_key( $dbkeys, $existing[$ns] )
362 foreach ( $diffs as $dbk => $id ) {
364 'pl_from' => $this->mId
,
365 'pl_from_namespace' => $this->mTitle
->getNamespace(),
366 'pl_namespace' => $ns,
376 * Get an array of template insertions. Like getLinkInsertions()
377 * @param array $existing
380 private function getTemplateInsertions( $existing = array() ) {
382 foreach ( $this->mTemplates
as $ns => $dbkeys ) {
383 $diffs = isset( $existing[$ns] ) ?
array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
384 foreach ( $diffs as $dbk => $id ) {
386 'tl_from' => $this->mId
,
387 'tl_from_namespace' => $this->mTitle
->getNamespace(),
388 'tl_namespace' => $ns,
398 * Get an array of image insertions
399 * Skips the names specified in $existing
400 * @param array $existing
403 private function getImageInsertions( $existing = array() ) {
405 $diffs = array_diff_key( $this->mImages
, $existing );
406 foreach ( $diffs as $iname => $dummy ) {
408 'il_from' => $this->mId
,
409 'il_from_namespace' => $this->mTitle
->getNamespace(),
418 * Get an array of externallinks insertions. Skips the names specified in $existing
419 * @param array $existing
422 private function getExternalInsertions( $existing = array() ) {
424 $diffs = array_diff_key( $this->mExternals
, $existing );
425 foreach ( $diffs as $url => $dummy ) {
426 foreach ( wfMakeUrlIndexes( $url ) as $index ) {
428 'el_id' => $this->mDb
->nextSequenceValue( 'externallinks_el_id_seq' ),
429 'el_from' => $this->mId
,
431 'el_index' => $index,
440 * Get an array of category insertions
442 * @param array $existing Mapping existing category names to sort keys. If both
443 * match a link in $this, the link will be omitted from the output
447 private function getCategoryInsertions( $existing = array() ) {
448 global $wgContLang, $wgCategoryCollation;
449 $diffs = array_diff_assoc( $this->mCategories
, $existing );
451 foreach ( $diffs as $name => $prefix ) {
452 $nt = Title
::makeTitleSafe( NS_CATEGORY
, $name );
453 $wgContLang->findVariantLink( $name, $nt, true );
455 if ( $this->mTitle
->getNamespace() == NS_CATEGORY
) {
457 } elseif ( $this->mTitle
->getNamespace() == NS_FILE
) {
463 # Treat custom sortkeys as a prefix, so that if multiple
464 # things are forced to sort as '*' or something, they'll
465 # sort properly in the category rather than in page_id
467 $sortkey = Collation
::singleton()->getSortKey(
468 $this->mTitle
->getCategorySortkey( $prefix ) );
471 'cl_from' => $this->mId
,
473 'cl_sortkey' => $sortkey,
474 'cl_timestamp' => $this->mDb
->timestamp(),
475 'cl_sortkey_prefix' => $prefix,
476 'cl_collation' => $wgCategoryCollation,
485 * Get an array of interlanguage link insertions
487 * @param array $existing Mapping existing language codes to titles
491 private function getInterlangInsertions( $existing = array() ) {
492 $diffs = array_diff_assoc( $this->mInterlangs
, $existing );
494 foreach ( $diffs as $lang => $title ) {
496 'll_from' => $this->mId
,
506 * Get an array of page property insertions
507 * @param array $existing
510 function getPropertyInsertions( $existing = array() ) {
511 $diffs = array_diff_assoc( $this->mProperties
, $existing );
514 foreach ( array_keys( $diffs ) as $name ) {
515 $arr[] = $this->getPagePropRowData( $name );
522 * Returns an associative array to be used for inserting a row into
523 * the page_props table. Besides the given property name, this will
524 * include the page id from $this->mId and any property value from
525 * $this->mProperties.
527 * The array returned will include the pp_sortkey field if this
528 * is present in the database (as indicated by $wgPagePropsHaveSortkey).
529 * The sortkey value is currently determined by getPropertySortKeyValue().
531 * @note this assumes that $this->mProperties[$prop] is defined.
533 * @param string $prop The name of the property.
537 private function getPagePropRowData( $prop ) {
538 global $wgPagePropsHaveSortkey;
540 $value = $this->mProperties
[$prop];
543 'pp_page' => $this->mId
,
544 'pp_propname' => $prop,
545 'pp_value' => $value,
548 if ( $wgPagePropsHaveSortkey ) {
549 $row['pp_sortkey'] = $this->getPropertySortKeyValue( $value );
556 * Determines the sort key for the given property value.
557 * This will return $value if it is a float or int,
558 * 1 or resp. 0 if it is a bool, and null otherwise.
560 * @note In the future, we may allow the sortkey to be specified explicitly
561 * in ParserOutput::setProperty.
563 * @param mixed $value
567 private function getPropertySortKeyValue( $value ) {
568 if ( is_int( $value ) ||
is_float( $value ) ||
is_bool( $value ) ) {
569 return floatval( $value );
576 * Get an array of interwiki insertions for passing to the DB
577 * Skips the titles specified by the 2-D array $existing
578 * @param array $existing
581 private function getInterwikiInsertions( $existing = array() ) {
583 foreach ( $this->mInterwikis
as $prefix => $dbkeys ) {
584 $diffs = isset( $existing[$prefix] )
585 ?
array_diff_key( $dbkeys, $existing[$prefix] )
588 foreach ( $diffs as $dbk => $id ) {
590 'iwl_from' => $this->mId
,
591 'iwl_prefix' => $prefix,
601 * Given an array of existing links, returns those links which are not in $this
602 * and thus should be deleted.
603 * @param array $existing
606 private function getLinkDeletions( $existing ) {
608 foreach ( $existing as $ns => $dbkeys ) {
609 if ( isset( $this->mLinks
[$ns] ) ) {
610 $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks
[$ns] );
612 $del[$ns] = $existing[$ns];
620 * Given an array of existing templates, returns those templates which are not in $this
621 * and thus should be deleted.
622 * @param array $existing
625 private function getTemplateDeletions( $existing ) {
627 foreach ( $existing as $ns => $dbkeys ) {
628 if ( isset( $this->mTemplates
[$ns] ) ) {
629 $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates
[$ns] );
631 $del[$ns] = $existing[$ns];
639 * Given an array of existing images, returns those images which are not in $this
640 * and thus should be deleted.
641 * @param array $existing
644 private function getImageDeletions( $existing ) {
645 return array_diff_key( $existing, $this->mImages
);
649 * Given an array of existing external links, returns those links which are not
650 * in $this and thus should be deleted.
651 * @param array $existing
654 private function getExternalDeletions( $existing ) {
655 return array_diff_key( $existing, $this->mExternals
);
659 * Given an array of existing categories, returns those categories which are not in $this
660 * and thus should be deleted.
661 * @param array $existing
664 private function getCategoryDeletions( $existing ) {
665 return array_diff_assoc( $existing, $this->mCategories
);
669 * Given an array of existing interlanguage links, returns those links which are not
670 * in $this and thus should be deleted.
671 * @param array $existing
674 private function getInterlangDeletions( $existing ) {
675 return array_diff_assoc( $existing, $this->mInterlangs
);
679 * Get array of properties which should be deleted.
680 * @param array $existing
683 function getPropertyDeletions( $existing ) {
684 return array_diff_assoc( $existing, $this->mProperties
);
688 * Given an array of existing interwiki links, returns those links which are not in $this
689 * and thus should be deleted.
690 * @param array $existing
693 private function getInterwikiDeletions( $existing ) {
695 foreach ( $existing as $prefix => $dbkeys ) {
696 if ( isset( $this->mInterwikis
[$prefix] ) ) {
697 $del[$prefix] = array_diff_key( $existing[$prefix], $this->mInterwikis
[$prefix] );
699 $del[$prefix] = $existing[$prefix];
707 * Get an array of existing links, as a 2-D array
711 private function getExistingLinks() {
712 $res = $this->mDb
->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
713 array( 'pl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
715 foreach ( $res as $row ) {
716 if ( !isset( $arr[$row->pl_namespace
] ) ) {
717 $arr[$row->pl_namespace
] = array();
719 $arr[$row->pl_namespace
][$row->pl_title
] = 1;
726 * Get an array of existing templates, as a 2-D array
730 private function getExistingTemplates() {
731 $res = $this->mDb
->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
732 array( 'tl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
734 foreach ( $res as $row ) {
735 if ( !isset( $arr[$row->tl_namespace
] ) ) {
736 $arr[$row->tl_namespace
] = array();
738 $arr[$row->tl_namespace
][$row->tl_title
] = 1;
745 * Get an array of existing images, image names in the keys
749 private function getExistingImages() {
750 $res = $this->mDb
->select( 'imagelinks', array( 'il_to' ),
751 array( 'il_from' => $this->mId
), __METHOD__
, $this->mOptions
);
753 foreach ( $res as $row ) {
754 $arr[$row->il_to
] = 1;
761 * Get an array of existing external links, URLs in the keys
765 private function getExistingExternals() {
766 $res = $this->mDb
->select( 'externallinks', array( 'el_to' ),
767 array( 'el_from' => $this->mId
), __METHOD__
, $this->mOptions
);
769 foreach ( $res as $row ) {
770 $arr[$row->el_to
] = 1;
777 * Get an array of existing categories, with the name in the key and sort key in the value.
781 private function getExistingCategories() {
782 $res = $this->mDb
->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
783 array( 'cl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
785 foreach ( $res as $row ) {
786 $arr[$row->cl_to
] = $row->cl_sortkey_prefix
;
793 * Get an array of existing interlanguage links, with the language code in the key and the
794 * title in the value.
798 private function getExistingInterlangs() {
799 $res = $this->mDb
->select( 'langlinks', array( 'll_lang', 'll_title' ),
800 array( 'll_from' => $this->mId
), __METHOD__
, $this->mOptions
);
802 foreach ( $res as $row ) {
803 $arr[$row->ll_lang
] = $row->ll_title
;
810 * Get an array of existing inline interwiki links, as a 2-D array
811 * @return array (prefix => array(dbkey => 1))
813 protected function getExistingInterwikis() {
814 $res = $this->mDb
->select( 'iwlinks', array( 'iwl_prefix', 'iwl_title' ),
815 array( 'iwl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
817 foreach ( $res as $row ) {
818 if ( !isset( $arr[$row->iwl_prefix
] ) ) {
819 $arr[$row->iwl_prefix
] = array();
821 $arr[$row->iwl_prefix
][$row->iwl_title
] = 1;
828 * Get an array of existing categories, with the name in the key and sort key in the value.
830 * @return array Array of property names and values
832 private function getExistingProperties() {
833 $res = $this->mDb
->select( 'page_props', array( 'pp_propname', 'pp_value' ),
834 array( 'pp_page' => $this->mId
), __METHOD__
, $this->mOptions
);
836 foreach ( $res as $row ) {
837 $arr[$row->pp_propname
] = $row->pp_value
;
844 * Return the title object of the page being updated
847 public function getTitle() {
848 return $this->mTitle
;
852 * Returns parser output
854 * @return ParserOutput
856 public function getParserOutput() {
857 return $this->mParserOutput
;
861 * Return the list of images used as generated by the parser
864 public function getImages() {
865 return $this->mImages
;
869 * Set the revision corresponding to this LinksUpdate
873 * @param Revision $revision
875 public function setRevision( Revision
$revision ) {
876 $this->mRevision
= $revision;
880 * Set the User who triggered this LinksUpdate
885 public function setTriggeringUser( User
$user ) {
893 public function getTriggeringUser() {
898 * Invalidate any necessary link lists related to page property changes
899 * @param array $changed
901 private function invalidateProperties( $changed ) {
902 global $wgPagePropLinkInvalidations;
904 foreach ( $changed as $name => $value ) {
905 if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
906 $inv = $wgPagePropLinkInvalidations[$name];
907 if ( !is_array( $inv ) ) {
908 $inv = array( $inv );
910 foreach ( $inv as $table ) {
911 DeferredUpdates
::addUpdate( new HTMLCacheUpdate( $this->mTitle
, $table ) );
918 * Fetch page links added by this LinksUpdate. Only available after the update is complete.
920 * @return null|array Array of Titles
922 public function getAddedLinks() {
923 if ( $this->linkInsertions
=== null ) {
927 foreach ( $this->linkInsertions
as $insertion ) {
928 $result[] = Title
::makeTitle( $insertion['pl_namespace'], $insertion['pl_title'] );
935 * Fetch page links removed by this LinksUpdate. Only available after the update is complete.
937 * @return null|array Array of Titles
939 public function getRemovedLinks() {
940 if ( $this->linkDeletions
=== null ) {
944 foreach ( $this->linkDeletions
as $ns => $titles ) {
945 foreach ( $titles as $title => $unused ) {
946 $result[] = Title
::makeTitle( $ns, $title );
954 * Update links table freshness
956 protected function updateLinksTimestamp() {
958 // The link updates made here only reflect the freshness of the parser output
959 $timestamp = $this->mParserOutput
->getCacheTime();
960 $this->mDb
->update( 'page',
961 array( 'page_links_updated' => $this->mDb
->timestamp( $timestamp ) ),
962 array( 'page_id' => $this->mId
),
968 public function getAsJobSpecification() {
971 'userId' => $this->user
->getId(),
972 'userName' => $this->user
->getName(),
978 if ( $this->mRevision
) {
979 $triggeringRevisionId = $this->mRevision
->getId();
981 $triggeringRevisionId = false;
985 'wiki' => $this->mDb
->getWikiID(),
986 'job' => new JobSpecification(
987 'refreshLinksPrioritized',
989 // Reuse the parser cache if it was saved
990 'rootJobTimestamp' => $this->mParserOutput
->getCacheTime(),
991 'useRecursiveLinksUpdate' => $this->mRecursive
,
992 'triggeringUser' => $userInfo,
993 'triggeringRevisionId' => $triggeringRevisionId,
995 array( 'removeDuplicates' => true ),