MediaWiki master
MediaWiki\Deferred\LinksUpdate\CategoryLinksTable Class Reference

categorylinks More...

Inherits MediaWiki\Deferred\LinksUpdate\TitleLinksTable.

Collaboration diagram for MediaWiki\Deferred\LinksUpdate\CategoryLinksTable:

Public Member Functions

 __construct (LanguageConverterFactory $converterFactory, NamespaceInfo $namespaceInfo, WikiPageFactory $wikiPageFactory, ILoadBalancer $loadBalancer, WANObjectCache $WANObjectCache, Config $config, JobqueueGroup $jobQueueGroup, HookContainer $hookContainer, Collation $collation, $collationName, $tableName, $isTempTable)
 
 setParserOutput (ParserOutput $parserOutput)
 Subclasses should implement this to extract the data they need from the ParserOutput.
 
 startUpdate ()
 Cache the category type after the source page has been set.
 
- Public Member Functions inherited from MediaWiki\Deferred\LinksUpdate\TitleLinksTable
 getPageReferenceIterator ( $setType)
 Get a link set as an iterator over PageReferenceValue objects.
 
 getTitleArray ( $setType)
 Get a link set as an array of Title objects.
 
- Public Member Functions inherited from MediaWiki\Deferred\LinksUpdate\LinksTable
 beforeLock ()
 Subclasses can override this to do any necessary setup before the lock is acquired.
 
 injectBaseDependencies (LBFactory $lbFactory, LinkTargetLookup $linkTargetLookup, PageIdentity $sourcePage, $batchSize)
 This is called by the factory to inject dependencies for the base class.
 
 setMoveDetails (PageReference $movedPage)
 Notify the object that the operation is a page move, and set the original title.
 
 setRevision (RevisionRecord $revision)
 Set the revision associated with the edit.
 
 setStrictTestMode ( $mode=true)
 Omit conflict resolution options from the insert query so that testing can confirm that the incremental update logic was correct.
 
 setTransactionTicket ( $ticket)
 Set the empty transaction ticket.
 
 update ()
 Execute an edit/delete update.
 

Public Attributes

const VIRTUAL_DOMAIN = 'virtual-categorylinks'
 
- Public Attributes inherited from MediaWiki\Deferred\LinksUpdate\LinksTable
const CHANGED = 3
 Link type: Changed (inserted or removed) links.
 
const DELETED = 2
 Link type: Deleted (removed) links.
 
const INSERTED = 1
 Link type: Inserted (added) links.
 
const NEW = 5
 Link type: new links (from the ParserOutput)
 
const OLD = 4
 Link type: existing/old links.
 

Protected Member Functions

 deduplicateLinkIds ( $linkIds)
 Given an iterator over link IDs, remove links which go to the same title, leaving only one link per title.
Parameters
iterable<mixed>$linkIds
Returns
iterable<mixed>

 
 deleteLink ( $linkId)
 Delete a link identified by ID.The subclass is expected to queue the deletion by calling deleteRow().
Parameters
mixed$linkId

 
 fetchExistingRows ()
 Do a select query to fetch the existing rows.
 
 finishUpdate ()
 Subclasses can override this to do any updates associated with their link data, for example dispatching HTML update jobs.
 
 getExistingFields ()
 Get the fields to be used in fetchExistingRows().Note that fetchExistingRows() is just a helper for subclasses. The value returned here is effectively private to the subclass.
Returns
array

 
 getExistingLinkIDs ()
 
 getFromField ()
 Get the name of the field which links to page_id.
Returns
string

 
 getNewLinkIDs ()
 Get the new link IDs.
 
 getTableName ()
 Get the table name.
Returns
string

 
 insertLink ( $linkId)
 Insert a link identified by ID.The subclass is expected to queue the insertion by calling insertRow().
Parameters
mixed$linkId

 
 isExisting ( $linkId)
 Determine whether a link (from the new set) is in the existing set.
Parameters
mixed$linkId
Returns
bool

 
 isInNewSet ( $linkId)
 Determine whether a link (from the existing set) is in the new set.
Parameters
mixed$linkId
Returns
bool

 
 linksTargetNormalizationStage ()
 Normalization stage of the links table (see T222224)
 
 makePageReferenceValue ( $linkId)
 Convert a link ID to a PageReferenceValue.
Parameters
mixed$linkId
Returns
PageReferenceValue

 
 makeTitle ( $linkId)
 Convert a link ID to a Title.
