MediaWiki  REL1_21
LinksUpdate Class Reference

See docs/deferred.txt. More...

Inheritance diagram for LinksUpdate:
Collaboration diagram for LinksUpdate:

List of all members.

Public Member Functions

 __construct ($title, $parserOutput, $recursive=true)
 Constructor.
 doUpdate ()
 Update link tables with outgoing links from an updated article.
 getImages ()
 Return the list of images used as generated by the parser.
 getParserOutput ()
 Returns parser output.
 getPropertyDeletions ($existing)
 Get array of properties which should be deleted.
 getPropertyInsertions ($existing=array())
 Get an array of page property insertions.
 getTitle ()
 Return the title object of the page being updated.
 incrTableUpdate ($table, $prefix, $deletions, $insertions)
 Update a table by doing a delete query then an insert query.
 invalidateCategories ($cats)
 invalidateImageDescriptions ($images)
 queueRecursiveJobs ()
 updateCategoryCounts ($added, $deleted)
 Update all the appropriate counts in the category table.

Public Attributes

 $mCategories
 Map of category names to sort keys.
 $mDb
 Database connection reference.
 $mExternals
 URLs of external links, array key only.
 $mId
 Page ID of the article linked from.
 $mImages
 DB keys of the images used, in the array key only.
 $mInterlangs
 Map of language codes to titles.
 $mLinks
 Map of title strings to IDs for the links in the document.
 $mOptions
 SELECT options to be used (array)
 $mParserOutput
 Parser output.
 $mProperties
 Map of arbitrary name to value.
 $mRecursive
 Whether to queue jobs for recursive updates.
 $mTemplates
 Map of title strings to IDs for the template references, including broken ones.
 $mTitle
 Title object of the article linked from.

Protected Member Functions

 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.
 doIncrementalUpdate ()
 getExistingInterwikis ()
 Get an array of existing inline interwiki links, as a 2-D array.

Private Member Functions

 dumbTableUpdate ($table, $insertions, $fromField)
 getCategoryDeletions ($existing)
 Given an array of existing categories, returns those categories which are not in $this and thus should be deleted.
 getCategoryInsertions ($existing=array())
 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.
 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=array())
 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=array())
 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=array())
 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=array())
 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=array())
 Get an array of pagelinks insertions for passing to the DB Skips the titles specified by the 2-D array $existing.
 getTemplateDeletions ($existing)
 Given an array of existing templates, returns those templates which are not in $this and thus should be deleted.
 getTemplateInsertions ($existing=array())
 Get an array of template insertions.
 invalidateProperties ($changed)
 Invalidate any necessary link lists related to page property changes.

Detailed Description

See docs/deferred.txt.

Todo:
document (e.g. one-sentence top-level class description).

Definition at line 28 of file LinksUpdate.php.


Constructor & Destructor Documentation

LinksUpdate::__construct ( title,
parserOutput,
recursive = true 
)

Constructor.

Parameters:
$titleTitle of the page we're updating
$parserOutputParserOutput: output from a full parse of this page
$recursiveBoolean: queue jobs for recursive updates?
Exceptions:
MWException

Definition at line 54 of file LinksUpdate.php.

References $link, $title, DataUpdate\__construct(), array(), as, list, and wfRunHooks().


Member Function Documentation

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.

in refreshLinks.php

Definition at line 205 of file LinksUpdate.php.

References dumbTableUpdate(), getCategoryInsertions(), getExistingCategories(), getExistingImages(), getExternalInsertions(), getImageInsertions(), getInterlangInsertions(), getInterwikiInsertions(), getLinkInsertions(), getPropertyInsertions(), getTemplateInsertions(), invalidateCategories(), invalidateImageDescriptions(), queueRecursiveJobs(), updateCategoryCounts(), wfProfileIn(), and wfProfileOut().

Referenced by doUpdate().

Update link tables with outgoing links from an updated article.

Implements DeferrableUpdate.

Definition at line 114 of file LinksUpdate.php.

References array(), doDumbUpdate(), doIncrementalUpdate(), global, and wfRunHooks().

LinksUpdate::dumbTableUpdate ( table,
insertions,
fromField 
) [private]
Parameters:
$table
$insertions
$fromField

