LinksUpdate Class Reference

See docs/deferred.txt. More...

List of all members.

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.


Detailed Description

See docs/deferred.txt.

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

Definition at line 7 of file LinksUpdate.php.


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 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]

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 
)

Definition at line 284 of file LinksUpdate.php.

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.

Definition at line 537 of file LinksUpdate.php.

Referenced by doIncrementalUpdate().

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

Get an array of category insertions.

Parameters:
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.

References $res, and $row.

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.

References $res, and $row.

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.

References $res, and $row.

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.

References $res, and $row.

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.

References $res, and $row.

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.

References $res, and $row.

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.

References $res, and $row.

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.

Parameters:
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.

References $del, and $ns.

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.

References $del, and $ns.

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 (  ) 

Return the title object of the page being updated.

Definition at line 673 of file LinksUpdate.php.

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.

Parameters:
integer $namespace
array $dbkeys

Definition at line 225 of file LinksUpdate.php.

References $res, and $row.

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.

Parameters:
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.

Parameters:
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.

References $lb, and $prefix.

Referenced by incrTableUpdate().

LinksUpdate::queueRecursiveJobs (  ) 

LinksUpdate::updateCategoryCounts ( added,
deleted 
)

Update all the appropriate counts in the category table.

Parameters:
$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().


Member Data Documentation

LinksUpdate::$mCategories

Map of category names to sort keys.

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mDb

Database connection reference.

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mExternals

URLs of external links, array key only.

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mId

Page ID of the article linked from.

{

Access:
private

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mImages

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

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mInterlangs

Map of language codes to titles.

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mLinks

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

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mOptions

SELECT options to be used (array).

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mProperties

Map of arbitrary name to value.

Definition at line 12 of file LinksUpdate.php.

LinksUpdate::$mRecursive

Whether to queue jobs for recursive updates.

Definition at line 12 of file LinksUpdate.php.

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

Title object of the article linked from.

Definition at line 12 of file LinksUpdate.php.


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

Generated on Sat Sep 5 02:08:41 2009 for MediaWiki by  doxygen 1.5.9