MediaWiki master
MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable Class Reference

Shared code for pagelinks, templatelinks and existencelinks. More...

Inherits MediaWiki\Deferred\LinksUpdate\TitleLinksTable.

Inherited by MediaWiki\Deferred\LinksUpdate\ExistenceLinksTable, MediaWiki\Deferred\LinksUpdate\PageLinksTable, and MediaWiki\Deferred\LinksUpdate\TemplateLinksTable.

Collaboration diagram for MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable:

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.
 
 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 ()
 Get an array (or iterator) of link IDs for the existing state.The subclass should load the data from the database. There is fetchExistingRows() to make this easier but the subclass is responsible for caching.See the LinksTable doc comment for an explanation of link IDs.
Returns
iterable<mixed>

 
 getFromNamespaceField ()
 
 getNamespaceField ()
 Get the namespace field name.
 
 getNewLinkIDs ()
 Get an array (or iterator) of link IDs for the new state.See the LinksTable doc comment for an explanation of link IDs.
Returns
iterable<mixed>

 
 getTargetIdField ()
 Get the link target id (DB key) field name.
 
 getTitleField ()
 Get the title (DB key) field name.
 
 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

 
 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

 
- 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.
 
 finishUpdate ()
 Subclasses can override this to do any updates associated with their link data, for example dispatching HTML update jobs.
 
 getBatchSize ()
 Get the maximum number of rows to update in a batch.
 
 getDB ()
 
 getFromConds ()
 Get field=>value associative array for the from field(s)
 
 getFromField ()
 Get the name of the field which links to page_id.
 
 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.
 
 getTableName ()
 Get the table name.
 
 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.
 
 linksTargetNormalizationStage ()
 Normalization stage of the links table (see T222224)
 
 startUpdate ()
 Subclasses can override this to do any necessary setup before individual write operations begin.
 

Protected Attributes

array $newLinks = []
 A 2d array representing the new links, with the namespace ID in the first key, the DB key in the second key, and the value arbitrary.
 
- 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
 

Additional Inherited Members

- 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.
 
 setParserOutput (ParserOutput $parserOutput)
 Subclasses should implement this to extract the data they need from the ParserOutput.
 
 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 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.
 

Detailed Description

Shared code for pagelinks, templatelinks and existencelinks.

These tables all link to an arbitrary page identified by namespace and title.

Link ID format: string[]:

  • 0: namespace ID
  • 1: title DB key
Since
1.38

Definition at line 19 of file GenericPageLinksTable.php.

Member Function Documentation

◆ deduplicateLinkIds()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 191 of file GenericPageLinksTable.php.

◆ deleteLink()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 159 of file GenericPageLinksTable.php.

References SCHEMA_COMPAT_WRITE_NEW, and SCHEMA_COMPAT_WRITE_OLD.

◆ fetchExistingRows()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 92 of file GenericPageLinksTable.php.

References MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable\getTargetIdField().

◆ getExistingFields()

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

◆ getExistingLinkIDs()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::getExistingLinkIDs ( )
protected

Get an array (or iterator) of link IDs for the existing state.The subclass should load the data from the database. There is fetchExistingRows() to make this easier but the subclass is responsible for caching.See the LinksTable doc comment for an explanation of link IDs.

Returns
iterable<mixed>

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 118 of file GenericPageLinksTable.php.

◆ getFromNamespaceField()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::getFromNamespaceField ( )
abstractprotected

◆ getNamespaceField()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::getNamespaceField ( )
abstractprotected

◆ getNewLinkIDs()

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

Get an array (or iterator) of link IDs for the new state.See the LinksTable doc comment for an explanation of link IDs.

Returns
iterable<mixed>

Reimplemented from MediaWiki\Deferred\LinksUpdate\LinksTable.

Definition at line 109 of file GenericPageLinksTable.php.

◆ getTargetIdField()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::getTargetIdField ( )
abstractprotected

◆ getTitleField()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::getTitleField ( )
abstractprotected

◆ insertLink()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 139 of file GenericPageLinksTable.php.

References SCHEMA_COMPAT_WRITE_NEW, and SCHEMA_COMPAT_WRITE_OLD.

◆ isExisting()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 127 of file GenericPageLinksTable.php.

◆ isInNewSet()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 133 of file GenericPageLinksTable.php.

◆ makePageReferenceValue()

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

Convert a link ID to a PageReferenceValue.

Parameters
mixed$linkId
Returns
PageReferenceValue

Reimplemented from MediaWiki\Deferred\LinksUpdate\TitleLinksTable.

Definition at line 181 of file GenericPageLinksTable.php.

◆ makeTitle()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 186 of file GenericPageLinksTable.php.

◆ needForcedLinkRefresh()

MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::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 176 of file GenericPageLinksTable.php.

Member Data Documentation

◆ $newLinks

array MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable::$newLinks = []
protected

A 2d array representing the new links, with the namespace ID in the first key, the DB key in the second key, and the value arbitrary.

Definition at line 26 of file GenericPageLinksTable.php.


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