Definition at line 290 of file LinksUpdate.php.

References array().

Referenced by doDumbUpdate().

LinksUpdate::getCategoryDeletions ( existing) [private]

Given an array of existing categories, returns those categories which are not in $this and thus should be deleted.

Parameters:
$existingarray
Returns:
array

Definition at line 595 of file LinksUpdate.php.

Referenced by doIncrementalUpdate().

LinksUpdate::getCategoryInsertions ( existing = array()) [private]

Get an array of category insertions.

Parameters:
array$existingmapping existing category names to sort keys. If both match a link in $this, the link will be omitted from the output
Returns:
array

Definition at line 438 of file LinksUpdate.php.

References $name, $wgContLang, array(), as, global, Title\makeTitleSafe(), and Collation\singleton().

Referenced by doDumbUpdate(), and doIncrementalUpdate().

Get an array of existing categories, with the name in the key and sort key in the value.

Returns:
array

Definition at line 707 of file LinksUpdate.php.

References $res, array(), and as.

Referenced by doDumbUpdate(), and doIncrementalUpdate().

Get an array of existing external links, URLs in the keys.

Returns:
array

Definition at line 692 of file LinksUpdate.php.

References $res, array(), and as.

Referenced by doIncrementalUpdate().

Get an array of existing images, image names in the keys.

Returns:
array

Definition at line 677 of file LinksUpdate.php.

References $res, array(), and as.

Referenced by doDumbUpdate(), and doIncrementalUpdate().

Get an array of existing interlanguage links, with the language code in the key and the title in the value.

Returns:
array

Definition at line 723 of file LinksUpdate.php.

References $res, array(), and as.

Referenced by doIncrementalUpdate().

Get an array of existing inline interwiki links, as a 2-D array.

Returns:
array (prefix => array(dbkey => 1))

Definition at line 737 of file LinksUpdate.php.

References $res, array(), and as.

Referenced by doIncrementalUpdate().

Get an array of existing links, as a 2-D array.

Returns:
array

Definition at line 641 of file LinksUpdate.php.

References $res, array(), and as.

Referenced by doIncrementalUpdate().

Get an array of existing categories, with the name in the key and sort key in the value.

Returns:
array

Definition at line 755 of file LinksUpdate.php.

References $res, array(), and as.

Referenced by doIncrementalUpdate().

Get an array of existing templates, as a 2-D array.

Returns:
array

Definition at line 659 of file LinksUpdate.php.

References $res, array(), and as.

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.

Parameters:
$existingarray
Returns:
array

Definition at line 585 of file LinksUpdate.php.

Referenced by doIncrementalUpdate().

LinksUpdate::getExternalInsertions ( existing = array()) [private]

Get an array of externallinks insertions.

Skips the names specified in $existing

Parameters:
$existingarray
Returns:
array

Definition at line 415 of file LinksUpdate.php.

References $url, array(), as, and wfMakeUrlIndexes().

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.

Parameters:
$existingarray
Returns:
array

Definition at line 575 of file LinksUpdate.php.

Referenced by doIncrementalUpdate().

LinksUpdate::getImageInsertions ( existing = array()) [private]

Get an array of image insertions Skips the names specified in $existing.

Parameters:
$existingarray
Returns:
array

Definition at line 398 of file LinksUpdate.php.

References array(), and as.

Referenced by doDumbUpdate(), and doIncrementalUpdate().

Return the list of images used as generated by the parser.

Returns:
array

Definition at line 786 of file LinksUpdate.php.

LinksUpdate::getInterlangDeletions ( existing) [private]

Given an array of existing interlanguage links, returns those links which are not in $this and thus should be deleted.

Parameters:
$existingarray
Returns:
array

Definition at line 605 of file LinksUpdate.php.

Referenced by doIncrementalUpdate().

LinksUpdate::getInterlangInsertions ( existing = array()) [private]

Get an array of interlanguage link insertions.

Parameters:
array$existingmapping existing language codes to titles
Returns:
array

Definition at line 481 of file LinksUpdate.php.

References $title, array(), and as.

Referenced by doDumbUpdate(), and doIncrementalUpdate().

LinksUpdate::getInterwikiDeletions ( existing) [private]