Stability: stable
to override
Parameters
mixed$linkId
Returns
Title

 
 needForcedLinkRefresh ()
 Subclasses can override this to return true in order to force reinsertion of all the links due to some property of the link changing for reasons not represented by the link ID.
Returns
bool

 
 virtualDomain ()
 What virtual domain should be used to read/write from the table.
Returns
string|bool

 
- Protected Member Functions inherited from MediaWiki\Deferred\LinksUpdate\TitleLinksTable
 getDeduplicatedLinkIds ( $setType)
 Get link IDs for a given set type, filtering out duplicate links to the same title.
 
- Protected Member Functions inherited from MediaWiki\Deferred\LinksUpdate\LinksTable
 deleteRow ( $conds)
 Queue a deletion operation.
 
 doWrites ()
 Do the common DB operations.
 
 getBatchSize ()
 Get the maximum number of rows to update in a batch.
 
 getDB ()
 
 getFromConds ()
 Get field=>value associative array for the from field(s)
 
 getInsertOptions ()
 Get the options for the insert queries.
 
 getLBFactory ()
 
 getLinkIDs ( $setType)
 Get an array or iterator of link IDs of a given type.
 
 getMovedPage ()
 Assuming the page was moved, get the original page title before the move.
 
 getRevision ()
 Get the RevisionRecord of the new revision, if the LinksUpdate caller injected one.
 
 getSourcePage ()
 Get the source page, i.e.
 
 getSourcePageId ()
 Get the page_id of the source page.
 
 getTransactionTicket ()
 Get the empty transaction ticket, or null if there is none.
 
 insertRow ( $row)
 Queue a row for insertion.
 
 isCrossNamespaceMove ()
 Determine whether the page was moved to a different namespace.
 
 isMove ()
 Determine whether the page was moved.
 

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Deferred\LinksUpdate\LinksTable
array $deletedLinks = []
 Link IDs for deleted links.
 
array $insertedLinks = []
 Link IDs for inserted links.
 
LinkTargetLookup $linkTargetLookup
 
array $rowsToDelete = []
 Rows to delete.
 
array $rowsToInsert = []
 Rows to insert.
 
bool $strictTestMode
 

Detailed Description

categorylinks

Link ID format: string[]

  • 0: Category name
  • 1: User-specified sort key (cl_sortkey_prefix)
Since
1.38

Definition at line 37 of file CategoryLinksTable.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::__construct ( LanguageConverterFactory $converterFactory,
NamespaceInfo $namespaceInfo,
WikiPageFactory $wikiPageFactory,
ILoadBalancer $loadBalancer,
WANObjectCache $WANObjectCache,
Config $config,
JobqueueGroup $jobQueueGroup,
HookContainer $hookContainer,
Collation $collation,
$collationName,
$tableName,
$isTempTable )
Parameters
LanguageConverterFactory$converterFactory
NamespaceInfo$namespaceInfo
WikiPageFactory$wikiPageFactory
ILoadBalancer$loadBalancer
WANObjectCache$WANObjectCache
Config$config
JobqueueGroup$jobQueueGroup
HookContainer$hookContainer
Collation$collation
string$collationName
string$tableName
bool$isTempTable

Definition at line 101 of file CategoryLinksTable.php.

Member Function Documentation

◆ deduplicateLinkIds()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::deduplicateLinkIds ( $linkIds)
protected

Given an iterator over link IDs, remove links which go to the same title, leaving only one link per title.

Parameters
iterable<mixed>$linkIds
Returns
iterable<mixed>

Reimplemented from MediaWiki\Deferred\LinksUpdate\TitleLinksTable.

Definition at line 328 of file CategoryLinksTable.php.

◆ deleteLink()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::deleteLink ( $linkId)
protected

Delete a link identified by ID.The subclass is expected to queue the deletion by calling deleteRow().

Parameters
mixed$linkId

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 302 of file CategoryLinksTable.php.

◆ fetchExistingRows()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::fetchExistingRows ( )
protected

Do a select query to fetch the existing rows.

This is a helper for subclasses.

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 394 of file CategoryLinksTable.php.

◆ finishUpdate()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::finishUpdate ( )
protected

Subclasses can override this to do any updates associated with their link data, for example dispatching HTML update jobs.

Stability: stable
to override

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 338 of file CategoryLinksTable.php.

