MediaWiki REL1_40
|
Base representation for an editable wiki page. More...
Inherits Page, IDBAccessObject, and MediaWiki\Page\PageRecord.
Inherited by WikiCategoryPage, and WikiFilePage.
Public Member Functions | ||||
__clone () | ||||
Makes sure that the mTitle object is cloned to the newly cloned WikiPage. | ||||
__construct (PageIdentity $pageIdentity) | ||||
__toString () | ||||
Returns an informative human readable unique representation of the page identity, for use as a cache key and for logging and debugging.
| ||||
__wakeup () | ||||
Ensure consistency when unserializing. | ||||
canExist () | ||||
checkFlags ( $flags) | ||||
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed. | ||||
checkTouched () | ||||
Loads page_touched and returns a value indicating if it should be used. | ||||
clear () | ||||
Clear the object. | ||||
clearPreparedEdit () | ||||
Clear the mPreparedEdit cache field, as may be needed by mutable content types. | ||||
doDeleteArticleBatched ( $reason, $suppress, UserIdentity $deleter, $tags, $logsubtype, $immediate=false, $webRequestId=null) | ||||
Back-end article deletion. | ||||
doDeleteArticleReal ( $reason, UserIdentity $deleter, $suppress=false, $u1=null, &$error='', $u2=null, $tags=[], $logsubtype='delete', $immediate=false) | ||||
Back-end article deletion Deletes the article with database consistency, writes logs, purges caches. | ||||
doDeleteUpdates ( $id, Content $content=null, RevisionRecord $revRecord=null, UserIdentity $user=null) | ||||
Do some database updates after deletion. | ||||
doEditUpdates (RevisionRecord $revisionRecord, UserIdentity $user, array $options=[]) | ||||
Do standard deferred updates after page edit. | ||||
doPurge () | ||||
Perform the actions of a page purging. | ||||
doSecondaryDataUpdates (array $options=[]) | ||||
Do secondary data updates (such as updating link tables). | ||||
doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, UserIdentity $user, $tags=[]) | ||||
Update the article's restriction field, and leave a log entry. | ||||
doUserEditContent (Content $content, Authority $performer, $summary, $flags=0, $originalRevId=false, $tags=[], $undidRevId=0) | ||||
Change an existing article or create a new article. | ||||
doViewUpdates (Authority $performer, $oldid=0, RevisionRecord $oldRev=null) | ||||
Do standard deferred updates after page view (existing or missing page) | ||||
exists () | ||||
followRedirect () | ||||
Get the Title object or URL this page redirects to. | ||||
getActionOverrides () | ||||
getAutoDeleteReason (&$hasHistory=false) | ||||
Auto-generates a deletion reason. | ||||
getCategories () | ||||
Returns a list of categories this page is a member of. | ||||
getComment ( $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null) | ||||
getContent ( $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null) | ||||
Get the content of the current revision. | ||||
getContentHandler () | ||||
Returns the ContentHandler instance to be used to deal with the content of this WikiPage. | ||||
getContentModel () | ||||
Returns the page's content model id (see the CONTENT_MODEL_XXX constants). | ||||
getContributors () | ||||
Get a list of users who have edited this article, not including the user who made the most recent revision, which you can get from $article->getUser() if you want it. | ||||
getCreator ( $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null) | ||||
Get the User object of the user who created the page. | ||||
getCurrentUpdate () | ||||
Get the state of an ongoing update, shortly before or just after it is saved to the database. | ||||
getDBkey () | ||||
Get the page title in DB key form.This should always return a valid DB key.
| ||||
getDeletionUpdates ( $rev=null) | ||||
Returns a list of updates to be performed when this page is deleted. | ||||
getHiddenCategories () | ||||
Returns a list of hidden categories this page is a member of. | ||||
getId ( $wikiId=self::LOCAL) | ||||
getLanguage () | ||||
getLatest ( $wikiId=self::LOCAL) | ||||
Get the page_latest field. | ||||
getLinksTimestamp () | ||||
Get the page_links_updated field. | ||||
getMinorEdit () | ||||
Returns true if last revision was marked as "minor edit". | ||||
getNamespace () | ||||
Returns the page's namespace number.The value returned by this method should represent a valid namespace, but this cannot be guaranteed in all cases.
| ||||
getPageIsRedirectField () | ||||
Get the value of the page_is_redirect field in the DB. | ||||
getParserOutput (?ParserOptions $parserOptions=null, $oldid=null, $noCache=false) | ||||
Get a ParserOutput for the given ParserOptions and revision ID. | ||||
getRedirectTarget () | ||||
If this page is a redirect, get its target. | ||||
getRedirectURL ( $rt) | ||||
Get the Title object or URL to use for a redirect. | ||||
getRevisionRecord () | ||||
Get the latest revision. | ||||
getSourceURL () | ||||
Get the source URL for the content on this page, typically the canonical URL, but may be a remote link if the content comes from another site. | ||||
getTimestamp () | ||||
getTitle () | ||||
Get the title object of the article. | ||||
getTouched () | ||||
Get the page_touched field. | ||||
getUser ( $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null) | ||||
getUserText ( $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null) | ||||
getWikiDisplayName () | ||||
The display name for the site this content come from. | ||||
getWikiId () | ||||
hasViewableContent () | ||||
Check if this page is something we're going to be showing some sort of sensible content for. | ||||
insertNullProtectionRevision (string $revCommentMsg, array $limit, array $expiry, bool $cascade, string $reason, UserIdentity $user) | ||||
Insert a new null revision for this page. | ||||
insertOn ( $dbw, $pageId=null) | ||||
Insert a new empty page record for this article. | ||||
insertRedirect () | ||||
Insert an entry for this page into the redirect table if the content is a redirect. | ||||
insertRedirectEntry (LinkTarget $rt, $oldLatest=null) | ||||
Insert or update the redirect table entry for this page to indicate it redirects to $rt. | ||||
isBatchedDelete ( $safetyMargin=0) | ||||
Determines if deletion of this page would be batched (executed over time by the job queue) or not (completed in the same request as the delete call). | ||||
isCountable ( $editInfo=false) | ||||
Determine whether a page would be suitable for being counted as an article in the site_stats table based on the title & its content. | ||||
isLocal () | ||||
Whether this content displayed on this page comes from the local database. | ||||
isNew () | ||||
Tests if the page is new (only has one revision). | ||||
isRedirect () | ||||
Is the page a redirect, according to secondary tracking tables? If this is true, getRedirectTarget() will return a Title. | ||||
isSamePageAs (PageReference $other) | ||||
Checks whether the given PageReference refers to the same page as this PageReference.Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.
| ||||
loadFromRow ( $data, $from) | ||||
Load the object from a database row. | ||||
loadPageData ( $from='fromdb') | ||||
Load the object from a given source by title. | ||||
lockAndGetLatest () | ||||
Lock the page row for this title+id and return page_latest (or 0) | ||||
makeParserOptions ( $context) | ||||
Get parser options suitable for rendering the primary article wikitext. | ||||
newPageUpdater ( $performer, RevisionSlotsUpdate $forUpdate=null) | ||||
Returns a PageUpdater for creating new revisions on this page (or creating the page). | ||||
pageDataFromId ( $dbr, $id, $options=[]) | ||||
Fetch a page record matching the requested ID. | ||||
pageDataFromTitle ( $dbr, $title, $options=[]) | ||||
Fetch a page record matching the Title object's namespace and title using a sanitized title string. | ||||
prepareContentForEdit (Content $content, ?RevisionRecord $revision, UserIdentity $user, $serialFormat=null, $useStash=true) | ||||
Prepare content which is about to be saved. | ||||
protectDescription (array $limit, array $expiry) | ||||
Builds the description to serve as comment for the edit. | ||||
protectDescriptionLog (array $limit, array $expiry) | ||||
Builds the description to serve as comment for the log entry. | ||||
replaceSectionAtRev ( $sectionId, Content $sectionContent, $sectionTitle='', $baseRevId=null) | ||||
replaceSectionContent ( $sectionId, Content $sectionContent, $sectionTitle='', $edittime=null) | ||||
setTimestamp ( $ts) | ||||
Set the page timestamp (use only to avoid DB queries) | ||||
shouldCheckParserCache (ParserOptions $parserOptions, $oldId) | ||||
Should the parser cache be used? | ||||
supportsSections () | ||||
Returns true if this page's content model supports sections. | ||||
toPageRecord () | ||||
Returns the page represented by this WikiPage as a PageStoreRecord. | ||||
triggerOpportunisticLinksUpdate (ParserOutput $parserOutput) | ||||
Opportunistically enqueue link update jobs after a fresh parser output was generated. | ||||
updateCategoryCounts (array $added, array $deleted, $id=0) | ||||
Update all the appropriate counts in the category table, given that we've added the categories $added and deleted the categories $deleted. | ||||
updateParserCache (array $options=[]) | ||||
Update the parser cache. | ||||
updateRedirectOn ( $dbw, $redirectTitle, $lastRevIsRedirect=null) | ||||
Add row to the redirect table if this is a redirect, remove otherwise. | ||||
updateRevisionOn ( $dbw, RevisionRecord $revision, $lastRevision=null, $lastRevIsRedirect=null) | ||||
Update the page record to point to a newly saved revision. | ||||
wasLoadedFrom ( $from) | ||||
Checks whether the page data was loaded using the given database access mode (or better). | ||||
Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity | ||||
assertWiki ( $wikiId) | ||||
Throws if $wikiId is different from the return value of getWikiId(). | ||||
Static Public Member Functions | |
static | convertSelectType ( $type) |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants. | |
static | factory (PageIdentity $pageIdentity) |
Create a WikiPage object of the appropriate class for the given PageIdentity. | |
static | getQueryInfo () |
Return the tables, fields, and join conditions to be selected to create a new page object. | |
static | hasDifferencesOutsideMainSlot (RevisionRecord $a, RevisionRecord $b) |
Helper method for checking whether two revisions have differences that go beyond the main slot. | |
static | makeParserOptionsFromTitleAndModel (PageReference $pageRef, string $contentModel, $context) |
Create canonical parser options for a given title and content model. | |
static | newFromID ( $id, $from='fromdb') |
Constructor from a page id. | |
static | newFromRow ( $row, $from='fromdb') |
Constructor from a database row. | |
static | onArticleCreate (Title $title) |
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of the specified actions are done. | |
static | onArticleDelete (Title $title) |
Clears caches when article is deleted. | |
static | onArticleEdit (Title $title, RevisionRecord $revRecord=null, $slotsChanged=null) |
Purge caches on page update etc. | |
Protected Member Functions | |
clearCacheFields () | |
Clear the object cache fields. | |
formatExpiry ( $expiry) | |
loadLastEdit () | |
Loads everything except the text This isn't necessary for all uses, so it's only done if needed. | |
pageData ( $dbr, $conditions, $options=[]) | |
Fetch a page record with the given conditions. | |
Protected Attributes | |
bool | $mDataLoaded = false |
int | $mDataLoadedFrom = self::READ_NONE |
One of the READ_* constants. | |
int null | $mId = null |
string null | $mLanguage = null |
int false | $mLatest = false |
False means "not loaded". | |
string | $mLinksUpdated = '19700101000000' |
PreparedEdit false | $mPreparedEdit = false |
Map of cache fields (text, parser output, ect) for a proposed/new edit. | |
Title null | $mRedirectTarget = null |
The cache of the redirect target. | |
string | $mTimestamp = '' |
Timestamp of the current revision or empty string if not loaded. | |
Title | $mTitle |
string | $mTouched = '19700101000000' |
Additional Inherited Members | |
Public Attributes inherited from IDBAccessObject | |
const | READ_NONE = -1 |
Constants for object loading bitfield flags (higher => higher QoS) | |
Base representation for an editable wiki page.
Some fields are public only for backwards-compatibility. Use accessor methods. In the past, this class was part of Article.php and everything was public.
Definition at line 75 of file WikiPage.php.
WikiPage::__construct | ( | PageIdentity | $pageIdentity | ) |
PageIdentity | $pageIdentity |
Definition at line 180 of file WikiPage.php.
References $title, and MediaWiki\DAO\WikiAwareEntity\assertWiki().
WikiPage::__clone | ( | ) |
Makes sure that the mTitle object is cloned to the newly cloned WikiPage.
Definition at line 197 of file WikiPage.php.
References $mTitle.
WikiPage::__toString | ( | ) |
Returns an informative human readable unique representation of the page identity, for use as a cache key and for logging and debugging.
Implements MediaWiki\Page\PageReference.
Definition at line 3326 of file WikiPage.php.
WikiPage::__wakeup | ( | ) |
Ensure consistency when unserializing.
Definition at line 3281 of file WikiPage.php.
WikiPage::canExist | ( | ) |
Implements MediaWiki\Page\ProperPageIdentity.
Definition at line 3318 of file WikiPage.php.
WikiPage::checkFlags | ( | $flags | ) |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
int | $flags |
Definition at line 1686 of file WikiPage.php.
References EDIT_NEW, and EDIT_UPDATE.
WikiPage::checkTouched | ( | ) |
Loads page_touched and returns a value indicating if it should be used.
Definition at line 714 of file WikiPage.php.
WikiPage::clear | ( | ) |
|
protected |
WikiPage::clearPreparedEdit | ( | ) |
Clear the mPreparedEdit cache field, as may be needed by mutable content types.
Definition at line 361 of file WikiPage.php.
|
static |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
stdClass | string | int | $type |
Definition at line 255 of file WikiPage.php.
References $type.
WikiPage::doDeleteArticleBatched | ( | $reason, | |
$suppress, | |||
UserIdentity | $deleter, | ||
$tags, | |||
$logsubtype, | |||
$immediate = false, | |||
$webRequestId = null ) |
Back-end article deletion.
Only invokes batching via the job queue if necessary per $wgDeleteRevisionsBatchSize. Deletions can often be completed inline without involving the job queue.
Potentially called many times per deletion operation for pages with many revisions.
string | $reason | |
bool | $suppress | |
UserIdentity | $deleter | |
string[] | $tags | |
string | $logsubtype | |
bool | $immediate | |
string | null | $webRequestId |
Definition at line 2693 of file WikiPage.php.
References getTitle(), and wfEscapeWikiText().
WikiPage::doDeleteArticleReal | ( | $reason, | |
UserIdentity | $deleter, | ||
$suppress = false, | |||
$u1 = null, | |||
& | $error = '', | ||
$u2 = null, | |||
$tags = [], | |||
$logsubtype = 'delete', | |||
$immediate = false ) |
Back-end article deletion Deletes the article with database consistency, writes logs, purges caches.
string | $reason | Delete reason for deletion log |
UserIdentity | $deleter | The deleting user |
bool | $suppress | Suppress all revisions and log the deletion in the suppression log instead of the deletion log |
bool | null | $u1 | Unused |
array | string | &$error | Array of errors to append to |
mixed | $u2 | Unused |
string[] | null | $tags | Tags to apply to the deletion action |
string | $logsubtype | |
bool | $immediate | false allows deleting over time via the job queue |
Definition at line 2646 of file WikiPage.php.
References getTitle(), and wfEscapeWikiText().
WikiPage::doDeleteUpdates | ( | $id, | |
Content | $content = null, | ||
RevisionRecord | $revRecord = null, | ||
UserIdentity | $user = null ) |
Do some database updates after deletion.
int | $id | The page_id value of the page being deleted |
Content | null | $content | Page content to be used when determining the required updates. This may be needed because $this->getContent() may already return null when the page proper was deleted. |
RevisionRecord | null | $revRecord | The current page revision at the time of deletion, used when determining the required updates. This may be needed because $this->getRevisionRecord() may already return null when the page proper was deleted. |
UserIdentity | null | $user | The user that caused the deletion |
Definition at line 2756 of file WikiPage.php.
References wfDeprecated().
WikiPage::doEditUpdates | ( | RevisionRecord | $revisionRecord, |
UserIdentity | $user, | ||
array | $options = [] ) |
Do standard deferred updates after page edit.
Update links tables, site stats, search index and message cache. Purges pages that include this page if the text was changed here. Every 100th edit, prune the recent changes table.
RevisionRecord | $revisionRecord | (Switched from the old Revision class to RevisionRecord since 1.35) |
UserIdentity | $user | User object that did the revision |
array | $options | Array of options, following indexes are used:
|
Definition at line 2060 of file WikiPage.php.
References MediaWiki\User\UserIdentity\getName().
WikiPage::doPurge | ( | ) |
Perform the actions of a page purging.
Reimplemented in WikiCategoryPage, and WikiFilePage.
Definition at line 1359 of file WikiPage.php.
References NS_MEDIAWIKI.
WikiPage::doSecondaryDataUpdates | ( | array | $options = [] | ) |
Do secondary data updates (such as updating link tables).
Secondary data updates are only a small part of the updates needed after saving a new revision; normally PageUpdater::doUpdates should be used instead (which includes secondary data updates). This method is provided for partial purges.
array | $options |
|
Definition at line 2132 of file WikiPage.php.
WikiPage::doUpdateRestrictions | ( | array | $limit, |
array | $expiry, | ||
& | $cascade, | ||
$reason, | |||
UserIdentity | $user, | ||
$tags = [] ) |
Update the article's restriction field, and leave a log entry.
This works for protection both existing and non-existing pages.
array | $limit | Set of restriction keys |
array | $expiry | Per restriction type expiration |
bool | &$cascade | Set to false if cascading protection isn't allowed. |
string | $reason | |
UserIdentity | $user | The user updating the restrictions |
string[] | $tags | Change tags to add to the pages and protection log entries ($user should be able to add the specified tags before this is called) |
Definition at line 2162 of file WikiPage.php.
References DB_PRIMARY, MediaWiki\User\UserIdentity\getId(), wfGetDB(), and wfMessage().
WikiPage::doUserEditContent | ( | Content | $content, |
Authority | $performer, | ||
$summary, | |||
$flags = 0, | |||
$originalRevId = false, | |||
$tags = [], | |||
$undidRevId = 0 ) |
Change an existing article or create a new article.
Updates RC and all necessary caches, optionally via the deferred update array.
Content | $content | New content |
Authority | $performer | doing the edit |
string | CommentStoreComment | $summary | Edit summary |
int | $flags | Bitfield: EDIT_NEW Article is known or assumed to be non-existent, create a new one EDIT_UPDATE Article is known or assumed to be pre-existing, update it EDIT_MINOR Mark this edit minor, if the user is allowed to do so EDIT_SUPPRESS_RC Do not log the change in recentchanges EDIT_FORCE_BOT Mark the edit a "bot" edit regardless of user rights EDIT_AUTOSUMMARY Fill in blank summaries with generated text where possible EDIT_INTERNAL Signal that the page retrieve/save cycle happened entirely in this request. |
If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the article will be detected. If EDIT_UPDATE is specified and the article doesn't exist, the function will return an edit-gone-missing error. If EDIT_NEW is specified and the article does exist, an edit-already-exists error will be returned. These two conditions are also possible with auto-detection due to MediaWiki's performance-optimised locking strategy.
int | false | $originalRevId, | The ID of an original revision that the edit restores or repeats. The new revision is expected to have the exact same content as the given original revision. This is used with rollbacks and with dummy "null" revisions which are created to record things like page moves. |
array | null | $tags | Change tags to apply to this edit Callers are responsible for permission checks (with ChangeTags::canAddTagsAccompanyingChange) |
int | $undidRevId | Id of revision that was undone or 0 |
MWException |
Extensions may define additional errors.
$return->value will contain an associative array with members as follows: new: Boolean indicating if the function attempted to create a new article. revision-record: The revision record object for the inserted revision, or null.
Definition at line 1862 of file WikiPage.php.
WikiPage::doViewUpdates | ( | Authority | $performer, |
$oldid = 0, | |||
RevisionRecord | $oldRev = null ) |
Do standard deferred updates after page view (existing or missing page)
Authority | $performer | The viewing user |
int | $oldid | Revision id being viewed; if not given or 0, latest revision is assumed |
RevisionRecord | null | $oldRev | The RevisionRecord associated with $oldid. |
Definition at line 1313 of file WikiPage.php.
WikiPage::exists | ( | ) |
Implements MediaWiki\Page\PageIdentity.
Definition at line 600 of file WikiPage.php.
Referenced by MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\__construct(), and MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates().
|
static |
Create a WikiPage object of the appropriate class for the given PageIdentity.
The PageIdentity must represent a proper page that can exist on the wiki, that is, not a special page or media link or section link or interwiki link.
PageIdentity | $pageIdentity |
Definition at line 211 of file WikiPage.php.
References wfDeprecated().
WikiPage::followRedirect | ( | ) |
Get the Title object or URL this page redirects to.
Reimplemented in WikiFilePage.
Definition at line 1156 of file WikiPage.php.
|
protected |
string | $expiry | 14-char timestamp or "infinity", or false if the input was invalid |
Definition at line 2515 of file WikiPage.php.
References wfMessage().
WikiPage::getActionOverrides | ( | ) |
Reimplemented in WikiFilePage.
Definition at line 296 of file WikiPage.php.
WikiPage::getAutoDeleteReason | ( | & | $hasHistory = false | ) |
Auto-generates a deletion reason.
bool | &$hasHistory | Whether the page has a history |
Definition at line 3015 of file WikiPage.php.
References getTitle(), and wfDeprecated().
WikiPage::getCategories | ( | ) |
Returns a list of categories this page is a member of.
Results will include hidden categories
Definition at line 2962 of file WikiPage.php.
References $dbr, $res, DB_REPLICA, NS_CATEGORY, and wfGetDB().
WikiPage::getComment | ( | $audience = RevisionRecord::FOR_PUBLIC, | |
Authority | $performer = null ) |
int | $audience | One of: RevisionRecord::FOR_PUBLIC to be displayed to all users RevisionRecord::FOR_THIS_USER to be displayed to the given user RevisionRecord::RAW get the text regardless of permissions |
Authority | null | $performer | object to check for, only if FOR_THIS_USER is passed to the $audience parameter (since 1.36, if using FOR_THIS_USER and not specifying a user no fallback is provided and the RevisionRecord method will throw an error) |
Definition at line 938 of file WikiPage.php.
WikiPage::getContent | ( | $audience = RevisionRecord::FOR_PUBLIC, | |
Authority | $performer = null ) |
Get the content of the current revision.
No side-effects...
int | $audience | One of: RevisionRecord::FOR_PUBLIC to be displayed to all users RevisionRecord::FOR_THIS_USER to be displayed to the given user RevisionRecord::RAW get the text regardless of permissions |
Authority | null | $performer | object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 838 of file WikiPage.php.
Referenced by TextContentHandler\getDataForSearchIndex().
WikiPage::getContentHandler | ( | ) |
Returns the ContentHandler instance to be used to deal with the content of this WikiPage.
Shorthand for ContentHandler::getForModelID( $this->getContentModel() );
Definition at line 309 of file WikiPage.php.
WikiPage::getContentModel | ( | ) |
Returns the page's content model id (see the CONTENT_MODEL_XXX constants).
Will use the revisions actual content model if the page exists, and the page's default if the page doesn't exist yet.
Definition at line 675 of file WikiPage.php.
WikiPage::getContributors | ( | ) |
Get a list of users who have edited this article, not including the user who made the most recent revision, which you can get from $article->getUser() if you want it.
Definition at line 1208 of file WikiPage.php.
References $dbr, $res, DB_REPLICA, getUser(), User\newFromId(), User\newFromName(), and wfGetDB().
WikiPage::getCreator | ( | $audience = RevisionRecord::FOR_PUBLIC, | |
Authority | $performer = null ) |
Get the User object of the user who created the page.
int | $audience | One of: RevisionRecord::FOR_PUBLIC to be displayed to all users RevisionRecord::FOR_THIS_USER to be displayed to the given user RevisionRecord::RAW get the text regardless of permissions |
Authority | null | $performer | object to check for, only if FOR_THIS_USER is passed to the $audience parameter (since 1.36, if using FOR_THIS_USER and not specifying a user no fallback is provided and the RevisionRecord method will throw an error) |
Definition at line 898 of file WikiPage.php.
References getTitle(), and MediaWiki\Revision\RevisionRecord\getUser().
WikiPage::getCurrentUpdate | ( | ) |
Get the state of an ongoing update, shortly before or just after it is saved to the database.
If there is no ongoing edit tracked by this WikiPage instance, this methods throws a PreconditionException.
If possible, state is shared with subsequent calls of getPreparedUpdate(), prepareContentForEdit(), and newPageUpdater().
PreconditionException | if there is no ongoing update. This method must only be called after newPageUpdater() had already been called, typically while executing a handler for a hook that is triggered during a page edit. |
Definition at line 2433 of file WikiPage.php.
WikiPage::getDBkey | ( | ) |
Get the page title in DB key form.This should always return a valid DB key.
Implements MediaWiki\Page\ProperPageIdentity.
Definition at line 3302 of file WikiPage.php.
WikiPage::getDeletionUpdates | ( | $rev = null | ) |
Returns a list of updates to be performed when this page is deleted.
The updates should remove any information about this page from secondary data stores such as links tables.
RevisionRecord | Content | null | $rev | The revision being deleted. Also accepts a Content object for backwards compatibility. |
Definition at line 3200 of file WikiPage.php.
References wfDebug(), and wfDeprecated().
WikiPage::getHiddenCategories | ( | ) |
Returns a list of hidden categories this page is a member of.
Uses the page_props and categorylinks tables.
Definition at line 2984 of file WikiPage.php.
References $dbr, $res, DB_REPLICA, NS_CATEGORY, and wfGetDB().
WikiPage::getId | ( | $wikiId = self::LOCAL | ) |
string | false | $wikiId |
Implements MediaWiki\Page\ProperPageIdentity.
Definition at line 588 of file WikiPage.php.
Referenced by MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\__construct(), MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate(), and ContentHandler\getDataForSearchIndex().
WikiPage::getLanguage | ( | ) |
Implements MediaWiki\Page\PageRecord.
Definition at line 732 of file WikiPage.php.
WikiPage::getLatest | ( | $wikiId = self::LOCAL | ) |
Get the page_latest field.
string | false | $wikiId |
Implements MediaWiki\Page\PageRecord.
Definition at line 756 of file WikiPage.php.
WikiPage::getLinksTimestamp | ( | ) |
Get the page_links_updated field.
Definition at line 744 of file WikiPage.php.
WikiPage::getMinorEdit | ( | ) |
Returns true if last revision was marked as "minor edit".
Definition at line 953 of file WikiPage.php.
WikiPage::getNamespace | ( | ) |
Returns the page's namespace number.The value returned by this method should represent a valid namespace, but this cannot be guaranteed in all cases.
Implements MediaWiki\Page\PageReference.
Definition at line 3294 of file WikiPage.php.
WikiPage::getPageIsRedirectField | ( | ) |
Get the value of the page_is_redirect field in the DB.
This is probably not what you want. Use WikiPage::isRedirect() to test if the page is a redirect. Use Title::isRedirect() for a fast check for the purposes of linking to a page.
Definition at line 642 of file WikiPage.php.
WikiPage::getParserOutput | ( | ?ParserOptions | $parserOptions = null, |
$oldid = null, | |||
$noCache = false ) |
Get a ParserOutput for the given ParserOptions and revision ID.
The parser cache will be used if possible. Cache misses that result in parser runs are debounced with PoolCounter.
XXX merge this with updateParserCache()?
ParserOptions | null | $parserOptions | ParserOptions to use for the parse operation |
null | int | $oldid | Revision ID to get the text from, passing null or 0 will get the current revision (default value) |
bool | $noCache | Do not read from or write to caches. |
Definition at line 1282 of file WikiPage.php.
References getTitle().
Referenced by DifferenceEngine\getParserOutput().
|
static |
Return the tables, fields, and join conditions to be selected to create a new page object.
$table
to IDatabase->select()
or SelectQueryBuilder::tables
$vars
to IDatabase->select()
or SelectQueryBuilder::fields
$join_conds
to IDatabase->select()
or SelectQueryBuilder::joinConds
Definition at line 375 of file WikiPage.php.
WikiPage::getRedirectTarget | ( | ) |
If this page is a redirect, get its target.
The target will be fetched from the redirect table if possible. If this page doesn't have an entry there, call insertRedirect()
Reimplemented in WikiFilePage.
Definition at line 1032 of file WikiPage.php.
References $dbr, DB_REPLICA, NS_FILE, NS_MEDIA, and wfGetDB().
WikiPage::getRedirectURL | ( | $rt | ) |
Get the Title object or URL to use for a redirect.
We use Title objects for same-wiki, non-special redirects and URLs for everything else.
Title | $rt | Redirect target |
Definition at line 1167 of file WikiPage.php.
References $source.
WikiPage::getRevisionRecord | ( | ) |
Get the latest revision.
Definition at line 820 of file WikiPage.php.
Referenced by ContentHandler\getDataForSearchIndex(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), and ContentHandler\latestRevision().
WikiPage::getSourceURL | ( | ) |
Get the source URL for the content on this page, typically the canonical URL, but may be a remote link if the content comes from another site.
Reimplemented in WikiFilePage.
Definition at line 3271 of file WikiPage.php.
References getTitle().
WikiPage::getTimestamp | ( | ) |
Definition at line 849 of file WikiPage.php.
WikiPage::getTitle | ( | ) |
Get the title object of the article.
Definition at line 318 of file WikiPage.php.
Referenced by MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\__construct(), TextContentHandler\getDataForSearchIndex(), FileContentHandler\getDataForSearchIndex(), WikitextContentHandler\getDataForSearchIndex(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), ContentHandler\latestRevision(), Article\newFromWikiPage(), CategoryMembershipChangeJob\notifyUpdatesForRevision(), DerivativeContext\setWikiPage(), and RequestContext\setWikiPage().
WikiPage::getTouched | ( | ) |
Get the page_touched field.
Implements MediaWiki\Page\PageRecord.
Definition at line 722 of file WikiPage.php.
WikiPage::getUser | ( | $audience = RevisionRecord::FOR_PUBLIC, | |
Authority | $performer = null ) |
int | $audience | One of: RevisionRecord::FOR_PUBLIC to be displayed to all users RevisionRecord::FOR_THIS_USER to be displayed to the given user RevisionRecord::RAW get the text regardless of permissions |
Authority | null | $performer | object to check for, only if FOR_THIS_USER is passed to the $audience parameter (since 1.36, if using FOR_THIS_USER and not specifying a user no fallback is provided and the RevisionRecord method will throw an error) |
Definition at line 877 of file WikiPage.php.
WikiPage::getUserText | ( | $audience = RevisionRecord::FOR_PUBLIC, | |
Authority | $performer = null ) |
int | $audience | One of: RevisionRecord::FOR_PUBLIC to be displayed to all users RevisionRecord::FOR_THIS_USER to be displayed to the given user RevisionRecord::RAW get the text regardless of permissions |
Authority | null | $performer | object to check for, only if FOR_THIS_USER is passed to the $audience parameter (since 1.36, if using FOR_THIS_USER and not specifying a user no fallback is provided and the RevisionRecord method will throw an error) |
Definition at line 917 of file WikiPage.php.
WikiPage::getWikiDisplayName | ( | ) |
The display name for the site this content come from.
If a subclass overrides isLocal(), this could return something other than the current site name
Reimplemented in WikiFilePage.
Definition at line 3257 of file WikiPage.php.
WikiPage::getWikiId | ( | ) |
Implements MediaWiki\Page\ProperPageIdentity.
Definition at line 3310 of file WikiPage.php.
References getTitle().
|
static |
Helper method for checking whether two revisions have differences that go beyond the main slot.
MCR migration note: this method should go away!
RevisionRecord | $a | |
RevisionRecord | $b |
Definition at line 1565 of file WikiPage.php.
References MediaWiki\Revision\RevisionRecord\getSlots().
WikiPage::hasViewableContent | ( | ) |
Check if this page is something we're going to be showing some sort of sensible content for.
If we return false, page views (plain action=view) will return an HTTP 404 response, so spiders and robots can know they're following a bad link.
Reimplemented in WikiCategoryPage.
Definition at line 615 of file WikiPage.php.
WikiPage::insertNullProtectionRevision | ( | string | $revCommentMsg, |
array | $limit, | ||
array | $expiry, | ||
bool | $cascade, | ||
string | $reason, | ||
UserIdentity | $user ) |
Insert a new null revision for this page.
string | $revCommentMsg | Comment message key for the revision |
array | $limit | Set of restriction keys |
array | $expiry | Per restriction type expiration |
bool | $cascade | Set to false if cascading protection isn't allowed. |
string | $reason | |
UserIdentity | $user | User to attribute to |
Definition at line 2455 of file WikiPage.php.
References wfMessage().
WikiPage::insertOn | ( | $dbw, | |
$pageId = null ) |
Insert a new empty page record for this article.
This must be followed up by creating a revision and running $this->updateRevisionOn( ... ); or else the record will be left in a funky state. Best if all done inside a transaction.
IDatabase | $dbw | |
int | null | $pageId | Custom page ID that will be used for the insert statement |
Definition at line 1394 of file WikiPage.php.
References wfRandom().
WikiPage::insertRedirect | ( | ) |
Insert an entry for this page into the redirect table if the content is a redirect.
The database update will be deferred via DeferredUpdates
Don't call this function directly unless you know what you're doing.
Definition at line 1085 of file WikiPage.php.
References $content, DB_PRIMARY, and wfGetDB().
WikiPage::insertRedirectEntry | ( | LinkTarget | $rt, |
$oldLatest = null ) |
Insert or update the redirect table entry for this page to indicate it redirects to $rt.
LinkTarget | $rt | Redirect target |
int | null | $oldLatest | Prior page_latest for check and set |
Definition at line 1111 of file WikiPage.php.
References $success, DB_PRIMARY, MediaWiki\Linker\LinkTarget\getDBkey(), MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getInterwiki(), MediaWiki\Linker\LinkTarget\getNamespace(), and wfGetDB().
WikiPage::isBatchedDelete | ( | $safetyMargin = 0 | ) |
Determines if deletion of this page would be batched (executed over time by the job queue) or not (completed in the same request as the delete call).
It is unlikely but possible that an edit from another request could push the page over the batching threshold after this function is called, but before the caller acts upon the return value. Callers must decide for themselves how to deal with this. $safetyMargin is provided as an unreliable but situationally useful help for some common cases.
int | $safetyMargin | Added to the revision count when checking for batching |
Definition at line 2607 of file WikiPage.php.
References $dbr, DB_REPLICA, and wfGetDB().
WikiPage::isCountable | ( | $editInfo = false | ) |
Determine whether a page would be suitable for being counted as an article in the site_stats table based on the title & its content.
PreparedEdit | PreparedUpdate | false | $editInfo | (false): An object returned by prepareTextForEdit() or getCurrentUpdate() respectively; If false is given, the current database state will be used. |
Definition at line 972 of file WikiPage.php.
References $content, DB_REPLICA, and wfGetDB().
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision().
WikiPage::isLocal | ( | ) |
Whether this content displayed on this page comes from the local database.
Reimplemented in WikiFilePage.
Definition at line 3244 of file WikiPage.php.
WikiPage::isNew | ( | ) |
Tests if the page is new (only has one revision).
May produce false negatives for some old pages.
Implements MediaWiki\Page\PageRecord.
Definition at line 657 of file WikiPage.php.
WikiPage::isRedirect | ( | ) |
Is the page a redirect, according to secondary tracking tables? If this is true, getRedirectTarget() will return a Title.
Implements MediaWiki\Page\PageRecord.
Reimplemented in WikiFilePage.
Definition at line 625 of file WikiPage.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision().
WikiPage::isSamePageAs | ( | PageReference | $other | ) |
Checks whether the given PageReference refers to the same page as this PageReference.Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.
PageReference | $other |
PageReference | $other |
Implements MediaWiki\Page\PageReference.
Definition at line 3337 of file WikiPage.php.
WikiPage::loadFromRow | ( | $data, | |
$from ) |
Load the object from a database row.
stdClass | false | $data | DB row containing fields returned by getQueryInfo() or false |
string | int | $from | One of the following:
|
Definition at line 545 of file WikiPage.php.
|
protected |
Loads everything except the text This isn't necessary for all uses, so it's only done if needed.
Definition at line 769 of file WikiPage.php.
References getTitle().
WikiPage::loadPageData | ( | $from = 'fromdb' | ) |
Load the object from a given source by title.
stdClass | string | int | $from | One of the following:
|
Definition at line 474 of file WikiPage.php.
References DB_REPLICA.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), and ContentHandler\latestRevision().
WikiPage::lockAndGetLatest | ( | ) |
Lock the page row for this title+id and return page_latest (or 0)
Definition at line 2726 of file WikiPage.php.
References DB_PRIMARY, getTitle(), and wfGetDB().
WikiPage::makeParserOptions | ( | $context | ) |
Get parser options suitable for rendering the primary article wikitext.
IContextSource | UserIdentity | string | $context | One of the following:
|
Definition at line 1946 of file WikiPage.php.
References getTitle().
Referenced by DifferenceEngine\getParserOutput(), and ContentHandler\getParserOutputForIndexing().
|
static |
Create canonical parser options for a given title and content model.
PageReference | $pageRef | |
string | $contentModel | |
IContextSource | UserIdentity | string | $context | See ::makeParserOptions |
Definition at line 1960 of file WikiPage.php.
References $title, and CONTENT_MODEL_WIKITEXT.
|
static |
Constructor from a page id.
int | $id | Article ID to load |
string | int | $from | One of the following values:
|
Definition at line 227 of file WikiPage.php.
References wfDeprecated().
|
static |
Constructor from a database row.
stdClass | $row | Database row containing at least fields returned by getQueryInfo(). |
string | int | $from | Source of $data:
|
Definition at line 244 of file WikiPage.php.
References wfDeprecated().
WikiPage::newPageUpdater | ( | $performer, | |
RevisionSlotsUpdate | $forUpdate = null ) |
Returns a PageUpdater for creating new revisions on this page (or creating the page).
The PageUpdater can also be used to detect the need for edit conflict resolution, and to protected such conflict resolution from concurrent edits using a check-and-set mechanism.
Authority | UserIdentity | $performer | |
RevisionSlotsUpdate | null | $forUpdate | If given, allows any cached ParserOutput that may already have been returned via getDerivedDataUpdater to be re-used. |
Definition at line 1787 of file WikiPage.php.
|
static |
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of the specified actions are done.
This is a good place to put code to clear caches, for instance.
This is called on page move and undelete, as well as edit
Title | $title |
Definition at line 2791 of file WikiPage.php.
References $job, $title, and NS_CATEGORY.
|
static |
Clears caches when article is deleted.
Title | $title |
Definition at line 2828 of file WikiPage.php.
References $job, $title, User\newFromName(), NS_FILE, NS_MEDIAWIKI, and NS_USER_TALK.
|
static |
Purge caches on page update etc.
Title | $title | |
RevisionRecord | null | $revRecord | revision that was just saved, may be null |
string[] | null | $slotsChanged | The role names of the slots that were changed. If not given, all slots are assumed to have changed. |
Definition at line 2884 of file WikiPage.php.
References $title, and MediaWiki\Revision\RevisionRecord\getId().
|
protected |
Fetch a page record with the given conditions.
IDatabase | $dbr | |
array | $conditions | |
array | $options |
Definition at line 411 of file WikiPage.php.
References $dbr.
WikiPage::pageDataFromId | ( | $dbr, | |
$id, | |||
$options = [] ) |
Fetch a page record matching the requested ID.
IDatabase | $dbr | |
int | $id | |
array | $options |
Definition at line 458 of file WikiPage.php.
References $dbr.
WikiPage::pageDataFromTitle | ( | $dbr, | |
$title, | |||
$options = [] ) |
Fetch a page record matching the Title object's namespace and title using a sanitized title string.
IDatabase | $dbr | |
Title | $title | |
array | $options |
Definition at line 440 of file WikiPage.php.
WikiPage::prepareContentForEdit | ( | Content | $content, |
?RevisionRecord | $revision, | ||
UserIdentity | $user, | ||
$serialFormat = null, | |||
$useStash = true ) |
Prepare content which is about to be saved.
Prior to 1.30, this returned a stdClass.
Content | $content | |
RevisionRecord | null | $revision | Used with vary-revision or vary-revision-id. |
UserIdentity | $user | |
string | null | $serialFormat | IGNORED |
bool | $useStash | Use prepared edit stash |
Definition at line 2005 of file WikiPage.php.
References $content, and MediaWiki\User\UserIdentity\getName().
WikiPage::protectDescription | ( | array | $limit, |
array | $expiry ) |
Builds the description to serve as comment for the edit.
array | $limit | Set of restriction keys |
array | $expiry | Per restriction type expiration |
Definition at line 2537 of file WikiPage.php.
References wfMessage().
WikiPage::protectDescriptionLog | ( | array | $limit, |
array | $expiry ) |
Builds the description to serve as comment for the log entry.
Some bots may parse IRC lines, which are generated from log entries which contain plain protect description text. Keep them in old format to avoid breaking compatibility. TODO: Fix protection log to store structured description and format it on-the-fly.
array | $limit | Set of restriction keys |
array | $expiry | Per restriction type expiration |
Definition at line 2579 of file WikiPage.php.
WikiPage::replaceSectionAtRev | ( | $sectionId, | |
Content | $sectionContent, | ||
$sectionTitle = '', | |||
$baseRevId = null ) |
string | int | null | false | $sectionId | Section identifier as a number or string (e.g. 0, 1 or 'T-1'), null/false or an empty string for the whole page or 'new' for a new section. |
Content | $sectionContent | New content of the section. |
string | $sectionTitle | New section's subject, only if $section is "new". |
int | null | $baseRevId |
MWException |
Definition at line 1640 of file WikiPage.php.
References MediaWiki\Revision\RevisionRecord\getContent(), and wfDebug().
WikiPage::replaceSectionContent | ( | $sectionId, | |
Content | $sectionContent, | ||
$sectionTitle = '', | |||
$edittime = null ) |
string | int | null | false | $sectionId | Section identifier as a number or string (e.g. 0, 1 or 'T-1'), null/false or an empty string for the whole page or 'new' for a new section. |
Content | $sectionContent | New content of the section. |
string | $sectionTitle | New section's subject, only if $section is "new". |
string | $edittime | Revision timestamp or null to use the current revision. |
MWException |
Definition at line 1601 of file WikiPage.php.
WikiPage::setTimestamp | ( | $ts | ) |
Set the page timestamp (use only to avoid DB queries)
string | $ts | MW timestamp of last article revision |
Definition at line 863 of file WikiPage.php.
WikiPage::shouldCheckParserCache | ( | ParserOptions | $parserOptions, |
$oldId ) |
Should the parser cache be used?
ParserOptions | $parserOptions | ParserOptions to check |
int | $oldId |
Definition at line 1259 of file WikiPage.php.
WikiPage::supportsSections | ( | ) |
Returns true if this page's content model supports sections.
The skin should check this and not offer section functionality if sections are not supported.
The EditPage should check this and not offer section functionality if sections are not supported.
Definition at line 1583 of file WikiPage.php.
WikiPage::toPageRecord | ( | ) |
Returns the page represented by this WikiPage as a PageStoreRecord.
The PageRecord returned by this method is guaranteed to be immutable.
It is preferred to use this method rather than using the WikiPage as a PageIdentity directly.
PreconditionException | if the page does not exist. |
Definition at line 3363 of file WikiPage.php.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doParserCacheUpdate().
WikiPage::triggerOpportunisticLinksUpdate | ( | ParserOutput | $parserOutput | ) |
Opportunistically enqueue link update jobs after a fresh parser output was generated.
This method should only be called by PoolWorkArticleViewCurrent, after a page view experienced a miss from the ParserCache, and a new ParserOutput was generated. Specifically, for load reasons, this method must not get called during page views that use a cached ParserOutput.
ParserOutput | $parserOutput | Current version page output |
Definition at line 3130 of file WikiPage.php.
References CacheTime\getCacheExpiry(), CacheTime\getCacheTime(), and ParserOutput\hasReducedExpiry().
WikiPage::updateCategoryCounts | ( | array | $added, |
array | $deleted, | ||
$id = 0 ) |
Update all the appropriate counts in the category table, given that we've added the categories $added and deleted the categories $deleted.
This should only be called from deferred updates or jobs to avoid contention.
string[] | $added | The names of categories that were added |
string[] | $deleted | The names of categories that were deleted |
int | $id | Page ID (this should be the original deleted page ID) |
Definition at line 3033 of file WikiPage.php.
References $res, $type, DB_PRIMARY, getTitle(), and wfGetDB().
WikiPage::updateParserCache | ( | array | $options = [] | ) |
Update the parser cache.
array | $options |
|
Definition at line 2089 of file WikiPage.php.
WikiPage::updateRedirectOn | ( | $dbw, | |
$redirectTitle, | |||
$lastRevIsRedirect = null ) |
Add row to the redirect table if this is a redirect, remove otherwise.
IDatabase | $dbw | |
Title | null | $redirectTitle | Title object pointing to the redirect target, or NULL if this is not a redirect |
null | bool | $lastRevIsRedirect | If given, will optimize adding and removing rows in redirect table. |
Definition at line 1526 of file WikiPage.php.
References $success, getTitle(), and NS_FILE.
WikiPage::updateRevisionOn | ( | $dbw, | |
RevisionRecord | $revision, | ||
$lastRevision = null, | |||
$lastRevIsRedirect = null ) |
Update the page record to point to a newly saved revision.
IDatabase | $dbw | |
RevisionRecord | $revision | For ID number, and text used to set length and redirect status fields. |
int | null | $lastRevision | If given, will not overwrite the page field when different from the currently set value. Giving 0 indicates the new page flag should be set on. |
bool | null | $lastRevIsRedirect | If given, will optimize adding and removing rows in redirect table. |
Definition at line 1438 of file WikiPage.php.
References $content, MediaWiki\Revision\RevisionRecord\getContent(), MediaWiki\Revision\RevisionRecord\getId(), MediaWiki\Revision\RevisionRecord\getSlot(), and MediaWiki\Revision\RevisionRecord\getTimestamp().
WikiPage::wasLoadedFrom | ( | $from | ) |
Checks whether the page data was loaded using the given database access mode (or better).
string | int | $from | One of the following:
|
Definition at line 519 of file WikiPage.php.
|
protected |
Definition at line 92 of file WikiPage.php.
|
protected |
One of the READ_* constants.
Definition at line 145 of file WikiPage.php.
|
protected |
Definition at line 140 of file WikiPage.php.
|
protected |
Definition at line 165 of file WikiPage.php.
|
protected |
False means "not loaded".
Definition at line 129 of file WikiPage.php.
|
protected |
Definition at line 170 of file WikiPage.php.
|
protected |
Map of cache fields (text, parser output, ect) for a proposed/new edit.
Definition at line 135 of file WikiPage.php.
|
protected |
The cache of the redirect target.
Definition at line 113 of file WikiPage.php.
|
protected |
Timestamp of the current revision or empty string if not loaded.
Definition at line 155 of file WikiPage.php.
|
protected |
Definition at line 86 of file WikiPage.php.
|
protected |
Definition at line 160 of file WikiPage.php.