MediaWiki
1.33.0
|
A handle for managing updates for derived page data on edit, import, purge, etc. More...
Public Member Functions | |
__construct (WikiPage $wikiPage, RevisionStore $revisionStore, RevisionRenderer $revisionRenderer, SlotRoleRegistry $slotRoleRegistry, ParserCache $parserCache, JobQueueGroup $jobQueueGroup, MessageCache $messageCache, Language $contLang, LBFactory $loadbalancerFactory) | |
doParserCacheUpdate () | |
doSecondaryDataUpdates (array $options=[]) | |
Do secondary data updates (such as updating link tables). More... | |
doUpdates () | |
Do standard updates after page edit, purge, or import. More... | |
getCanonicalParserOptions () | |
getCanonicalParserOutput () | |
getModifiedSlotRoles () | |
Returns the role names of the slots modified by the new revision, not including removed roles. More... | |
getPreparedEdit () | |
getRawContent ( $role) | |
Returns the content of the given slot, with no audience checks. More... | |
getRawSlot ( $role) | |
Returns the slot, modified or inherited, after PST, with no audience checks applied. More... | |
getRemovedSlotRoles () | |
Returns the role names of the slots removed by the new revision. More... | |
getRenderedRevision () | |
getRevision () | |
Returns the update's target revision - that is, the revision that will be the current revision after the update. More... | |
getSecondaryDataUpdates ( $recursive=false) | |
getSlotParserOutput ( $role, $generateHtml=true) | |
getSlots () | |
Returns the slots of the target revision, after PST. More... | |
getTouchedSlotRoles () | |
Returns the role names of the slots touched by the new revision, including removed roles. More... | |
grabCurrentRevision () | |
Returns the revision that was the page's current revision when grabCurrentRevision() was first called. More... | |
isChange () | |
Whether the edit created, or should create, a new revision (that is, it's not a null-edit). More... | |
isContentDeleted () | |
Whether the content is deleted and thus not visible to the public. More... | |
isContentPrepared () | |
Whether prepareUpdate() or prepareContent() have been called on this instance. More... | |
isCountable () | |
isCreation () | |
Whether the edit creates the page. More... | |
isRedirect () | |
isReusableFor (UserIdentity $user=null, RevisionRecord $revision=null, RevisionSlotsUpdate $slotsUpdate=null, $parentId=null) | |
Checks whether this DerivedPageDataUpdater can be re-used for running updates targeting the given revision. More... | |
isUpdatePrepared () | |
Whether prepareUpdate() has been called on this instance. More... | |
pageExisted () | |
Determines whether the page being edited already existed. More... | |
prepareContent (User $user, RevisionSlotsUpdate $slotsUpdate, $useStash=true) | |
Prepare updates based on an update which has not yet been saved. More... | |
prepareUpdate (RevisionRecord $revision, array $options=[]) | |
Prepare derived data updates targeting the given Revision. More... | |
setArticleCountMethod ( $articleCountMethod) | |
setRcWatchCategoryMembership ( $rcWatchCategoryMembership) | |
wasRedirect () | |
Whether the page was a redirect before the edit. More... | |
Private Member Functions | |
assertHasPageState ( $method) | |
assertHasRevision ( $method) | |
assertPrepared ( $method) | |
assertTransition ( $newStage) | |
Asserts that a transition to the given stage is possible, without performing it. More... | |
doTransition ( $newStage) | |
Transition function for managing the life cycle of this instances. More... | |
getContentHandler ( $role) | |
getContentModel ( $role) | |
Returns the content model of the given slot. More... | |
getPageId () | |
getParentRevision () | |
Returns the parent revision of the new revision wrapped by this update. More... | |
getRevisionSlotsUpdate () | |
Returns the RevisionSlotsUpdate for this updater. More... | |
getTitle () | |
getWikiId () | |
getWikiPage () | |
revisionIsRedirect (RevisionRecord $rev) | |
useMaster () | |
Private Attributes | |
string | $articleCountMethod |
see $wgArticleCountMethod More... | |
Language | $contLang |
JobQueueGroup | $jobQueueGroup |
LBFactory | $loadbalancerFactory |
MessageCache | $messageCache |
$options | |
Stores (most of) the $options parameter of prepareUpdate(). More... | |
array | $pageState = null |
The state of the relevant row in page table before the edit. More... | |
RevisionRecord null | $parentRevision = null |
ParserCache | $parserCache |
boolean | $rcWatchCategoryMembership = false |
see $wgRCWatchCategoryMembership More... | |
RenderedRevision | $renderedRevision = null |
RevisionRecord null | $revision = null |
RevisionRenderer | $revisionRenderer |
RevisionStore | $revisionStore |
SlotRoleRegistry | $slotRoleRegistry |
RevisionSlotsUpdate null | $slotsUpdate = null |
string | $stage = 'new' |
A stage identifier for managing the life cycle of this instance. More... | |
UserIdentity null | $user = null |
WikiPage | $wikiPage |
Static Private Attributes | |
static array[] | $transitions |
Transition table for managing the life cycle of DerivedPageDateUpdater instances. More... | |
Additional Inherited Members | |
Public Attributes inherited from IDBAccessObject | |
const | READ_LOCKING = self::READ_LATEST | 2 |
Constants for object loading bitfield flags (higher => higher QoS) More... | |
const | READ_NONE = -1 |
A handle for managing updates for derived page data on edit, import, purge, etc.
DerivedPageDataUpdater instances are designed to be cached inside a WikiPage instance, and re-used by callback code over the course of an update operation. It's a stepping stone one the way to a more complete refactoring of WikiPage.
When using a DerivedPageDataUpdater, the following life cycle must be observed: grabCurrentRevision (optional), prepareContent (optional), prepareUpdate (required for doUpdates). getCanonicalParserOutput, getSlots, and getSecondaryDataUpdates require prepareContent or prepareUpdate to have been called first, to initialize the DerivedPageDataUpdater.
MCR migration note: this replaces the relevant methods in WikiPage, and covers the use cases of PreparedEdit.
Definition at line 96 of file DerivedPageDataUpdater.php.
MediaWiki\Storage\DerivedPageDataUpdater::__construct | ( | WikiPage | $wikiPage, |
RevisionStore | $revisionStore, | ||
RevisionRenderer | $revisionRenderer, | ||
SlotRoleRegistry | $slotRoleRegistry, | ||
ParserCache | $parserCache, | ||
JobQueueGroup | $jobQueueGroup, | ||
MessageCache | $messageCache, | ||
Language | $contLang, | ||
LBFactory | $loadbalancerFactory | ||
) |
WikiPage | $wikiPage |
Definition at line 272 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$contLang, MediaWiki\Storage\DerivedPageDataUpdater\$jobQueueGroup, MediaWiki\Storage\DerivedPageDataUpdater\$loadbalancerFactory, MediaWiki\Storage\DerivedPageDataUpdater\$messageCache, MediaWiki\Storage\DerivedPageDataUpdater\$parserCache, MediaWiki\Storage\DerivedPageDataUpdater\$revisionRenderer, MediaWiki\Storage\DerivedPageDataUpdater\$revisionStore, MediaWiki\Storage\DerivedPageDataUpdater\$slotRoleRegistry, and MediaWiki\Storage\DerivedPageDataUpdater\$wikiPage.
|
private |
Definition at line 898 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\pageExisted(), and MediaWiki\Storage\DerivedPageDataUpdater\wasRedirect().
|
private |
Definition at line 915 of file DerivedPageDataUpdater.php.
References revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate(), and MediaWiki\Storage\DerivedPageDataUpdater\doSecondaryDataUpdates().
|
private |
Definition at line 907 of file DerivedPageDataUpdater.php.
References revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getParentRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getPreparedEdit(), MediaWiki\Storage\DerivedPageDataUpdater\getRenderedRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\getSlots(), MediaWiki\Storage\DerivedPageDataUpdater\isChange(), and MediaWiki\Storage\DerivedPageDataUpdater\isCreation().
|
private |
Asserts that a transition to the given stage is possible, without performing it.
string | $newStage | the new stage |
LogicException | If this instance is not in the expected stage |
Definition at line 326 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doTransition(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().
MediaWiki\Storage\DerivedPageDataUpdater::doParserCacheUpdate | ( | ) |
Definition at line 1605 of file DerivedPageDataUpdater.php.
References $output, MediaWiki\Storage\DerivedPageDataUpdater\$wikiPage, MediaWiki\Storage\DerivedPageDataUpdater\assertHasRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOptions(), MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOutput(), MediaWiki\Storage\DerivedPageDataUpdater\getWikiPage(), options(), and revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
MediaWiki\Storage\DerivedPageDataUpdater::doSecondaryDataUpdates | ( | array | $options = [] | ) |
Do secondary data updates (such as updating link tables).
MCR note: this method is temporarily exposed via WikiPage::doSecondaryDataUpdates.
array | $options |
|
Definition at line 1552 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$options, MediaWiki\Storage\DerivedPageDataUpdater\$user, DeferredUpdates\addUpdate(), as, MediaWiki\Storage\DerivedPageDataUpdater\assertHasRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), User\newFromIdentity(), options(), DeferredUpdates\POSTSEND, DeferredUpdates\PRESEND, and revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
|
private |
Transition function for managing the life cycle of this instances.
string | $newStage | the new stage |
LogicException | If a transition to the given stage is not possible in the current stage. |
Definition at line 308 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$stage, and MediaWiki\Storage\DerivedPageDataUpdater\assertTransition().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), MediaWiki\Storage\DerivedPageDataUpdater\prepareContent(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareUpdate().
MediaWiki\Storage\DerivedPageDataUpdater::doUpdates | ( | ) |
Do standard updates after page edit, purge, or import.
Update links tables, site stats, search index, title cache, message cache, etc. Purges pages that depend on this page when appropriate. With a 10% chance, triggers pruning the recent changes table.
MCR migration note: this replaces WikiPage::doEditUpdates.
Definition at line 1397 of file DerivedPageDataUpdater.php.
References $title, MediaWiki\Storage\DerivedPageDataUpdater\$wikiPage, DeferredUpdates\addUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\assertTransition(), MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\doSecondaryDataUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\doTransition(), SiteStatsUpdate\factory(), MediaWiki\Storage\DerivedPageDataUpdater\getContentHandler(), MediaWiki\Storage\DerivedPageDataUpdater\getPageId(), MediaWiki\Storage\DerivedPageDataUpdater\getParentRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getPreparedEdit(), MediaWiki\Storage\DerivedPageDataUpdater\getRawContent(), MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\getTitle(), MediaWiki\Storage\DerivedPageDataUpdater\getTouchedSlotRoles(), MediaWiki\Storage\DerivedPageDataUpdater\getWikiId(), MediaWiki\Storage\DerivedPageDataUpdater\getWikiPage(), ResourceLoaderWikiModule\invalidateModuleCache(), MediaWiki\Storage\DerivedPageDataUpdater\isContentDeleted(), MediaWiki\Storage\DerivedPageDataUpdater\isCountable(), User\isIP(), Revision\SlotRecord\MAIN, User\newFromIdentity(), User\newFromName(), RecentChangesUpdateJob\newPurgeJob(), CategoryMembershipChangeJob\newSpec(), NS_MEDIAWIKI, NS_USER_TALK, null, WikiPage\onArticleCreate(), WikiPage\onArticleEdit(), options(), DeferredUpdates\POSTSEND, revision, Hooks\run(), user, wfDebug(), and wfWikiID().
MediaWiki\Storage\DerivedPageDataUpdater::getCanonicalParserOptions | ( | ) |
Definition at line 1281 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRenderedRevision().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate(), and MediaWiki\Storage\DerivedPageDataUpdater\getPreparedEdit().
MediaWiki\Storage\DerivedPageDataUpdater::getCanonicalParserOutput | ( | ) |
Definition at line 1274 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRenderedRevision().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\getPreparedEdit(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), and MediaWiki\Storage\DerivedPageDataUpdater\isCountable().
|
private |
string | $role | slot role name |
Definition at line 616 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getContentModel(), and ContentHandler\getForModelID().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
|
private |
Returns the content model of the given slot.
string | $role | slot role name |
Definition at line 608 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRawSlot().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getContentHandler().
MediaWiki\Storage\DerivedPageDataUpdater::getModifiedSlotRoles | ( | ) |
Returns the role names of the slots modified by the new revision, not including removed roles.
Definition at line 1015 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\isCountable().
|
private |
Definition at line 557 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
|
private |
Returns the parent revision of the new revision wrapped by this update.
If the update is a null-edit, this will return the parent of the current (and new) revision. This will return null if the revision wrapped by this update created the page. Only defined after calling prepareContent() or prepareUpdate()!
Definition at line 464 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$parentRevision, MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared(), revision, and MediaWiki\Storage\DerivedPageDataUpdater\useMaster().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate(), and MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates().
MediaWiki\Storage\DerivedPageDataUpdater::getPreparedEdit | ( | ) |
Definition at line 1238 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$slotsUpdate, MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared(), MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOptions(), MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOutput(), MediaWiki\Storage\RevisionSlotsUpdate\getModifiedSlot(), MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate(), MediaWiki\Storage\RevisionSlotsUpdate\isModifiedSlot(), Revision\SlotRecord\MAIN, and revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
MediaWiki\Storage\DerivedPageDataUpdater::getRawContent | ( | $role | ) |
Returns the content of the given slot, with no audience checks.
PageUpdateException | If the slot is neither set for update nor inherited from the parent revision. |
string | $role | slot role name |
Definition at line 598 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRawSlot().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\isCountable(), and MediaWiki\Storage\DerivedPageDataUpdater\isRedirect().
MediaWiki\Storage\DerivedPageDataUpdater::getRawSlot | ( | $role | ) |
Returns the slot, modified or inherited, after PST, with no audience checks applied.
string | $role | slot role name |
PageUpdateException | If the slot is neither set for update nor inherited from the parent revision. |
Definition at line 586 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getSlots().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getContentModel(), MediaWiki\Storage\DerivedPageDataUpdater\getRawContent(), and MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates().
MediaWiki\Storage\DerivedPageDataUpdater::getRemovedSlotRoles | ( | ) |
Returns the role names of the slots removed by the new revision.
Definition at line 1024 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates().
MediaWiki\Storage\DerivedPageDataUpdater::getRenderedRevision | ( | ) |
Definition at line 892 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$renderedRevision, and MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOptions(), MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOutput(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), and MediaWiki\Storage\DerivedPageDataUpdater\getSlotParserOutput().
MediaWiki\Storage\DerivedPageDataUpdater::getRevision | ( | ) |
Returns the update's target revision - that is, the revision that will be the current revision after the update.
Definition at line 884 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$revision, and MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared().
|
private |
Returns the RevisionSlotsUpdate for this updater.
Definition at line 986 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$slotsUpdate, MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared(), MediaWiki\Storage\DerivedPageDataUpdater\getParentRevision(), MediaWiki\Storage\RevisionSlotsUpdate\newFromRevisionSlots(), null, and revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\getModifiedSlotRoles(), MediaWiki\Storage\DerivedPageDataUpdater\getPreparedEdit(), MediaWiki\Storage\DerivedPageDataUpdater\getRemovedSlotRoles(), and MediaWiki\Storage\DerivedPageDataUpdater\getTouchedSlotRoles().
MediaWiki\Storage\DerivedPageDataUpdater::getSecondaryDataUpdates | ( | $recursive = false | ) |
bool | $recursive |
Definition at line 1290 of file DerivedPageDataUpdater.php.
References $content, $handler, $linksUpdate, $output, MediaWiki\Storage\DerivedPageDataUpdater\$parentRevision, MediaWiki\Storage\DerivedPageDataUpdater\$renderedRevision, MediaWiki\Storage\DerivedPageDataUpdater\$wikiPage, as, MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOutput(), MediaWiki\Storage\DerivedPageDataUpdater\getParentRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getRawSlot(), MediaWiki\Storage\DerivedPageDataUpdater\getRemovedSlotRoles(), MediaWiki\Storage\DerivedPageDataUpdater\getRenderedRevision(), Revision\RevisionRecord\getSlot(), MediaWiki\Storage\DerivedPageDataUpdater\getSlots(), MediaWiki\Storage\DerivedPageDataUpdater\getTitle(), MediaWiki\Storage\DerivedPageDataUpdater\getWikiPage(), MediaWiki\Storage\DerivedPageDataUpdater\isContentDeleted(), Revision\RevisionRecord\RAW, and Hooks\run().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doSecondaryDataUpdates().
MediaWiki\Storage\DerivedPageDataUpdater::getSlotParserOutput | ( | $role, | |
$generateHtml = true |
|||
) |
string | $role | |
bool | $generateHtml |
Definition at line 1264 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRenderedRevision().
MediaWiki\Storage\DerivedPageDataUpdater::getSlots | ( | ) |
Returns the slots of the target revision, after PST.
Definition at line 976 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared(), and revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getRawSlot(), and MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates().
|
private |
Definition at line 429 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\isCountable(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().
MediaWiki\Storage\DerivedPageDataUpdater::getTouchedSlotRoles | ( | ) |
Returns the role names of the slots touched by the new revision, including removed roles.
Definition at line 1005 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
|
private |
Definition at line 335 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
|
private |
Definition at line 437 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$wikiPage.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().
MediaWiki\Storage\DerivedPageDataUpdater::grabCurrentRevision | ( | ) |
Returns the revision that was the page's current revision when grabCurrentRevision() was first called.
During an edit, that revision will act as the logical parent of the new revision.
Some updates are performed based on the difference between the database state at the moment this method is first called, and the state after the edit.
Definition at line 506 of file DerivedPageDataUpdater.php.
References $rev, MediaWiki\Storage\DerivedPageDataUpdater\$wikiPage, MediaWiki\Storage\DerivedPageDataUpdater\assertTransition(), MediaWiki\Storage\DerivedPageDataUpdater\doTransition(), WikiPage\getRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getWikiPage(), WikiPage\isCountable(), WikiPage\isRedirect(), and WikiPage\loadPageData().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().
MediaWiki\Storage\DerivedPageDataUpdater::isChange | ( | ) |
Whether the edit created, or should create, a new revision (that is, it's not a null-edit).
Definition at line 942 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared(), and options().
MediaWiki\Storage\DerivedPageDataUpdater::isContentDeleted | ( | ) |
Whether the content is deleted and thus not visible to the public.
Definition at line 567 of file DerivedPageDataUpdater.php.
References Revision\RevisionRecord\DELETED_TEXT, and revision.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), and MediaWiki\Storage\DerivedPageDataUpdater\isCountable().
MediaWiki\Storage\DerivedPageDataUpdater::isContentPrepared | ( | ) |
Whether prepareUpdate() or prepareContent() have been called on this instance.
Definition at line 539 of file DerivedPageDataUpdater.php.
References revision.
MediaWiki\Storage\DerivedPageDataUpdater::isCountable | ( | ) |
Definition at line 629 of file DerivedPageDataUpdater.php.
References $content, as, captcha-old\count, MediaWiki\Storage\DerivedPageDataUpdater\getCanonicalParserOutput(), MediaWiki\Storage\DerivedPageDataUpdater\getModifiedSlotRoles(), MediaWiki\Storage\DerivedPageDataUpdater\getRawContent(), MediaWiki\Storage\DerivedPageDataUpdater\getTitle(), MediaWiki\Storage\DerivedPageDataUpdater\isContentDeleted(), and MediaWiki\Storage\DerivedPageDataUpdater\isRedirect().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
MediaWiki\Storage\DerivedPageDataUpdater::isCreation | ( | ) |
Whether the edit creates the page.
Definition at line 928 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\assertPrepared(), and options().
MediaWiki\Storage\DerivedPageDataUpdater::isRedirect | ( | ) |
Definition at line 674 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\getRawContent(), and Revision\SlotRecord\MAIN.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\isCountable().
MediaWiki\Storage\DerivedPageDataUpdater::isReusableFor | ( | UserIdentity | $user = null , |
RevisionRecord | $revision = null , |
||
RevisionSlotsUpdate | $slotsUpdate = null , |
||
$parentId = null |
|||
) |
Checks whether this DerivedPageDataUpdater can be re-used for running updates targeting the given revision.
UserIdentity | null | $user | The user creating the revision in question |
RevisionRecord | null | $revision | New revision (after save, if already saved) |
RevisionSlotsUpdate | null | $slotsUpdate | New content (before PST) |
null | int | $parentId | Parent revision of the edit (use 0 for page creation) |
Definition at line 351 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$revision, MediaWiki\Storage\DerivedPageDataUpdater\$slotsUpdate, MediaWiki\Storage\DerivedPageDataUpdater\$user, Revision\RevisionRecord\getId(), MediaWiki\User\UserIdentity\getName(), Revision\RevisionRecord\getParentId(), Revision\RevisionRecord\getSlots(), MediaWiki\Storage\RevisionSlotsUpdate\hasSameUpdates(), revision, and user.
MediaWiki\Storage\DerivedPageDataUpdater::isUpdatePrepared | ( | ) |
Whether prepareUpdate() has been called on this instance.
Definition at line 550 of file DerivedPageDataUpdater.php.
References revision.
MediaWiki\Storage\DerivedPageDataUpdater::pageExisted | ( | ) |
Determines whether the page being edited already existed.
Only defined after calling grabCurrentRevision() or prepareContent() or prepareUpdate()!
LogicException | if called before grabCurrentRevision |
Definition at line 449 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\assertHasPageState().
MediaWiki\Storage\DerivedPageDataUpdater::prepareContent | ( | User | $user, |
RevisionSlotsUpdate | $slotsUpdate, | ||
$useStash = true |
|||
) |
Prepare updates based on an update which has not yet been saved.
This may be used to create derived data that is needed when creating a new revision; particularly, this makes available the slots of the new revision via the getSlots() method, after applying PST and slot inheritance.
The derived data prepared for revision creation may then later be re-used by doUpdates(), without the need to re-calculate.
User | $user | The user to act as context for pre-save transformation (PST). Type hint should be reduced to UserIdentity at some point. |
RevisionSlotsUpdate | $slotsUpdate | The new content of the slots to be updated by this edit, before PST. |
bool | $useStash | Whether to use stashed ParserOutput |
Definition at line 718 of file DerivedPageDataUpdater.php.
References $content, $output, MediaWiki\Storage\DerivedPageDataUpdater\$parentRevision, $parser, MediaWiki\Storage\DerivedPageDataUpdater\$slotsUpdate, $title, MediaWiki\Storage\DerivedPageDataUpdater\$user, MediaWiki\Storage\DerivedPageDataUpdater\$wikiPage, as, MediaWiki\Storage\DerivedPageDataUpdater\assertTransition(), ApiStashEdit\checkCache(), MediaWiki\Storage\DerivedPageDataUpdater\doTransition(), Title\equals(), Revision\RevisionRecord\getComment(), Revision\RevisionRecord\getId(), MediaWiki\Storage\RevisionSlotsUpdate\getModifiedRoles(), MediaWiki\Storage\RevisionSlotsUpdate\getModifiedSlot(), User\getName(), Revision\RevisionRecord\getPageId(), Revision\RevisionRecord\getParentId(), MediaWiki\Storage\RevisionSlotsUpdate\getRemovedRoles(), Revision\RevisionRecord\getSlots(), Revision\RevisionRecord\getTimestamp(), MediaWiki\Storage\DerivedPageDataUpdater\getTitle(), Revision\RevisionRecord\getUser(), Revision\RevisionRecord\getVisibility(), MediaWiki\Storage\DerivedPageDataUpdater\getWikiPage(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), Revision\RevisionRecord\hasSameContent(), Revision\RevisionRecord\isMinor(), MediaWiki\Storage\RevisionSlotsUpdate\isModifiedSlot(), Revision\SlotRecord\MAIN, User\newFromIdentity(), Revision\MutableRevisionRecord\newFromParentRevision(), ParserOptions\newFromUserAndLang(), Revision\SlotRecord\newUnsaved(), null, options(), Revision\RevisionRecord\RAW, revision, Hooks\run(), use, MediaWiki\Storage\DerivedPageDataUpdater\useMaster(), user, and wfTimestampNow().
MediaWiki\Storage\DerivedPageDataUpdater::prepareUpdate | ( | RevisionRecord | $revision, |
array | $options = [] |
||
) |
Prepare derived data updates targeting the given Revision.
Calling this method requires the given revision to be present in the database. This may be right after a new revision has been created, or when re-generating derived data e.g. in ApiPurge, RefreshLinksJob, and the refreshLinks script.
RevisionRecord | $revision | |
array | $options | Array of options, following indexes are used:
|
Definition at line 1071 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$options, $rev, MediaWiki\Storage\DerivedPageDataUpdater\$revision, MediaWiki\Storage\DerivedPageDataUpdater\$user, MediaWiki\Storage\DerivedPageDataUpdater\doTransition(), Revision\RevisionRecord\getId(), MediaWiki\User\UserIdentity\getName(), Revision\RevisionRecord\getParentId(), Revision\RevisionRecord\getSlots(), Revision\RevisionRecord\getUser(), options(), Revision\RevisionRecord\RAW, revision, MediaWiki\Storage\DerivedPageDataUpdater\useMaster(), and user.
|
private |
RevisionRecord | $rev |
Definition at line 687 of file DerivedPageDataUpdater.php.
References $rev, Revision\SlotRecord\MAIN, and Revision\RevisionRecord\RAW.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\wasRedirect().
MediaWiki\Storage\DerivedPageDataUpdater::setArticleCountMethod | ( | $articleCountMethod | ) |
string | $articleCountMethod | "any" or "link". |
Definition at line 414 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$articleCountMethod.
Referenced by WikiPage\newDerivedDataUpdater().
MediaWiki\Storage\DerivedPageDataUpdater::setRcWatchCategoryMembership | ( | $rcWatchCategoryMembership | ) |
bool | $rcWatchCategoryMembership |
Definition at line 422 of file DerivedPageDataUpdater.php.
References MediaWiki\Storage\DerivedPageDataUpdater\$rcWatchCategoryMembership.
Referenced by WikiPage\newDerivedDataUpdater().
|
private |
Definition at line 621 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getParentRevision(), MediaWiki\Storage\DerivedPageDataUpdater\prepareContent(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareUpdate().
MediaWiki\Storage\DerivedPageDataUpdater::wasRedirect | ( | ) |
Whether the page was a redirect before the edit.
Definition at line 952 of file DerivedPageDataUpdater.php.
References $rev, MediaWiki\Storage\DerivedPageDataUpdater\assertHasPageState(), and MediaWiki\Storage\DerivedPageDataUpdater\revisionIsRedirect().
|
private |
see $wgArticleCountMethod
Definition at line 141 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\setArticleCountMethod().
|
private |
Definition at line 121 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
|
private |
Definition at line 126 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
|
private |
Definition at line 136 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
|
private |
Definition at line 131 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
|
private |
Stores (most of) the $options parameter of prepareUpdate().
Definition at line 152 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doSecondaryDataUpdates(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareUpdate().
The state of the relevant row in page table before the edit.
This is determined by the first call to grabCurrentRevision, prepareContent, or prepareUpdate (so it is only accessible in 'knows-current' or a later stage). If pageState was not initialized when prepareUpdate() is called, prepareUpdate() will attempt to emulate the state of the page table before the edit.
Contains the following fields:
Definition at line 189 of file DerivedPageDataUpdater.php.
|
private |
Definition at line 199 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getParentRevision(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().
|
private |
Definition at line 111 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
see $wgRCWatchCategoryMembership
Definition at line 146 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\setRcWatchCategoryMembership().
|
private |
Definition at line 209 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getRenderedRevision(), and MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates().
|
private |
Definition at line 204 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getRevision(), MediaWiki\Storage\DerivedPageDataUpdater\isReusableFor(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareUpdate().
|
private |
Definition at line 214 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
|
private |
Definition at line 116 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
|
private |
Definition at line 217 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct().
|
private |
Definition at line 194 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getPreparedEdit(), MediaWiki\Storage\DerivedPageDataUpdater\getRevisionSlotsUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\isReusableFor(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().
|
private |
A stage identifier for managing the life cycle of this instance.
Possible stages are 'new', 'knows-current', 'has-content', 'has-revision', and 'done'.
Definition at line 227 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doTransition().
|
staticprivate |
Transition table for managing the life cycle of DerivedPageDateUpdater instances.
XXX: Overkill. This is a linear order, we could just count. Names are nice though, and constants are also overkill...
Definition at line 239 of file DerivedPageDataUpdater.php.
|
private |
Definition at line 101 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doSecondaryDataUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\isReusableFor(), MediaWiki\Storage\DerivedPageDataUpdater\prepareContent(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareUpdate().
|
private |
Definition at line 106 of file DerivedPageDataUpdater.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\__construct(), MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\getWikiPage(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().