Podręcznik:RefreshLinksJob.php

From mediawiki.org
This page is a translated version of the page Manual:RefreshLinksJob.php and the translation is 25% complete.

The RefreshLinksJob.php file contains the RefreshLinksJob class for jobs to update links for a given title. These jobs use the class LinksUpdate to update several database tables.

Variants

The refreshLink jobs come in three different variants:

  1. Recursive jobs to update links for backlink pages for a given title. They are scheduled by LinksUpdate::queueRecursiveJobsForTable() and used to refresh pages which link / transclude a given title. These jobs have (recursive:true,table:<table>) set. They just look up which pages link to the job title and schedule them as a set of non-recursive RefreshLinksJob jobs (and possibly, one new recursive job as a way of continuation).
  2. Jobs to update links for a set of pages (the job title is ignored). These jobs have (pages:(<page ID>:(<namespace>,<title>),...) set.
  3. Jobs to update links for a single page (the job title). These jobs need no extra fields set.

Parameters

Job parameters for all jobs

  • recursive (bool): When false, updates the current page. When true, updates the pages which link/transclude the current page.
  • triggeringRevisionId (int): The revision of the edit which caused the link refresh. For manually triggered updates, the last revision of the page (at the time of scheduling).
  • triggeringUser (array): The user who triggered the refresh, in the form of a [ 'userId' => int, 'userName' => string ] array. This is not necessarily the user who created the revision.
  • triggeredRecursive (bool): Set on all jobs which were partitioned from another, recursive job. Intended for debugging.

Standard deduplication params

See also JobQueue::deduplicateRootJob() .

For recursive jobs :

  • table (string): Which table to use (imagelinks or templatelinks) when searching for affected pages.
  • range (array): Used for recursive jobs when some pages have already been partitioned into separate jobs. Contains the list of ranges that still need to be partitioned. See BacklinkJobUtils::partitionBacklinkJob() .
  • division: Number of times the job was partitioned already (for debugging).

For non-recursive jobs :

  • pages (array): Associative array of [ <page ID> => [ <namespace>, <dbkey> ] ]. Might be omitted, then the job title will be used.
  • isOpportunistic (bool): Set for opportunistic single-page updates. These are "free" updates that are queued when most of the work needed to be performed anyway for non-linkrefresh-related reasons, and can be more easily discarded if they don't seem useful. See WikiPage::triggerOpportunisticLinksUpdate() .
  • useRecursiveLinksUpdate (bool): When true, triggers recursive jobs for each page.

Metrics

  • refreshlinks_warning.<warning> : a recoverable issue. The job will continue as normal.
  • refreshlinks_outcome.<reason> : if the job ends with an unusual outcome, it will increment this exactly once.
    • The reason starts with bad_ : a failure is logged and the job may be retried later.
    • The reason starts with good_ : the job was cancelled and considered a success, i.e. it was superseded.

Public methods

  • newPrioritized()
  • newDynamic()
  • run()
  • getDeduplicationInfo()
  • workItemCount()

See also