Public Member Functions | |
LinksUpdate ($title, $parserOutput, $recursive=true) | |
Constructor. | |
doUpdate () | |
Update link tables with outgoing links from an updated article. | |
queueRecursiveJobs () | |
invalidatePages ($namespace, $dbkeys) | |
Invalidate the cache of a list of pages from a single namespace. | |
invalidateCategories ($cats) | |
updateCategoryCounts ($added, $deleted) | |
Update all the appropriate counts in the category table. | |
invalidateImageDescriptions ($images) | |
dumbTableUpdate ($table, $insertions, $fromField) | |
makeWhereFrom2d (&$arr, $prefix) | |
Make a WHERE clause from a 2-d NS/dbkey array. | |
getPropertyInsertions ($existing=array()) | |
Get an array of page property insertions. | |
getTitle () | |
Return the title object of the page being updated. | |
invalidateProperties ($changed) | |
Invalidate any necessary link lists related to page property changes. | |
Public Attributes | |
$mId | |
Page ID of the article linked from. | |
$mTitle | |
Title object of the article linked from. | |
$mLinks | |
Map of title strings to IDs for the links in the document. | |
$mImages | |
DB keys of the images used, in the array key only. | |
$mTemplates | |
Map of title strings to IDs for the template references, including broken ones. | |
$mExternals | |
URLs of external links, array key only. | |
$mCategories | |
Map of category names to sort keys. | |
$mInterlangs | |
Map of language codes to titles. | |
$mProperties | |
Map of arbitrary name to value. | |
$mDb | |
Database connection reference. | |
$mOptions | |
SELECT options to be used (array). | |
$mRecursive | |
Whether to queue jobs for recursive updates. | |
Protected Member Functions | |
doIncrementalUpdate () | |
doDumbUpdate () | |
Link update which clears the previous entries and inserts new ones May be slower or faster depending on level of lock contention and write speed of DB Also useful where link table corruption needs to be repaired, e.g. | |
Private Member Functions | |
incrTableUpdate ($table, $prefix, $deletions, $insertions) | |
Update a table by doing a delete query then an insert query. | |
getLinkInsertions ($existing=array()) | |
Get an array of pagelinks insertions for passing to the DB Skips the titles specified by the 2-D array $existing. | |
getTemplateInsertions ($existing=array()) | |
Get an array of template insertions. | |
getImageInsertions ($existing=array()) | |
Get an array of image insertions Skips the names specified in $existing. | |
getExternalInsertions ($existing=array()) | |
Get an array of externallinks insertions. | |
getCategoryInsertions ($existing=array()) | |
Get an array of category insertions. | |
getInterlangInsertions ($existing=array()) | |
Get an array of interlanguage link insertions. | |
getLinkDeletions ($existing) | |
Given an array of existing links, returns those links which are not in $this and thus should be deleted. | |
getTemplateDeletions ($existing) | |
Given an array of existing templates, returns those templates which are not in $this and thus should be deleted. | |
getImageDeletions ($existing) | |
Given an array of existing images, returns those images which are not in $this and thus should be deleted. | |
getExternalDeletions ($existing) | |
Given an array of existing external links, returns those links which are not in $this and thus should be deleted. | |
getCategoryDeletions ($existing) | |
Given an array of existing categories, returns those categories which are not in $this and thus should be deleted. | |
getInterlangDeletions ($existing) | |
Given an array of existing interlanguage links, returns those links which are not in $this and thus should be deleted. | |
getPropertyDeletions ($existing) | |
Get array of properties which should be deleted. | |
getExistingLinks () | |
Get an array of existing links, as a 2-D array. | |
getExistingTemplates () | |
Get an array of existing templates, as a 2-D array. | |
getExistingImages () | |
Get an array of existing images, image names in the keys. | |
getExistingExternals () | |
Get an array of existing external links, URLs in the keys. | |
getExistingCategories () | |
Get an array of existing categories, with the name in the key and sort key in the value. | |
getExistingInterlangs () | |
Get an array of existing interlanguage links, with the language code in the key and the title in the value. | |
getExistingProperties () | |
Get an array of existing categories, with the name in the key and sort key in the value. |
Definition at line 7 of file LinksUpdate.php.
LinksUpdate::doDumbUpdate | ( | ) | [protected] |
Link update which clears the previous entries and inserts new ones May be slower or faster depending on level of lock contention and write speed of DB Also useful where link table corruption needs to be repaired, e.g.
Definition at line 161 of file LinksUpdate.php.
References dumbTableUpdate(), getCategoryInsertions(), getExistingCategories(), getExistingImages(), getExternalInsertions(), getImageInsertions(), getInterlangInsertions(), getLinkInsertions(), getPropertyInsertions(), getTemplateInsertions(), invalidateCategories(), invalidateImageDescriptions(), queueRecursiveJobs(), updateCategoryCounts(), wfProfileIn(), and wfProfileOut().
Referenced by doUpdate().
LinksUpdate::doIncrementalUpdate | ( | ) | [protected] |
Definition at line 90 of file LinksUpdate.php.
References $changed, getCategoryDeletions(), getCategoryInsertions(), getExistingCategories(), getExistingExternals(), getExistingImages(), getExistingInterlangs(), getExistingLinks(), getExistingProperties(), getExistingTemplates(), getExternalDeletions(), getExternalInsertions(), getImageDeletions(), getImageInsertions(), getInterlangDeletions(), getInterlangInsertions(), getLinkDeletions(), getLinkInsertions(), getPropertyDeletions(), getPropertyInsertions(), getTemplateDeletions(), getTemplateInsertions(), incrTableUpdate(), invalidateCategories(), invalidateImageDescriptions(), invalidateProperties(), queueRecursiveJobs(), updateCategoryCounts(), wfProfileIn(), and wfProfileOut().
Referenced by doUpdate().
LinksUpdate::doUpdate | ( | ) |
Update link tables with outgoing links from an updated article.
Definition at line 78 of file LinksUpdate.php.
References $wgUseDumbLinkUpdate, doDumbUpdate(), doIncrementalUpdate(), and wfRunHooks().
LinksUpdate::dumbTableUpdate | ( | $ | table, | |
$ | insertions, | |||
$ | fromField | |||
) |
LinksUpdate::getCategoryDeletions | ( | $ | existing | ) | [private] |
Given an array of existing categories, returns those categories which are not in $this and thus should be deleted.
Definition at line 537 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getCategoryInsertions | ( | $ | existing = array() |
) | [private] |
Get an array of category insertions.
array | $existing Array 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 428 of file LinksUpdate.php.
References $name, $wgContLang, and Title::makeTitleSafe().
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getExistingCategories | ( | ) | [private] |
Get an array of existing categories, with the name in the key and sort key in the value.
Definition at line 628 of file LinksUpdate.php.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getExistingExternals | ( | ) | [private] |
Get an array of existing external links, URLs in the keys.
Definition at line 613 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getExistingImages | ( | ) | [private] |
Get an array of existing images, image names in the keys.
Definition at line 598 of file LinksUpdate.php.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getExistingInterlangs | ( | ) | [private] |
Get an array of existing interlanguage links, with the language code in the key and the title in the value.
Definition at line 644 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getExistingLinks | ( | ) | [private] |
Get an array of existing links, as a 2-D array.
Definition at line 562 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getExistingProperties | ( | ) | [private] |
Get an array of existing categories, with the name in the key and sort key in the value.
Definition at line 658 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getExistingTemplates | ( | ) | [private] |
Get an array of existing templates, as a 2-D array.
Definition at line 580 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getExternalDeletions | ( | $ | existing | ) | [private] |
Given an array of existing external links, returns those links which are not in $this and thus should be deleted.
Definition at line 528 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getExternalInsertions | ( | $ | existing = array() |
) | [private] |
Get an array of externallinks insertions.
Skips the names specified in $existing
Definition at line 409 of file LinksUpdate.php.
References $url, and wfMakeUrlIndex().
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getImageDeletions | ( | $ | existing | ) | [private] |
Given an array of existing images, returns those images which are not in $this and thus should be deleted.
Definition at line 519 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getImageInsertions | ( | $ | existing = array() |
) | [private] |
Get an array of image insertions Skips the names specified in $existing.
Definition at line 393 of file LinksUpdate.php.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getInterlangDeletions | ( | $ | existing | ) | [private] |
Given an array of existing interlanguage links, returns those links which are not in $this and thus should be deleted.
Definition at line 546 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getInterlangInsertions | ( | $ | existing = array() |
) | [private] |
Get an array of interlanguage link insertions.
array | $existing Array mapping existing language codes to titles |
Definition at line 450 of file LinksUpdate.php.
References $title.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getLinkDeletions | ( | $ | existing | ) | [private] |
Given an array of existing links, returns those links which are not in $this and thus should be deleted.
Definition at line 485 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getLinkInsertions | ( | $ | existing = array() |
) | [private] |
Get an array of pagelinks insertions for passing to the DB Skips the titles specified by the 2-D array $existing.
Definition at line 352 of file LinksUpdate.php.
References $ns.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getPropertyDeletions | ( | $ | existing | ) | [private] |
Get array of properties which should be deleted.
Definition at line 554 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getPropertyInsertions | ( | $ | existing = array() |
) |
Get an array of page property insertions.
Definition at line 466 of file LinksUpdate.php.
References $name.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getTemplateDeletions | ( | $ | existing | ) | [private] |
Given an array of existing templates, returns those templates which are not in $this and thus should be deleted.
Definition at line 502 of file LinksUpdate.php.
Referenced by doIncrementalUpdate().
LinksUpdate::getTemplateInsertions | ( | $ | existing = array() |
) | [private] |
Get an array of template insertions.
Like getLinkInsertions()
Definition at line 373 of file LinksUpdate.php.
References $ns.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::getTitle | ( | ) |
LinksUpdate::incrTableUpdate | ( | $ | table, | |
$ | prefix, | |||
$ | deletions, | |||
$ | insertions | |||
) | [private] |
Update a table by doing a delete query then an insert query.
Definition at line 310 of file LinksUpdate.php.
References $prefix, and makeWhereFrom2d().
Referenced by doIncrementalUpdate().
LinksUpdate::invalidateCategories | ( | $ | cats | ) |
Definition at line 264 of file LinksUpdate.php.
References invalidatePages().
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::invalidateImageDescriptions | ( | $ | images | ) |
Definition at line 280 of file LinksUpdate.php.
References invalidatePages().
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::invalidatePages | ( | $ | namespace, | |
$ | dbkeys | |||
) |
Invalidate the cache of a list of pages from a single namespace.
integer | $namespace | |
array | $dbkeys |
Definition at line 225 of file LinksUpdate.php.
Referenced by invalidateCategories(), and invalidateImageDescriptions().
LinksUpdate::invalidateProperties | ( | $ | changed | ) |
Invalidate any necessary link lists related to page property changes.
Definition at line 680 of file LinksUpdate.php.
References $changed, $name, and $wgPagePropLinkInvalidations.
Referenced by doIncrementalUpdate().
LinksUpdate::LinksUpdate | ( | $ | title, | |
$ | parserOutput, | |||
$ | recursive = true | |||
) |
Constructor.
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? |
Definition at line 33 of file LinksUpdate.php.
References $key, $title, $wgAntiLockFlags, wfGetDB(), and wfRunHooks().
LinksUpdate::makeWhereFrom2d | ( | &$ | arr, | |
$ | prefix | |||
) |
Make a WHERE clause from a 2-d NS/dbkey array.
array | $arr 2-d array indexed by namespace and DB key | |
string | $prefix Field name prefix, without the underscore |
Definition at line 300 of file LinksUpdate.php.
Referenced by incrTableUpdate().
LinksUpdate::queueRecursiveJobs | ( | ) |
Definition at line 195 of file LinksUpdate.php.
References $batch, $end, $start, $wgUpdateRowsPerJob, Job::batchInsert(), wfProfileIn(), and wfProfileOut().
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::updateCategoryCounts | ( | $ | added, | |
$ | deleted | |||
) |
Update all the appropriate counts in the category table.
$added | associative array of category name => sort key | |
$deleted | associative array of category name => sort key |
Definition at line 273 of file LinksUpdate.php.
References $added.
Referenced by doDumbUpdate(), and doIncrementalUpdate().
LinksUpdate::$mCategories |
LinksUpdate::$mDb |
LinksUpdate::$mExternals |
LinksUpdate::$mId |
LinksUpdate::$mImages |
LinksUpdate::$mInterlangs |
LinksUpdate::$mLinks |
Map of title strings to IDs for the links in the document.
Definition at line 12 of file LinksUpdate.php.
LinksUpdate::$mOptions |
LinksUpdate::$mProperties |
LinksUpdate::$mRecursive |
LinksUpdate::$mTemplates |
Map of title strings to IDs for the template references, including broken ones.
Definition at line 12 of file LinksUpdate.php.
LinksUpdate::$mTitle |