MediaWiki REL1_33
|
Class the manages updates of *_link tables as well as similar extension-managed tables. More...
Public Member Functions | |
__construct (Title $title, ParserOutput $parserOutput, $recursive=true) | |
doUpdate () | |
Update link tables with outgoing links from an updated article. | |
getAddedExternalLinks () | |
Fetch external links added by this LinksUpdate. | |
getAddedLinks () | |
Fetch page links added by this LinksUpdate. | |
getAddedProperties () | |
Fetch page properties added by this LinksUpdate. | |
getAsJobSpecification () | |
getImages () | |
Return the list of images used as generated by the parser. | |
getParserOutput () | |
Returns parser output. | |
getPropertyInsertions ( $existing=[]) | |
Get an array of page property insertions. | |
getRemovedExternalLinks () | |
Fetch external links removed by this LinksUpdate. | |
getRemovedLinks () | |
Fetch page links removed by this LinksUpdate. | |
getRemovedProperties () | |
Fetch page properties removed by this LinksUpdate. | |
getRevision () | |
getTitle () | |
Return the title object of the page being updated. | |
getTriggeringUser () | |
setRevision (Revision $revision) | |
Set the revision corresponding to this LinksUpdate. | |
setTriggeringUser (User $user) | |
Set the User who triggered this LinksUpdate. | |
Public Member Functions inherited from DataUpdate | |
__construct () | |
getCauseAction () | |
getCauseAgent () | |
setCause ( $action, $user) | |
setTransactionTicket ( $ticket) | |
Static Public Member Functions | |
static | acquirePageLock (IDatabase $dbw, $pageId, $why='atomicity') |
Acquire a lock for performing link table updates for a page on a DB. | |
static | queueRecursiveJobsForTable (Title $title, $table, $action='unknown', $userName='unknown') |
Queue a RefreshLinks job for any table. | |
Static Public Member Functions inherited from DataUpdate | |
static | runUpdates (array $updates) |
Convenience method, calls doUpdate() on every DataUpdate in the array. | |
Public Attributes | |
array | $mCategories |
Map of category names to sort keys. | |
array | $mExternals |
URLs of external links, array key only. | |
int | $mId |
Page ID of the article linked from. | |
array | $mImages |
DB keys of the images used, in the array key only. | |
array | $mInterlangs |
Map of language codes to titles. | |
array | $mInterwikis |
2-D map of (prefix => DBK => 1) | |
array | $mLinks |
Map of title strings to IDs for the links in the document. | |
ParserOutput | $mParserOutput |
array | $mProperties |
Map of arbitrary name to value. | |
bool | $mRecursive |
Whether to queue jobs for recursive updates. | |
array | $mTemplates |
Map of title strings to IDs for the template references, including broken ones. | |
Title | $mTitle |
Title object of the article linked from. | |
Protected Member Functions | |
doIncrementalUpdate () | |
getDB () | |
queueRecursiveJobs () | |
Queue recursive jobs for this page. | |
Private Member Functions | |
getCategoryDeletions ( $existing) | |
Given an array of existing categories, returns those categories which are not in $this and thus should be deleted. | |
getCategoryInsertions ( $existing=[]) | |
Get an array of category insertions. | |
getExistingCategories () | |
Get an array of existing categories, with the name in the key and sort key in the value. | |
getExistingExternals () | |
Get an array of existing external links, URLs in the keys. | |
getExistingImages () | |
Get an array of existing images, image names in the keys. | |
getExistingInterlangs () | |
Get an array of existing interlanguage links, with the language code in the key and the title in the value. | |
getExistingInterwikis () | |
Get an array of existing inline interwiki links, as a 2-D array. | |
getExistingLinks () | |
Get an array of existing links, as a 2-D array. | |
getExistingProperties () | |
Get an array of existing categories, with the name in the key and sort key in the value. | |
getExistingTemplates () | |
Get an array of existing templates, as a 2-D array. | |
getExternalDeletions ( $existing) | |
Given an array of existing external links, returns those links which are not in $this and thus should be deleted. | |
getExternalInsertions ( $existing=[]) | |
Get an array of externallinks insertions. | |
getImageDeletions ( $existing) | |
Given an array of existing images, returns those images which are not in $this and thus should be deleted. | |
getImageInsertions ( $existing=[]) | |
Get an array of image insertions Skips the names specified in $existing. | |
getInterlangDeletions ( $existing) | |
Given an array of existing interlanguage links, returns those links which are not in $this and thus should be deleted. | |
getInterlangInsertions ( $existing=[]) | |
Get an array of interlanguage link insertions. | |
getInterwikiDeletions ( $existing) | |
Given an array of existing interwiki links, returns those links which are not in $this and thus should be deleted. | |
getInterwikiInsertions ( $existing=[]) | |
Get an array of interwiki insertions for passing to the DB Skips the titles specified by the 2-D array $existing. | |
getLinkDeletions ( $existing) | |
Given an array of existing links, returns those links which are not in $this and thus should be deleted. | |
getLinkInsertions ( $existing=[]) | |
Get an array of pagelinks insertions for passing to the DB Skips the titles specified by the 2-D array $existing. | |
getPagePropRowData ( $prop) | |
Returns an associative array to be used for inserting a row into the page_props table. | |
getPropertyDeletions ( $existing) | |
Get array of properties which should be deleted. | |
getPropertySortKeyValue ( $value) | |
Determines the sort key for the given property value. | |
getTemplateDeletions ( $existing) | |
Given an array of existing templates, returns those templates which are not in $this and thus should be deleted. | |
getTemplateInsertions ( $existing=[]) | |
Get an array of template insertions. | |
incrTableUpdate ( $table, $prefix, $deletions, $insertions) | |
Update a table by doing a delete query then an insert query. | |
invalidateCategories ( $cats) | |
invalidateImageDescriptions (array $images) | |
invalidateProperties ( $changed) | |
Invalidate any necessary link lists related to page property changes. | |
updateCategoryCounts (array $added, array $deleted) | |
Update all the appropriate counts in the category table. | |
updateLinksTimestamp () | |
Update links table freshness. | |
Private Attributes | |
IDatabase | $db |
null array | $externalLinkDeletions = null |
Deleted external links if calculated. | |
null array | $externalLinkInsertions = null |
Added external links if calculated. | |
null array | $linkDeletions = null |
Deleted links if calculated. | |
null array | $linkInsertions = null |
Added links if calculated. | |
Revision | $mRevision |
Revision for which this update has been triggered. | |
null array | $propertyDeletions = null |
Deleted properties if calculated. | |
null array | $propertyInsertions = null |
Added properties if calculated. | |
User null | $user |
Additional Inherited Members | |
Protected Attributes inherited from DataUpdate | |
string | $causeAction = 'unknown' |
Short update cause action description. | |
string | $causeAgent = 'unknown' |
Short update cause user description. | |
mixed | $ticket |
Result from LBFactory::getEmptyTransactionTicket() | |
Class the manages updates of *_link tables as well as similar extension-managed tables.
Definition at line 35 of file LinksUpdate.php.
LinksUpdate::__construct | ( | Title | $title, |
ParserOutput | $parserOutput, | ||
$recursive = true |
|||
) |
Title | $title | Title of the page we're updating |
ParserOutput | $parserOutput | Output from a full parse of this page |
bool | $recursive | Queue jobs for recursive updates? |
MWException |
Definition at line 121 of file LinksUpdate.php.
References $link, $linksUpdate, $title, as, ParserOutput\getCategories(), ParserOutput\getExternalLinks(), ParserOutput\getImages(), ParserOutput\getInterwikiLinks(), ParserOutput\getLanguageLinks(), ParserOutput\getLinks(), ParserOutput\getProperties(), ParserOutput\getTemplates(), and list.
|
static |
Acquire a lock for performing link table updates for a page on a DB.
IDatabase | $dbw | |
int | $pageId | |
string | $why | One of (job, atomicity) |
Definition at line 214 of file LinksUpdate.php.
References Wikimedia\Rdbms\IDatabase\getScopedLockAndFlush().
|
protected |
Reimplemented in LinksDeletionUpdate.
Definition at line 229 of file LinksUpdate.php.
References getCategoryDeletions(), getCategoryInsertions(), getExistingCategories(), getExistingExternals(), getExistingImages(), getExistingInterlangs(), getExistingInterwikis(), getExistingLinks(), getExistingProperties(), getExistingTemplates(), getExternalDeletions(), getExternalInsertions(), getImageDeletions(), getImageInsertions(), getInterlangDeletions(), getInterlangInsertions(), getInterwikiDeletions(), getInterwikiInsertions(), getLinkDeletions(), getLinkInsertions(), getPropertyDeletions(), getPropertyInsertions(), getTemplateDeletions(), getTemplateInsertions(), incrTableUpdate(), invalidateCategories(), invalidateImageDescriptions(), invalidateProperties(), queueRecursiveJobs(), updateCategoryCounts(), and updateLinksTimestamp().
Referenced by doUpdate().
LinksUpdate::doUpdate | ( | ) |
Update link tables with outgoing links from an updated article.
Implements DeferrableUpdate.
Definition at line 176 of file LinksUpdate.php.
References $linksUpdate, doIncrementalUpdate(), and getDB().
LinksUpdate::getAddedExternalLinks | ( | ) |
Fetch external links added by this LinksUpdate.
Only available after the update is complete.
Definition at line 1125 of file LinksUpdate.php.
LinksUpdate::getAddedLinks | ( | ) |
Fetch page links added by this LinksUpdate.
Only available after the update is complete.
Definition at line 1088 of file LinksUpdate.php.
References as.
LinksUpdate::getAddedProperties | ( | ) |
Fetch page properties added by this LinksUpdate.
Only available after the update is complete.
Definition at line 1155 of file LinksUpdate.php.
LinksUpdate::getAsJobSpecification | ( | ) |
Implements EnqueueableDataUpdate.
Reimplemented in LinksDeletionUpdate.
Definition at line 1195 of file LinksUpdate.php.
|
private |
Given an array of existing categories, returns those categories which are not in $this and thus should be deleted.
array | $existing |
Definition at line 820 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
|
private |
Get an array of category insertions.
array | $existing | Mapping existing category names to sort keys. If both match a link in $this, the link will be omitted from the output |
Definition at line 608 of file LinksUpdate.php.
References $name, $type, $wgCategoryCollation, as, getDB(), NS_CATEGORY, and Collation\singleton().
Referenced by doIncrementalUpdate().
|
protected |
Definition at line 1187 of file LinksUpdate.php.
References DB_MASTER, and wfGetDB().
Referenced by LinksDeletionUpdate\doIncrementalUpdate(), doUpdate(), LinksDeletionUpdate\getAsJobSpecification(), getAsJobSpecification(), getCategoryInsertions(), getExistingCategories(), getExistingExternals(), getExistingImages(), getExistingInterlangs(), getExistingInterwikis(), getExistingLinks(), getExistingProperties(), getExistingTemplates(), incrTableUpdate(), invalidateCategories(), invalidateImageDescriptions(), updateCategoryCounts(), and updateLinksTimestamp().
|
private |
Get an array of existing categories, with the name in the key and sort key in the value.
Definition at line 937 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Get an array of existing external links, URLs in the keys.
Definition at line 921 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Get an array of existing images, image names in the keys.
Definition at line 905 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Get an array of existing interlanguage links, with the language code in the key and the title in the value.
Definition at line 954 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Get an array of existing inline interwiki links, as a 2-D array.
Definition at line 969 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Get an array of existing links, as a 2-D array.
Definition at line 867 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Get an array of existing categories, with the name in the key and sort key in the value.
Definition at line 988 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Get an array of existing templates, as a 2-D array.
Definition at line 886 of file LinksUpdate.php.
References $res, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Given an array of existing external links, returns those links which are not in $this and thus should be deleted.
array | $existing |
Definition at line 810 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
|
private |
Get an array of externallinks insertions.
Skips the names specified in $existing
array | $existing |
Definition at line 583 of file LinksUpdate.php.
References as, and LinkFilter\makeIndexes().
Referenced by doIncrementalUpdate().
|
private |
Given an array of existing images, returns those images which are not in $this and thus should be deleted.
array | $existing |
Definition at line 800 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
|
private |
Get an array of image insertions Skips the names specified in $existing.
array | $existing |
Definition at line 564 of file LinksUpdate.php.
References as.
Referenced by doIncrementalUpdate().
LinksUpdate::getImages | ( | ) |
Return the list of images used as generated by the parser.
Definition at line 1020 of file LinksUpdate.php.
|
private |
Given an array of existing interlanguage links, returns those links which are not in $this and thus should be deleted.
array | $existing |
Definition at line 830 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
|
private |
Get an array of interlanguage link insertions.
array | $existing | Mapping existing language codes to titles |
Definition at line 647 of file LinksUpdate.php.
References $lang, $title, and as.
Referenced by doIncrementalUpdate().
|
private |
Given an array of existing interwiki links, returns those links which are not in $this and thus should be deleted.
array | $existing |
Definition at line 849 of file LinksUpdate.php.
References as.
Referenced by doIncrementalUpdate().
|
private |
Get an array of interwiki insertions for passing to the DB Skips the titles specified by the 2-D array $existing.
array | $existing |
Definition at line 737 of file LinksUpdate.php.
References as.
Referenced by doIncrementalUpdate().
|
private |
Given an array of existing links, returns those links which are not in $this and thus should be deleted.
array | $existing |
Definition at line 762 of file LinksUpdate.php.
References as.
Referenced by doIncrementalUpdate().
|
private |
Get an array of pagelinks insertions for passing to the DB Skips the titles specified by the 2-D array $existing.
array | $existing |
Definition at line 517 of file LinksUpdate.php.
References as.
Referenced by doIncrementalUpdate().
|
private |
Returns an associative array to be used for inserting a row into the page_props table.
Besides the given property name, this will include the page id from $this->mId and any property value from $this->mProperties.
The array returned will include the pp_sortkey field if this is present in the database (as indicated by $wgPagePropsHaveSortkey). The sortkey value is currently determined by getPropertySortKeyValue().
string | $prop | The name of the property. |
Definition at line 693 of file LinksUpdate.php.
References $value, $wgPagePropsHaveSortkey, and getPropertySortKeyValue().
Referenced by getPropertyInsertions().
LinksUpdate::getParserOutput | ( | ) |
Returns parser output.
Definition at line 1012 of file LinksUpdate.php.
|
private |
Get array of properties which should be deleted.
array | $existing |
Definition at line 839 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getPropertyInsertions | ( | $existing = [] | ) |
Get an array of page property insertions.
array | $existing |
Definition at line 666 of file LinksUpdate.php.
References $name, as, and getPagePropRowData().
Referenced by doIncrementalUpdate().
|
private |
Determines the sort key for the given property value.
This will return $value if it is a float or int, 1 or resp. 0 if it is a bool, and null otherwise.
mixed | $value |
Definition at line 723 of file LinksUpdate.php.
References $value.
Referenced by getPagePropRowData().
LinksUpdate::getRemovedExternalLinks | ( | ) |
Fetch external links removed by this LinksUpdate.
Only available after the update is complete.
Definition at line 1142 of file LinksUpdate.php.
LinksUpdate::getRemovedLinks | ( | ) |
Fetch page links removed by this LinksUpdate.
Only available after the update is complete.
Definition at line 1105 of file LinksUpdate.php.
LinksUpdate::getRemovedProperties | ( | ) |
Fetch page properties removed by this LinksUpdate.
Only available after the update is complete.
Definition at line 1165 of file LinksUpdate.php.
LinksUpdate::getRevision | ( | ) |
|
private |
Given an array of existing templates, returns those templates which are not in $this and thus should be deleted.
array | $existing |
Definition at line 781 of file LinksUpdate.php.
References as.
Referenced by doIncrementalUpdate().
|
private |
Get an array of template insertions.
Like getLinkInsertions()
array | $existing |
Definition at line 541 of file LinksUpdate.php.
References as.
Referenced by doIncrementalUpdate().
LinksUpdate::getTitle | ( | ) |
Return the title object of the page being updated.
Definition at line 1003 of file LinksUpdate.php.
LinksUpdate::getTriggeringUser | ( | ) |
|
private |
Update a table by doing a delete query then an insert query.
string | $table | Table name |
string | $prefix | Field name prefix |
array | $deletions | |
array | $insertions | Rows to insert |
Definition at line 436 of file LinksUpdate.php.
References $services, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
array | $cats |
Definition at line 387 of file LinksUpdate.php.
References getDB(), PurgeJobUtils\invalidatePages(), and NS_CATEGORY.
Referenced by doIncrementalUpdate().
|
private |
array | $images |
Definition at line 425 of file LinksUpdate.php.
References getDB(), PurgeJobUtils\invalidatePages(), and NS_FILE.
Referenced by doIncrementalUpdate().
|
private |
Invalidate any necessary link lists related to page property changes.
array | $changed |
Definition at line 1065 of file LinksUpdate.php.
References $name, $value, $wgPagePropLinkInvalidations, and as.
Referenced by doIncrementalUpdate().
|
protected |
Queue recursive jobs for this page.
Which means do LinksUpdate on all pages that include the current page, using the job queue.
Definition at line 329 of file LinksUpdate.php.
References $title, as, DataUpdate\getCauseAction(), DataUpdate\getCauseAgent(), RefreshLinksJob\newPrioritized(), and NS_FILE.
Referenced by doIncrementalUpdate().
|
static |
Queue a RefreshLinks job for any table.
Title | $title | Title to do job for |
string | $table | Table to use (e.g. 'templatelinks') |
string | $action | Triggering action |
string | $userName | Triggering user name |
Definition at line 366 of file LinksUpdate.php.
References $job, $title, and Job\newRootJobParams().
LinksUpdate::setRevision | ( | Revision | $revision | ) |
Set the revision corresponding to this LinksUpdate.
Revision | $revision |
Definition at line 1031 of file LinksUpdate.php.
LinksUpdate::setTriggeringUser | ( | User | $user | ) |
Set the User who triggered this LinksUpdate.
User | $user |
Definition at line 1049 of file LinksUpdate.php.
Update all the appropriate counts in the category table.
array | $added | Associative array of category name => sort key |
array | $deleted | Associative array of category name => sort key |
Definition at line 396 of file LinksUpdate.php.
References $wgUpdateRowsPerQuery, as, and getDB().
Referenced by doIncrementalUpdate().
|
private |
Update links table freshness.
Definition at line 1172 of file LinksUpdate.php.
References getDB().
Referenced by doIncrementalUpdate().
|
private |
Definition at line 113 of file LinksUpdate.php.
Deleted external links if calculated.
Definition at line 95 of file LinksUpdate.php.
Added external links if calculated.
Definition at line 90 of file LinksUpdate.php.
Deleted links if calculated.
Definition at line 85 of file LinksUpdate.php.
Added links if calculated.
Definition at line 80 of file LinksUpdate.php.
array LinksUpdate::$mCategories |
Map of category names to sort keys.
Definition at line 60 of file LinksUpdate.php.
array LinksUpdate::$mExternals |
URLs of external links, array key only.
Definition at line 57 of file LinksUpdate.php.
int LinksUpdate::$mId |
Page ID of the article linked from.
Definition at line 39 of file LinksUpdate.php.
array LinksUpdate::$mImages |
DB keys of the images used, in the array key only.
Definition at line 51 of file LinksUpdate.php.
array LinksUpdate::$mInterlangs |
Map of language codes to titles.
Definition at line 63 of file LinksUpdate.php.
array LinksUpdate::$mInterwikis |
2-D map of (prefix => DBK => 1)
Definition at line 66 of file LinksUpdate.php.
array LinksUpdate::$mLinks |
Map of title strings to IDs for the links in the document.
Definition at line 48 of file LinksUpdate.php.
ParserOutput LinksUpdate::$mParserOutput |
Definition at line 45 of file LinksUpdate.php.
array LinksUpdate::$mProperties |
Map of arbitrary name to value.
Definition at line 69 of file LinksUpdate.php.
bool LinksUpdate::$mRecursive |
Whether to queue jobs for recursive updates.
Definition at line 72 of file LinksUpdate.php.
|
private |
Revision for which this update has been triggered.
Definition at line 75 of file LinksUpdate.php.
array LinksUpdate::$mTemplates |
Map of title strings to IDs for the template references, including broken ones.
Definition at line 54 of file LinksUpdate.php.
Title LinksUpdate::$mTitle |
Title object of the article linked from.
Definition at line 42 of file LinksUpdate.php.
Deleted properties if calculated.
Definition at line 105 of file LinksUpdate.php.
Added properties if calculated.
Definition at line 100 of file LinksUpdate.php.
Definition at line 110 of file LinksUpdate.php.