◆ getExistingFields()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::getExistingFields ( )
protected

Get the fields to be used in fetchExistingRows().Note that fetchExistingRows() is just a helper for subclasses. The value returned here is effectively private to the subclass.

Returns
array

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 197 of file CategoryLinksTable.php.

References MediaWiki\Deferred\LinksUpdate\CategoryLinksTable\needForcedLinkRefresh().

◆ getExistingLinkIDs()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::getExistingLinkIDs ( )
protected
Returns
\Generator

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 257 of file CategoryLinksTable.php.

◆ getFromField()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::getFromField ( )
protected

Get the name of the field which links to page_id.

Returns
string

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 192 of file CategoryLinksTable.php.

◆ getNewLinkIDs()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::getNewLinkIDs ( )
protected

Get the new link IDs.

The link ID is a list with the name in the first element and the sort key prefix in the second element.

Returns
iterable<array>

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 213 of file CategoryLinksTable.php.

◆ getTableName()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::getTableName ( )
protected

Get the table name.

Returns
string

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 187 of file CategoryLinksTable.php.

◆ insertLink()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::insertLink ( $linkId)
protected

Insert a link identified by ID.The subclass is expected to queue the insertion by calling insertRow().

Parameters
mixed$linkId

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 278 of file CategoryLinksTable.php.

◆ isExisting()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::isExisting ( $linkId)
protected

Determine whether a link (from the new set) is in the existing set.

Parameters
mixed$linkId
Returns
bool

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 264 of file CategoryLinksTable.php.

◆ isInNewSet()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::isInNewSet ( $linkId)
protected

Determine whether a link (from the existing set) is in the new set.

Parameters
mixed$linkId
Returns
bool

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 271 of file CategoryLinksTable.php.

◆ linksTargetNormalizationStage()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::linksTargetNormalizationStage ( )
protected

Normalization stage of the links table (see T222224)

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 385 of file CategoryLinksTable.php.

◆ makePageReferenceValue()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::makePageReferenceValue ( $linkId)
protected

Convert a link ID to a PageReferenceValue.

Parameters
mixed$linkId
Returns
PageReferenceValue

Reimplemented from MediaWiki\Deferred\LinksUpdate\TitleLinksTable.

Definition at line 318 of file CategoryLinksTable.php.

◆ makeTitle()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::makeTitle ( $linkId)
protected

Convert a link ID to a Title.

Stability: stable
to override
Parameters
mixed$linkId
Returns
Title

Reimplemented from MediaWiki\Deferred\LinksUpdate\TitleLinksTable.

Definition at line 323 of file CategoryLinksTable.php.

Referenced by MediaWiki\JobQueue\Job\__construct(), MediaWiki\Page\DeletePageJob\__construct(), MediaWiki\Parser\Parser\__construct(), MediaWiki\RecentChanges\ChangesFeed\buildItems(), MediaWiki\FileRepo\LocalRepo\checkRedirect(), MediaWiki\Parser\LinkHolderArray\doVariants(), MediaWiki\Specials\SpecialPasswordPolicies\execute(), MediaWiki\Api\ApiBlock\execute(), MediaWiki\Api\ApiEntryPoint\execute(), MediaWiki\Api\ApiQueryDeletedrevs\execute(), MediaWiki\Api\ApiQueryFilearchive\execute(), MediaWiki\Api\ApiUnblock\execute(), MediaWiki\Api\ApiUserrights\execute(), MediaWiki\Api\ApiQueryCategoryList\executeQuery(), MediaWiki\Api\ApiQueryRecentChanges\extractRowInfo(), MediaWiki\FileRepo\ForeignAPIRepo\findBySha1(), MediaWiki\Page\WikiFilePage\followRedirect(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\footerHtml(), MediaWiki\Feed\FeedUtils\formatDiff(), MediaWiki\Specials\SpecialAncientPages\formatResult(), MediaWiki\Specials\SpecialBrokenRedirects\formatResult(), MediaWiki\Specials\SpecialDoubleRedirects\formatResult(), MediaWiki\Specials\SpecialListDuplicatedFiles\formatResult(), MediaWiki\Specials\SpecialListRedirects\formatResult(), MediaWiki\Specials\SpecialMIMESearch\formatResult(), MediaWiki\Specials\SpecialUncategorizedCategories\formatResult(), MediaWiki\Specials\SpecialUnusedCategories\formatResult(), MediaWiki\Specials\SpecialUnusedTemplates\formatResult(), MediaWiki\Specials\SpecialWantedCategories\formatResult(), MediaWiki\Specials\Pager\NewFilesPager\formatRow(), MediaWiki\Specials\Pager\NewPagesPager\formatRow(), MediaWiki\Specials\Pager\AllMessagesTablePager\formatValue(), MediaWiki\Category\CategoriesRdf\getDumpURI(), MediaWiki\JobQueue\Jobs\DoubleRedirectJob\getFinalDestination(), MediaWiki\ChangeTags\ChangeTagsLogItem\getHTML(), MediaWiki\Specials\SpecialExport\getLinks(), MediaWiki\Search\TitleMatcher\getNearMatchInternal(), MediaWiki\Specials\SpecialRandomInCategory\getRandomTitle(), MediaWiki\Specials\Redirects\SpecialMypage\getRedirect(), MediaWiki\Specials\Redirects\SpecialMytalk\getRedirect(), MediaWiki\Specials\SpecialBrokenRedirects\getRedirectTarget(), MediaWiki\Specials\SpecialListRedirects\getRedirectTarget(), MediaWiki\Logging\RCDatabaseLogEntry\getTarget(), MediaWiki\RecentChanges\RecentChange\getTitle(), MediaWiki\User\ExternalUserNames\getUserLinkTitle(), MediaWiki\Page\SitemapGenerator\getXml(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\headerHtml(), MediaWiki\Page\ImagePage\imageLinks(), MediaWiki\Category\CategoriesRdf\labelToUrl(), MediaWiki\FileRepo\File\ArchivedFile\newFromRow(), MediaWiki\Page\Article\newFromTitle(), MediaWiki\JobQueue\Jobs\CategoryMembershipChangeJob\notifyUpdatesForRevision(), MediaWiki\Specials\SpecialBrokenRedirects\preprocessResults(), MediaWiki\Parser\LinkHolderArray\replaceInternal(), MediaWiki\Api\ApiQueryIWBacklinks\run(), MediaWiki\Api\ApiQueryLangBacklinks\run(), MediaWiki\Api\ApiQueryQueryPage\run(), MediaWiki\Api\ApiQueryRecentChanges\run(), MediaWiki\JobQueue\Jobs\DoubleRedirectJob\run(), MediaWiki\Api\ApiQueryAllDeletedRevisions\run(), MediaWiki\Api\ApiQueryDeletedRevisions\run(), MediaWiki\Api\ApiQueryRandom\runQuery(), MediaWiki\Specials\SpecialUpload\showUploadWarning(), MediaWiki\Parser\CoreParserFunctions\urlFunction(), MediaWiki\Category\CategoriesRdf\writeCategoryData(), and MediaWiki\Category\CategoriesRdf\writeCategoryLinkData().

◆ needForcedLinkRefresh()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::needForcedLinkRefresh ( )
protected

Subclasses can override this to return true in order to force reinsertion of all the links due to some property of the link changing for reasons not represented by the link ID.

Returns
bool

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 312 of file CategoryLinksTable.php.

Referenced by MediaWiki\Deferred\LinksUpdate\CategoryLinksTable\getExistingFields().

◆ setParserOutput()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::setParserOutput ( ParserOutput $parserOutput)

Subclasses should implement this to extract the data they need from the ParserOutput.

To support a future refactor of LinksDeletionUpdate, if this method is not called, the subclass should assume that the new state is empty.

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 143 of file CategoryLinksTable.php.

References MediaWiki\Parser\ParserOutput\getLinkList(), MediaWiki\Parser\ParserOutput\getPageProperty(), and MediaWiki\Deferred\LinksUpdate\LinksTable\getSourcePage().

◆ startUpdate()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::startUpdate ( )

Cache the category type after the source page has been set.

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 138 of file CategoryLinksTable.php.

References MediaWiki\Deferred\LinksUpdate\LinksTable\getSourcePage().

◆ virtualDomain()

MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::virtualDomain ( )
protected

What virtual domain should be used to read/write from the table.

Returns
string|bool

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 390 of file CategoryLinksTable.php.

Member Data Documentation

◆ VIRTUAL_DOMAIN

const MediaWiki\Deferred\LinksUpdate\CategoryLinksTable::VIRTUAL_DOMAIN = 'virtual-categorylinks'

Definition at line 38 of file CategoryLinksTable.php.


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