Given an array of existing interwiki links, returns those links which are not in $this and thus should be deleted.

Parameters:
$existingarray
Returns:
array

Definition at line 624 of file LinksUpdate.php.

References array(), and as.

Referenced by doIncrementalUpdate().

LinksUpdate::getInterwikiInsertions ( existing = array()) [private]

Get an array of interwiki insertions for passing to the DB Skips the titles specified by the 2-D array $existing.

Parameters:
$existingarray
Returns:
array

Definition at line 518 of file LinksUpdate.php.

References array(), and as.

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.

Parameters:
$existingarray
Returns:
array

Definition at line 539 of file LinksUpdate.php.

References array(), and as.

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.

Parameters:
$existingarray
Returns:
array

Definition at line 355 of file LinksUpdate.php.

References array(), and as.

Referenced by doDumbUpdate(), and doIncrementalUpdate().

Returns parser output.

Since:
1.19
Returns:
ParserOutput

Definition at line 778 of file LinksUpdate.php.

Get array of properties which should be deleted.

Parameters:
$existingarray
Returns:
array

Definition at line 614 of file LinksUpdate.php.

Referenced by doIncrementalUpdate().

Get an array of page property insertions.

Parameters:
$existingarray
Returns:
array

Definition at line 499 of file LinksUpdate.php.

References $name, $value, array(), and as.

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.

Parameters:
$existingarray
Returns:
array

Definition at line 557 of file LinksUpdate.php.

References array(), and as.

Referenced by doIncrementalUpdate().

LinksUpdate::getTemplateInsertions ( existing = array()) [private]

Get an array of template insertions.

Like getLinkInsertions()

Parameters:
$existingarray
Returns:
array

Definition at line 377 of file LinksUpdate.php.

References array(), and as.

Referenced by doDumbUpdate(), and doIncrementalUpdate().

Return the title object of the page being updated.

Returns:
Title

Definition at line 769 of file LinksUpdate.php.

LinksUpdate::incrTableUpdate ( table,
prefix,
deletions,
insertions 
)

Update a table by doing a delete query then an insert query.

Parameters:
$table
$prefix
$deletions
$insertions

Definition at line 307 of file LinksUpdate.php.

References array(), and wfRunHooks().

Referenced by doIncrementalUpdate().

Parameters:
$cats

Definition at line 262 of file LinksUpdate.php.

References SqlDataUpdate\invalidatePages().

Referenced by doDumbUpdate(), and doIncrementalUpdate().

Parameters:
$images

Definition at line 281 of file LinksUpdate.php.

References SqlDataUpdate\invalidatePages().

Referenced by doDumbUpdate(), and doIncrementalUpdate().

LinksUpdate::invalidateProperties ( changed) [private]

Invalidate any necessary link lists related to page property changes.

Parameters:
$changed

Definition at line 794 of file LinksUpdate.php.

References $changed, $name, $value, array(), as, and global.

Referenced by doIncrementalUpdate().

LinksUpdate::updateCategoryCounts ( added,
deleted 
)

Update all the appropriate counts in the category table.

Parameters:
array$addedassociative array of category name => sort key
array$deletedassociative array of category name => sort key

Definition at line 271 of file LinksUpdate.php.

References WikiPage\factory().

Referenced by doDumbUpdate(), and doIncrementalUpdate().


Member Data Documentation

LinksUpdate::$mCategories

Map of category names to sort keys.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mDb

Database connection reference.

Reimplemented from SqlDataUpdate.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mExternals

URLs of external links, array key only.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mId

Page ID of the article linked from.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mImages

DB keys of the images used, in the array key only.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mInterlangs

Map of language codes to titles.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mLinks

Map of title strings to IDs for the links in the document.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mOptions

SELECT options to be used (array)

Reimplemented from SqlDataUpdate.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mParserOutput

Parser output.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mProperties

Map of arbitrary name to value.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mRecursive

Whether to queue jobs for recursive updates.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mTemplates

Map of title strings to IDs for the template references, including broken ones.

Definition at line 32 of file LinksUpdate.php.

LinksUpdate::$mTitle

Title object of the article linked from.

Definition at line 32 of file LinksUpdate.php.


The documentation for this class was generated from the following file: