MediaWiki
1.33.0
|
Class representing a MediaWiki article and history. More...
Public Member Functions | |
__clone () | |
Makes sure that the mTitle object is cloned to the newly cloned WikiPage. More... | |
__construct (Title $title) | |
Constructor and clear the article. More... | |
checkFlags ( $flags) | |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed. More... | |
checkTouched () | |
Loads page_touched and returns a value indicating if it should be used. More... | |
clear () | |
Clear the object. More... | |
clearPreparedEdit () | |
Clear the mPreparedEdit cache field, as may be needed by mutable content types. More... | |
commitRollback ( $fromP, $summary, $bot, &$resultDetails, User $guser, $tags=null) | |
Backend implementation of doRollback(), please refer there for parameter and return value documentation. More... | |
doDeleteArticle ( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null, $immediate=false) | |
Same as doDeleteArticleReal(), but returns a simple boolean. More... | |
doDeleteArticleBatched ( $reason, $suppress, User $deleter, $tags, $logsubtype, $immediate=false, $webRequestId=null) | |
Back-end article deletion. More... | |
doDeleteArticleReal ( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $deleter=null, $tags=[], $logsubtype='delete', $immediate=false) | |
Back-end article deletion Deletes the article with database consistency, writes logs, purges caches. More... | |
doDeleteUpdates ( $id, Content $content=null, Revision $revision=null, User $user=null) | |
Do some database updates after deletion. More... | |
doEditContent (Content $content, $summary, $flags=0, $originalRevId=false, User $user=null, $serialFormat=null, $tags=[], $undidRevId=0) | |
Change an existing article or create a new article. More... | |
doEditUpdates (Revision $revision, User $user, array $options=[]) | |
Do standard deferred updates after page edit. More... | |
doPurge () | |
Perform the actions of a page purging. More... | |
doRollback ( $fromP, $summary, $token, $bot, &$resultDetails, User $user, $tags=null) | |
Roll back the most recent consecutive set of edits to a page from the same user; fails if there are no eligible edits to roll back to, e.g. More... | |
doSecondaryDataUpdates (array $options=[]) | |
Do secondary data updates (such as updating link tables). More... | |
doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, User $user, $tags=null) | |
Update the article's restriction field, and leave a log entry. More... | |
doViewUpdates (User $user, $oldid=0) | |
Do standard deferred updates after page view (existing or missing page) More... | |
exists () | |
followRedirect () | |
Get the Title object or URL this page redirects to. More... | |
getActionOverrides () | |
getAutoDeleteReason (&$hasHistory) | |
Auto-generates a deletion reason. More... | |
getCategories () | |
Returns a list of categories this page is a member of. More... | |
getComment ( $audience=Revision::FOR_PUBLIC, User $user=null) | |
getContent ( $audience=Revision::FOR_PUBLIC, User $user=null) | |
Get the content of the current revision. More... | |
getContentHandler () | |
Returns the ContentHandler instance to be used to deal with the content of this WikiPage. More... | |
getContentModel () | |
Returns the page's content model id (see the CONTENT_MODEL_XXX constants). More... | |
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. More... | |
getCreator ( $audience=Revision::FOR_PUBLIC, User $user=null) | |
Get the User object of the user who created the page. More... | |
getDeletionUpdates ( $rev=null) | |
Returns a list of updates to be performed when this page is deleted. More... | |
getHiddenCategories () | |
Returns a list of hidden categories this page is a member of. More... | |
getId () | |
getLatest () | |
Get the page_latest field. More... | |
getLinksTimestamp () | |
Get the page_links_updated field. More... | |
getMinorEdit () | |
Returns true if last revision was marked as "minor edit". More... | |
getMutableCacheKeys (WANObjectCache $cache) | |
getOldestRevision () | |
Get the Revision object of the oldest revision. More... | |
getParserOutput (ParserOptions $parserOptions, $oldid=null, $forceParse=false) | |
Get a ParserOutput for the given ParserOptions and revision ID. More... | |
getRedirectTarget () | |
If this page is a redirect, get its target. More... | |
getRedirectURL ( $rt) | |
Get the Title object or URL to use for a redirect. More... | |
getRevision () | |
Get the latest revision. More... | |
getRevisionRecord () | |
Get the latest revision. More... | |
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. More... | |
getTimestamp () | |
getTitle () | |
Get the title object of the article. More... | |
getTouched () | |
Get the page_touched field. More... | |
getUndoContent (Revision $undo, Revision $undoafter) | |
Get the content that needs to be saved in order to undo all revisions between $undo and $undoafter. More... | |
getUser ( $audience=Revision::FOR_PUBLIC, User $user=null) | |
getUserText ( $audience=Revision::FOR_PUBLIC, User $user=null) | |
getWikiDisplayName () | |
The display name for the site this content come from. More... | |
hasViewableContent () | |
Check if this page is something we're going to be showing some sort of sensible content for. More... | |
insertOn ( $dbw, $pageId=null) | |
Insert a new empty page record for this article. More... | |
insertProtectNullRevision ( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null) | |
Insert a new null revision for this page. More... | |
insertRedirect () | |
Insert an entry for this page into the redirect table if the content is a redirect. More... | |
insertRedirectEntry (Title $rt, $oldLatest=null) | |
Insert or update the redirect table entry for this page to indicate it redirects to $rt. More... | |
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). More... | |
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. More... | |
isLocal () | |
Whether this content displayed on this page comes from the local database. More... | |
isRedirect () | |
Tests if the article content represents a redirect. More... | |
loadFromRow ( $data, $from) | |
Load the object from a database row. More... | |
loadPageData ( $from='fromdb') | |
Load the object from a given source by title. More... | |
lockAndGetLatest () | |
Lock the page row for this title+id and return page_latest (or 0) More... | |
makeParserOptions ( $context) | |
Get parser options suitable for rendering the primary article wikitext. More... | |
newPageUpdater (User $user, RevisionSlotsUpdate $forUpdate=null) | |
Returns a PageUpdater for creating new revisions on this page (or creating the page). More... | |
pageDataFromId ( $dbr, $id, $options=[]) | |
Fetch a page record matching the requested ID. More... | |
pageDataFromTitle ( $dbr, $title, $options=[]) | |
Fetch a page record matching the Title object's namespace and title using a sanitized title string. More... | |
prepareContentForEdit (Content $content, $revision=null, User $user=null, $serialFormat=null, $useCache=true) | |
Prepare content which is about to be saved. More... | |
protectDescription (array $limit, array $expiry) | |
Builds the description to serve as comment for the edit. More... | |
protectDescriptionLog (array $limit, array $expiry) | |
Builds the description to serve as comment for the log entry. More... | |
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) More... | |
shouldCheckParserCache (ParserOptions $parserOptions, $oldId) | |
Should the parser cache be used? More... | |
supportsSections () | |
Returns true if this page's content model supports sections. More... | |
triggerOpportunisticLinksUpdate (ParserOutput $parserOutput) | |
Opportunistically enqueue link update jobs given fresh parser output if useful. More... | |
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. More... | |
updateIfNewerOn ( $dbw, $revision) | |
If the given revision is newer than the currently set page_latest, update the page record. More... | |
updateParserCache (array $options=[]) | |
Update the parser cache. More... | |
updateRedirectOn ( $dbw, $redirectTitle, $lastRevIsRedirect=null) | |
Add row to the redirect table if this is a redirect, remove otherwise. More... | |
updateRevisionOn ( $dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null) | |
Update the page record to point to a newly saved revision. More... | |
wasLoadedFrom ( $from) | |
Checks whether the page data was loaded using the given database access mode (or better). More... | |
Static Public Member Functions | |
static | factory (Title $title) |
Create a WikiPage object of the appropriate class for the given title. More... | |
static | getQueryInfo () |
Return the tables, fields, and join conditions to be selected to create a new page object. More... | |
static | hasDifferencesOutsideMainSlot (Revision $a, Revision $b) |
Helper method for checking whether two revisions have differences that go beyond the main slot. More... | |
static | newFromID ( $id, $from='fromdb') |
Constructor from a page id. More... | |
static | newFromRow ( $row, $from='fromdb') |
Constructor from a database row. More... | |
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. More... | |
static | onArticleDelete (Title $title) |
Clears caches when article is deleted. More... | |
static | onArticleEdit (Title $title, Revision $revision=null, $slotsChanged=null) |
Purge caches on page update etc. More... | |
static | selectFields () |
Return the list of revision fields that should be selected to create a new page. More... | |
Public Attributes | |
bool | $mDataLoaded = false |
bool | $mIsRedirect = false |
int false | $mLatest = false |
False means "not loaded". More... | |
PreparedEdit | $mPreparedEdit = false |
Map of cache fields (text, parser output, ect) for a proposed/new edit. More... | |
Title | $mTitle = null |
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 |
Protected Member Functions | |
archiveRevisions ( $dbw, $id, $suppress) | |
Archives revisions as part of page deletion. More... | |
clearCacheFields () | |
Clear the object cache fields. More... | |
formatExpiry ( $expiry) | |
loadLastEdit () | |
Loads everything except the text This isn't necessary for all uses, so it's only done if needed. More... | |
pageData ( $dbr, $conditions, $options=[]) | |
Fetch a page record with the given conditions. More... | |
setLastEdit (Revision $revision) | |
Set the latest revision. More... | |
Static Protected Member Functions | |
static | convertSelectType ( $type) |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants. More... | |
static | flattenRestrictions ( $limit) |
Take an array of page restrictions and flatten it to a string suitable for insertion into the page_restrictions field. More... | |
Protected Attributes | |
int | $mDataLoadedFrom = self::READ_NONE |
One of the READ_* constants. More... | |
int | $mId = null |
Revision | $mLastRevision = null |
string | $mLinksUpdated = '19700101000000' |
Title | $mRedirectTarget = null |
string | $mTimestamp = '' |
Timestamp of the current revision or empty string if not loaded. More... | |
string | $mTouched = '19700101000000' |
Private Member Functions | |
getDBLoadBalancer () | |
getDerivedDataUpdater (User $forUser=null, RevisionRecord $forRevision=null, RevisionSlotsUpdate $forUpdate=null, $forEdit=false) | |
Returns a DerivedPageDataUpdater for use with the given target revision or new content. More... | |
getParserCache () | |
getRevisionRenderer () | |
getRevisionStore () | |
getSlotRoleRegistry () | |
newDerivedDataUpdater () | |
Static Private Member Functions | |
static | purgeInterwikiCheckKey (Title $title) |
#- More... | |
Private Attributes | |
DerivedPageDataUpdater null | $derivedDataUpdater = null |
Class representing a MediaWiki article and history.
Some fields are public only for backwards-compatibility. Use accessors. In the past, this class was part of Article.php and everything was public.
Definition at line 45 of file WikiPage.php.
WikiPage::__construct | ( | Title | $title | ) |
WikiPage::__clone | ( | ) |
Makes sure that the mTitle object is cloned to the newly cloned WikiPage.
Definition at line 126 of file WikiPage.php.
References $mTitle.
|
protected |
Archives revisions as part of page deletion.
IDatabase | $dbw | |
int | $id | |
bool | $suppress | Suppress all revisions and log the deletion in the suppression log instead of the deletion log |
Definition at line 2829 of file WikiPage.php.
References $res, $revQuery, $user, $wgActorTableSchemaMigrationStage, $wgContentHandlerUseDB, $wgDeleteRevisionsBatchSize, $wgMultiContentRevisionSchemaMigrationStage, as, captcha-old\count, Revision\getQueryInfo(), CommentStore\getStore(), getTitle(), IP\isValid(), User\newFromAnyId(), ActorMigration\newMigration(), SCHEMA_COMPAT_WRITE_NEW, SCHEMA_COMPAT_WRITE_OLD, and Revision\SUPPRESSED_ALL.
Referenced by doDeleteArticleBatched().
WikiPage::checkFlags | ( | $flags | ) |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
int | $flags |
Definition at line 1670 of file WikiPage.php.
References EDIT_NEW, EDIT_UPDATE, and exists().
WikiPage::checkTouched | ( | ) |
Loads page_touched and returns a value indicating if it should be used.
Definition at line 677 of file WikiPage.php.
References loadPageData().
WikiPage::clear | ( | ) |
Clear the object.
Definition at line 302 of file WikiPage.php.
References clearCacheFields(), and IDBAccessObject\READ_NONE.
Referenced by EditPageTest\forceRevisionDate(), and ApiEditPageTest\forceRevisionDate().
|
protected |
Clear the object cache fields.
Definition at line 313 of file WikiPage.php.
Referenced by clear(), and loadFromRow().
WikiPage::clearPreparedEdit | ( | ) |
Clear the mPreparedEdit cache field, as may be needed by mutable content types.
Definition at line 333 of file WikiPage.php.
Backend implementation of doRollback(), please refer there for parameter and return value documentation.
NOTE: This function does NOT check ANY permissions, it just commits the rollback to the DB. Therefore, you should only call this function direct- ly if you want to use custom permissions checks. If you don't, use doRollback() instead.
string | $fromP | Name of the user whose edits to rollback. |
string | $summary | Custom summary. Set to default summary if empty. |
bool | $bot | If true, mark all reverted edits as bot. |
array | &$resultDetails | Contains result-specific array of additional values |
User | $guser | The user performing the rollback |
array | null | $tags | Change tags to apply to the rollback Callers are responsible for permission checks (with ChangeTags::canAddTagsAccompanyingChange) |
Definition at line 3134 of file WikiPage.php.
References $args, $rev, $s, $wgUseRCPatrol, as, captcha-old\count, DB_MASTER, EDIT_FORCE_BOT, EDIT_INTERNAL, EDIT_MINOR, EDIT_UPDATE, false, getRevisionStore(), ChangeTags\getSoftwareTags(), getTitle(), User\isAllowed(), User\isAllowedAny(), ActorMigration\newMigration(), newPageUpdater(), CommentStoreComment\newUnsavedComment(), RecentChange\PRC_AUTOPATROLLED, Hooks\run(), wfGetDB(), wfMessage(), wfMsgReplaceArgs(), wfReadOnly(), and wfTimestamp().
Referenced by doRollback().
|
staticprotected |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
object | string | int | $type |
Definition at line 218 of file WikiPage.php.
References $type, and IDBAccessObject\READ_LOCKING.
Referenced by loadFromRow(), loadPageData(), newFromID(), and wasLoadedFrom().
WikiPage::doDeleteArticle | ( | $reason, | |
$suppress = false , |
|||
$u1 = null , |
|||
$u2 = null , |
|||
& | $error = '' , |
||
User | $user = null , |
||
$immediate = false |
|||
) |
Same as doDeleteArticleReal(), but returns a simple boolean.
This is kept around for backwards compatibility, if you care about error reporting you should use doDeleteArticleReal() instead.
Deletes the article with database consistency, writes logs, purges caches
string | $reason | Delete reason for deletion log |
bool | $suppress | Suppress all revisions and log the deletion in the suppression log instead of the deletion log |
int | null | $u1 | Unused |
bool | null | $u2 | Unused |
array | string | &$error | Array of errors to append to |
User | null | $user | The deleting user |
bool | $immediate | false allows deleting over time via the job queue |
FatalError | |
MWException |
Definition at line 2593 of file WikiPage.php.
References $user, and doDeleteArticleReal().
Referenced by WikiPageDbTestBase\testExists().
WikiPage::doDeleteArticleBatched | ( | $reason, | |
$suppress, | |||
User | $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.
Definition at line 2664 of file WikiPage.php.
References $cache, $content, $job, $mTitle, archiveRevisions(), DB_MASTER, doDeleteUpdates(), getContent(), getId(), User\getId(), getLatest(), WebRequest\getRequestId(), getRevision(), getTitle(), loadPageData(), lockAndGetLatest(), StatusValue\newGood(), Revision\RAW, Hooks\run(), JobQueueGroup\singleton(), use, wfDebug(), wfEscapeWikiText(), wfGetDB(), and wfLogWarning().
Referenced by doDeleteArticleReal().
WikiPage::doDeleteArticleReal | ( | $reason, | |
$suppress = false , |
|||
$u1 = null , |
|||
$u2 = null , |
|||
& | $error = '' , |
||
User | $deleter = 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 |
bool | $suppress | Suppress all revisions and log the deletion in the suppression log instead of the deletion log |
int | null | $u1 | Unused |
bool | null | $u2 | Unused |
array | string | &$error | Array of errors to append to |
User | null | $deleter | The deleting user |
array | $tags | Tags to apply to the deletion action |
string | $logsubtype | |
bool | $immediate | false allows deleting over time via the job queue |
FatalError | |
MWException |
Definition at line 2626 of file WikiPage.php.
References doDeleteArticleBatched(), StatusValue\newGood(), Hooks\run(), and wfDebug().
Referenced by doDeleteArticle(), EditPageTest\testCreatePage(), and EditPageTest\testCreatePageTrx().
WikiPage::doDeleteUpdates | ( | $id, | |
Content | $content = null , |
||
Revision | $revision = null , |
||
User | $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. |
Revision | null | $revision | The current page revision at the time of deletion, used when determining the required updates. This may be needed because $this->getRevision() may already return null when the page proper was deleted. |
User | null | $user | The user that caused the deletion |
Definition at line 3005 of file WikiPage.php.
References $content, $user, DeferredUpdates\addUpdate(), as, SiteStatsUpdate\factory(), WikiMap\getCurrentWikiDbDomain(), getDeletionUpdates(), getId(), ResourceLoaderWikiModule\invalidateModuleCache(), isCountable(), loadFromRow(), NS_FILE, onArticleDelete(), and LinksUpdate\queueRecursiveJobsForTable().
Referenced by doDeleteArticleBatched().
WikiPage::doEditContent | ( | Content | $content, |
$summary, | |||
$flags = 0 , |
|||
$originalRevId = false , |
|||
User | $user = null , |
||
$serialFormat = null , |
|||
$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 |
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.
bool | int | $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. |
User | null | $user | The user doing the edit |
string | null | $serialFormat | IGNORED. |
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: The revision object for the inserted revision, or null.
MWException |
Definition at line 1870 of file WikiPage.php.
References $content, $user, $wgUseNPPatrol, $wgUseRCPatrol, EDIT_MINOR, exists(), getTitle(), newPageUpdater(), CommentStoreComment\newUnsavedComment(), RecentChange\PRC_AUTOPATROLLED, and setLastEdit().
Referenced by MediaWiki\Tests\Maintenance\DumpTestCase\addRevision().
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.
Revision | $revision | |
User | $user | User object that did the revision |
array | $options | Array of options, following indexes are used:
|
Definition at line 2052 of file WikiPage.php.
References $options, $user, getDerivedDataUpdater(), and Revision\getRevisionRecord().
WikiPage::doPurge | ( | ) |
Perform the actions of a page purging.
Reimplemented in WikiFilePage.
Definition at line 1287 of file WikiPage.php.
References DeferredUpdates\addUpdate(), HTMLFileCache\clearFileCache(), getContent(), getTitle(), NS_MEDIAWIKI, DeferredUpdates\PRESEND, Hooks\run(), and MessageCache\singleton().
Roll back the most recent consecutive set of edits to a page from the same user; fails if there are no eligible edits to roll back to, e.g.
user is the sole contributor. This function performs permissions checks on $user, then calls commitRollback() to do the dirty work
Separate the business/permission stuff out from backend code
Remove $token parameter. Already verified by RollbackAction and ApiRollback.
string | $fromP | Name of the user whose edits to rollback. |
string | $summary | Custom summary. Set to default summary if empty. |
string | $token | Rollback token. |
bool | $bot | If true, mark all reverted edits as bot. |
array | &$resultDetails | Array contains result-specific array of additional values 'alreadyrolled' : 'current' (rev) success : 'summary' (str), 'current' (rev), 'target' (rev) |
User | $user | The user performing the rollback |
array | null | $tags | Change tags to apply to the rollback Callers are responsible for permission checks (with ChangeTags::canAddTagsAccompanyingChange) |
Definition at line 3088 of file WikiPage.php.
References $user, commitRollback(), and wfArrayDiff2().
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 2121 of file WikiPage.php.
References $options, $user, getDerivedDataUpdater(), getRevisionRecord(), and User\newFromIdentity().
WikiPage::doUpdateRestrictions | ( | array | $limit, |
array | $expiry, | ||
& | $cascade, | ||
$reason, | |||
User | $user, | ||
$tags = null |
|||
) |
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 |
int | &$cascade | Set to false if cascading protection isn't allowed. |
string | $reason | |
User | $user | The user updating the restrictions |
string | string[] | null | $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 2151 of file WikiPage.php.
References $params, $user, $wgCascadingRestrictionLevels, as, captcha-old\count, DB_MASTER, getId(), getLatest(), CommentStore\getStore(), insertProtectNullRevision(), InfoAction\invalidateCache(), loadPageData(), StatusValue\newFatal(), StatusValue\newGood(), protectDescriptionLog(), Title\purgeExpiredRestrictions(), Hooks\run(), wfGetDB(), wfMessage(), wfReadOnly(), and wfReadOnlyReason().
WikiPage::doViewUpdates | ( | User | $user, |
$oldid = 0 |
|||
) |
Do standard deferred updates after page view (existing or missing page)
User | $user | The relevant user |
int | $oldid | Revision id being viewed; if not given or 0, latest revision is assumed |
Definition at line 1264 of file WikiPage.php.
References $user, DeferredUpdates\addCallableUpdate(), DeferredUpdates\PRESEND, Hooks\run(), use, and wfReadOnly().
WikiPage::exists | ( | ) |
Definition at line 606 of file WikiPage.php.
References loadPageData().
Referenced by LinksDeletionUpdate\__construct(), checkFlags(), doEditContent(), getContentModel(), and shouldCheckParserCache().
|
static |
Create a WikiPage object of the appropriate class for the given title.
Title | $title |
MWException |
Definition at line 138 of file WikiPage.php.
References $title, NS_CATEGORY, NS_FILE, NS_MEDIA, and Hooks\run().
Referenced by MediaWikiTestCase\addCoreDBData(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\addDBData(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\addDBData(), SpecialMyLanguageTest\addDBDataOnce(), ApiQueryUserContribsTest\addDBDataOnce(), ApiComparePagesTest\addDBDataOnce(), CategoryMembershipChangeTest\addDBDataOnce(), MediaWiki\Tests\Maintenance\FetchTextTest\addDBDataOnce(), ApiComparePagesTest\addPage(), EditPageTest\assertEdit(), WikiImporter\beforeImportPage(), Orphans\checkSeparation(), MediaWiki\Permissions\PermissionManager\checkUserBlock(), CleanupSpam\cleanupArticle(), Installer\createMainpage(), RefreshLinksJobTest\createPage(), UploadFromUrlTest\deleteFile(), ApiUploadTestCase\deleteFileByTitle(), ApiQueryRecentChangesIntegrationTest\deletePage(), ApiQueryWatchlistIntegrationTest\deletePage(), ApiQueryRecentChangesIntegrationTest\doAnonPageEdit(), ApiQueryWatchlistIntegrationTest\doAnonPageEdit(), ApiQueryRecentChangesIntegrationTest\doBotPageEdit(), ApiQueryWatchlistIntegrationTest\doBotPageEdit(), FileDeleteForm\doDelete(), DifferenceEngineTest\doEdits(), ApiQueryRecentChangesIntegrationTest\doMinorPageEdit(), ApiQueryWatchlistIntegrationTest\doMinorPageEdit(), ApiQueryRecentChangesIntegrationTest\doPageEdit(), ApiQueryWatchlistIntegrationTest\doPageEdit(), ApiQueryWatchlistIntegrationTest\doPatrolledPageEdit(), MovePageForm\doSubmit(), WatchAction\doUnwatch(), WatchAction\doWatch(), MediaWikiTestCase\editPage(), CategoryMembershipChangeJobTest\editPageText(), SearchEngineTest\editSearchResultPage(), ApiPurge\execute(), ApiEditPage\execute(), CompareParserCache\execute(), ApiRollback\execute(), ViewCLI\execute(), MakeTestEdits\execute(), DeleteDefaultMessages\execute(), ImportSiteScripts\execute(), ApiParse\execute(), Protect\execute(), AttachLatest\execute(), RollbackEdits\execute(), DeleteBatch\execute(), EditCLI\execute(), ApiStashEdit\execute(), DeleteEqualMessages\execute(), ImportImages\execute(), WikiImporter\finishImportPage(), TitleBlacklist\getBlacklistText(), WANCacheReapUpdate\getEventAffectedKeys(), MediaWikiTestCase\getExistingTestPage(), SearchNearMatcher\getNearMatchInternal(), MediaWikiTestCase\getNonexistingTestPage(), ArticleViewTest\getPage(), ActionTest\getPage(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\getPage(), EditPage\getPreloadedContent(), AbstractContent\getRedirectChain(), ListredirectsPage\getRedirectTarget(), SearchExactMatchRescorer\getRedirectTarget(), ApiPageSet\getRedirectTargets(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getTestPage(), ApiBase\getTitleOrPageId(), RequestContext\getWikiPage(), ImportableOldRevisionImporter\import(), MediaWiki\initializeArticle(), MediaWikiTestCase\insertPage(), PopulateArchiveRevId\makeDummyRevisionRow(), UserTest\makeEdit(), MergeHistory\merge(), MovePage\moveToInternal(), RecentChange\newForCategorization(), newFromRow(), SpecialChangeContentModel\onSubmit(), XmlDumpWriter\openPage(), PurgePage\purge(), MessageCache\refreshAndReplaceInternal(), DifferenceEngine\renderNewRevision(), ImportReporter\reportPage(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\revisionToRow(), DeleteLinksJob\run(), DoubleRedirectJob\run(), RefreshLinksJob\runForTitle(), SpecialEditWatchlist\runWatchUnwatchCompleteHook(), SpecialUndelete\showDiff(), EditPageTest\testAutoMerge(), EditPageTest\testCheckDirectEditingDisallowed_forNonTextContent(), MediaWiki\Tests\Storage\PageUpdaterTest\testCompareAndSwapFailure(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByTitle(), MediaWiki\Tests\Storage\PageUpdaterTest\testCreatePage(), WikiPageDbTestBase\testDoEditContent_twice(), ApiEditPageTest\testEdit_redirect(), ApiEditPageTest\testEdit_redirectText(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_newSection(), ApiEditPageTest\testEditConflict_T43990(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), WikiCategoryPageTest\testExpectUnusedCategory_PropertyIsSet(), WikiCategoryPageTest\testExpectUnusedCategory_PropertyNotSet(), MediaWiki\Tests\Storage\PageUpdaterTest\testFailureOnBadContentModel(), MediaWiki\Tests\Storage\PageUpdaterTest\testFailureOnEditFlags(), UserTest\testGetEditCount(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetNextRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetParentLengths(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetPreviousRevision(), WikitextContentTest\testGetSecondaryDataUpdates(), WikiCategoryPageTest\testHiddenCategory_PropertyIsSet(), WikiCategoryPageTest\testHiddenCategory_PropertyNotSet(), MediaWiki\Tests\Storage\PageUpdaterTest\testInheritSlot(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_archive(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTimestamp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTitle(), MediaWiki\Tests\Storage\PageUpdaterTest\testMagicWords(), MovePageTest\testMoveAbortedByTitleMoveHook(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_getArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_legacyEncoding(), ApiQueryAllPagesTest\testPrefixNormalizationSearchBug(), RefreshLinksPartitionTest\testRefreshLinks(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetRcPatrolStatus(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetUseAutomaticEditSummaries(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetUsePageCreationLog(), ApiSetNotificationTimestampIntegrationTest\testStuff(), ApiEditPageTest\testSupportsDirectApiEditing_withContentHandlerOverride(), TemplateCategoriesTest\testTemplateCategories(), ArticleTablesTest\testTemplatelinksUsesContentLanguage(), MovePageTest\testTitleMoveCompleteIntegrationTest(), ImportTest\testUnknownXMLTags(), MediaWiki\Tests\Storage\PageUpdaterTest\testUpdatePage(), RevisionDbTestBase\testUserWasLastToEdit(), RequestContextTest\testWikiPageTitle(), PageArchive\undeleteRevisions(), and LinksUpdate\updateCategoryCounts().
|
staticprotected |
Take an array of page restrictions and flatten it to a string suitable for insertion into the page_restrictions field.
string[] | $limit |
MWException |
Definition at line 2537 of file WikiPage.php.
References as.
WikiPage::followRedirect | ( | ) |
Get the Title object or URL this page redirects to.
Reimplemented in WikiFilePage.
Definition at line 1102 of file WikiPage.php.
References getRedirectTarget(), and getRedirectURL().
|
protected |
string | $expiry | 14-char timestamp or "infinity", or false if the input was invalid |
Definition at line 2450 of file WikiPage.php.
References wfMessage().
Referenced by protectDescription(), and protectDescriptionLog().
WikiPage::getActionOverrides | ( | ) |
Definition at line 273 of file WikiPage.php.
References getContentHandler().
WikiPage::getAutoDeleteReason | ( | & | $hasHistory | ) |
Auto-generates a deletion reason.
bool | &$hasHistory | Whether the page has a history |
Definition at line 3589 of file WikiPage.php.
References getContentHandler(), and getTitle().
WikiPage::getCategories | ( | ) |
Returns a list of categories this page is a member of.
Results will include hidden categories
Definition at line 3535 of file WikiPage.php.
References $dbr, $res, DB_REPLICA, getId(), TitleArray\newFromResult(), NS_CATEGORY, and wfGetDB().
WikiPage::getComment | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
int | $audience | One of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to the given user Revision::RAW get the text regardless of permissions |
User | null | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 911 of file WikiPage.php.
References $user, and loadLastEdit().
WikiPage::getContent | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
Get the content of the current revision.
No side-effects...
int | $audience | One of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to $wgUser Revision::RAW get the text regardless of permissions |
User | null | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 816 of file WikiPage.php.
References $user, and loadLastEdit().
Referenced by doDeleteArticleBatched(), doPurge(), TextContentHandler\getDataForSearchIndex(), ContentHandler\getDataForSearchIndex(), ApiParse\getParsedContent(), EditPage\getPreloadedContent(), insertRedirect(), isCountable(), replaceSectionAtRev(), and ContentHandlerTest\testDataIndexFields().
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 286 of file WikiPage.php.
References getContentModel(), and ContentHandler\getForModelID().
Referenced by getActionOverrides(), getAutoDeleteReason(), replaceSectionAtRev(), shouldCheckParserCache(), supportsSections(), and ContentHandlerTest\testDataIndexFields().
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 648 of file WikiPage.php.
References $cache, $rev, $title, exists(), getRevision(), and wfWarn().
Referenced by getContentHandler().
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 1151 of file WikiPage.php.
References $dbr, $options, $res, $tables, $user, DB_REPLICA, getId(), getUser(), getUserText(), User\newFromId(), User\newFromName(), ActorMigration\newMigration(), and wfGetDB().
WikiPage::getCreator | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
Get the User object of the user who created the page.
int | $audience | One of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to the given user Revision::RAW get the text regardless of permissions |
User | null | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 873 of file WikiPage.php.
References $user, getOldestRevision(), and User\newFromName().
|
private |
Definition at line 263 of file WikiPage.php.
Referenced by loadPageData(), newPageUpdater(), and replaceSectionContent().
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 3741 of file WikiPage.php.
References $content, $handler, $rev, as, Revision\SlotRecord\getContent(), getId(), getRevisionRecord(), getTitle(), Revision\RAW, Hooks\run(), wfDebug(), and wfDeprecated().
Referenced by doDeleteUpdates().
|
private |
Returns a DerivedPageDataUpdater for use with the given target revision or new content.
This method attempts to re-use the same DerivedPageDataUpdater instance for subsequent calls. The parameters passed to this method are used to ensure that the DerivedPageDataUpdater returned matches that caller's expectations, allowing an existing instance to be re-used if the given parameters match that instance's internal state according to DerivedPageDataUpdater::isReusableFor(), and creating a new instance of the parameters do not match the existign one.
If neither $forRevision nor $forUpdate is given, a new DerivedPageDataUpdater is always created, replacing any DerivedPageDataUpdater currently cached.
MCR migration note: this replaces WikiPage::prepareContentForEdit.
User | null | $forUser | The user that will be used for, or was used for, PST. |
RevisionRecord | null | $forRevision | The revision created by the edit for which to perform updates, if the edit was already saved. |
RevisionSlotsUpdate | null | $forUpdate | The new content to be saved by the edit (pre PST), if the edit was not yet saved. |
bool | $forEdit | Only re-use if the cached DerivedPageDataUpdater has the current revision as the edit's parent revision. This ensures that the same DerivedPageDataUpdater cannot be re-used for two consecutive edits. |
Definition at line 1733 of file WikiPage.php.
References $derivedDataUpdater, newDerivedDataUpdater(), and null.
Referenced by doEditUpdates(), doSecondaryDataUpdates(), newPageUpdater(), prepareContentForEdit(), and updateParserCache().
WikiPage::getHiddenCategories | ( | ) |
Returns a list of hidden categories this page is a member of.
Uses the page_props and categorylinks tables.
Definition at line 3558 of file WikiPage.php.
References $dbr, $res, as, DB_REPLICA, getId(), Title\makeTitle(), NS_CATEGORY, and wfGetDB().
WikiPage::getId | ( | ) |
Definition at line 596 of file WikiPage.php.
References $mId, and loadPageData().
Referenced by LinksDeletionUpdate\__construct(), PoolWorkArticleView\__construct(), doDeleteArticleBatched(), doDeleteUpdates(), doUpdateRestrictions(), getCategories(), getContributors(), getDeletionUpdates(), getHiddenCategories(), ApiParse\getParsedContent(), getRedirectTarget(), insertProtectNullRevision(), insertRedirectEntry(), isBatchedDelete(), isCountable(), loadLastEdit(), lockAndGetLatest(), replaceSectionAtRev(), triggerOpportunisticLinksUpdate(), updateCategoryCounts(), updateIfNewerOn(), updateRedirectOn(), and updateRevisionOn().
WikiPage::getLatest | ( | ) |
Get the page_latest field.
Definition at line 710 of file WikiPage.php.
References $mLatest, and loadPageData().
Referenced by doDeleteArticleBatched(), doUpdateRestrictions(), EditPageTest\forceRevisionDate(), ApiEditPageTest\forceRevisionDate(), ApiParse\getParsedContent(), getParserOutput(), insertRedirect(), loadLastEdit(), shouldCheckParserCache(), EditPageTest\testCreatePage(), and EditPageTest\testCreatePageTrx().
WikiPage::getLinksTimestamp | ( | ) |
Get the page_links_updated field.
Definition at line 699 of file WikiPage.php.
References $mLinksUpdated, and loadPageData().
Referenced by triggerOpportunisticLinksUpdate().
WikiPage::getMinorEdit | ( | ) |
Returns true if last revision was marked as "minor edit".
Definition at line 925 of file WikiPage.php.
References loadLastEdit().
WikiPage::getMutableCacheKeys | ( | WANObjectCache | $cache | ) |
WANObjectCache | $cache |
Definition at line 3843 of file WikiPage.php.
References $cache, and getTitle().
WikiPage::getOldestRevision | ( | ) |
Get the Revision object of the oldest revision.
Definition at line 721 of file WikiPage.php.
References $rev, and Title\GAID_FOR_UPDATE.
Referenced by getCreator().
|
private |
Definition at line 256 of file WikiPage.php.
Referenced by getParserOutput(), and newDerivedDataUpdater().
WikiPage::getParserOutput | ( | ParserOptions | $parserOptions, |
$oldid = null , |
|||
$forceParse = 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 | $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 | $forceParse | Force reindexing, regardless of cache settings |
Definition at line 1223 of file WikiPage.php.
References getLatest(), getParserCache(), ParserOptions\getStubThreshold(), ParserOptions\isSafeToCache(), shouldCheckParserCache(), wfDebug(), and wfIncrStats().
Referenced by ApiParse\getParsedContent(), and DifferenceEngine\getParserOutput().
|
static |
Return the tables, fields, and join conditions to be selected to create a new page object.
Definition at line 383 of file WikiPage.php.
References $ret, $wgContentHandlerUseDB, and $wgPageLanguageUseDB.
Referenced by Title\getLinksFrom(), newFromID(), and pageData().
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 995 of file WikiPage.php.
References $dbr, $mRedirectTarget, DB_REPLICA, getId(), insertRedirect(), Title\makeTitle(), NS_FILE, NS_MEDIA, and wfGetDB().
Referenced by followRedirect(), and EditPage\getPreloadedContent().
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 1113 of file WikiPage.php.
References $source.
Referenced by followRedirect().
WikiPage::getRevision | ( | ) |
Get the latest revision.
Definition at line 783 of file WikiPage.php.
References $mLastRevision, and loadLastEdit().
Referenced by PoolWorkArticleView\__construct(), doDeleteArticleBatched(), getContentModel(), ContentHandler\getParserOutputForIndexing(), getUndoContent(), and MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision().
WikiPage::getRevisionRecord | ( | ) |
Get the latest revision.
Definition at line 795 of file WikiPage.php.
References loadLastEdit().
Referenced by doSecondaryDataUpdates(), getDeletionUpdates(), and updateParserCache().
|
private |
Definition at line 242 of file WikiPage.php.
Referenced by newDerivedDataUpdater().
|
private |
Definition at line 235 of file WikiPage.php.
Referenced by commitRollback(), isBatchedDelete(), newDerivedDataUpdater(), newPageUpdater(), and prepareContentForEdit().
|
private |
Definition at line 249 of file WikiPage.php.
Referenced by newDerivedDataUpdater(), and newPageUpdater().
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 3834 of file WikiPage.php.
References getTitle().
WikiPage::getTimestamp | ( | ) |
Definition at line 827 of file WikiPage.php.
References loadLastEdit(), and wfTimestamp().
WikiPage::getTitle | ( | ) |
Get the title object of the article.
Definition at line 294 of file WikiPage.php.
References $mTitle.
Referenced by LinksDeletionUpdate\__construct(), PoolWorkArticleView\__construct(), MediaWiki\Tests\Maintenance\DumpTestCase\addRevision(), archiveRevisions(), TitleBlacklistHooks\clearBlacklist(), commitRollback(), doDeleteArticleBatched(), doEditContent(), doPurge(), getAutoDeleteReason(), FileContentHandler\getDataForSearchIndex(), WikitextContentHandler\getDataForSearchIndex(), TextContentHandler\getDataForSearchIndex(), GadgetDefinitionContent\getDeletionUpdates(), getDeletionUpdates(), getMutableCacheKeys(), ApiParse\getParsedContent(), getSourceURL(), WikiCategoryPage\isExpectedUnusedCategory(), WikiCategoryPage\isHidden(), loadLastEdit(), lockAndGetLatest(), ApiParse\makeParserOptions(), makeParserOptions(), Article\newFromWikiPage(), CategoryMembershipChangeJob\notifyUpdatesForRevision(), GadgetHooks\onPageContentInsertComplete(), GadgetHooks\onPageContentSaveComplete(), ConfirmEditHooks\onPageContentSaveComplete(), SpamBlacklistHooks\onParserOutputStashForEdit(), SpamBlacklistHooks\pageSaveContent(), ApiStashEdit\parseAndStash(), RequestContext\setWikiPage(), SimpleCaptcha\shouldCheck(), updateCategoryCounts(), and updateRedirectOn().
WikiPage::getTouched | ( | ) |
Get the page_touched field.
Definition at line 688 of file WikiPage.php.
References $mTouched, and loadPageData().
Referenced by triggerOpportunisticLinksUpdate().
Get the content that needs to be saved in order to undo all revisions between $undo and $undoafter.
Revisions must belong to the same page, must exist and must not be deleted
Definition at line 1545 of file WikiPage.php.
References $handler, Revision\getContentHandler(), and getRevision().
WikiPage::getUser | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
int | $audience | One of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to the given user Revision::RAW get the text regardless of permissions |
User | null | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 854 of file WikiPage.php.
References $user, and loadLastEdit().
Referenced by getContributors().
WikiPage::getUserText | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
int | $audience | One of: Revision::FOR_PUBLIC to be displayed to all users Revision::FOR_THIS_USER to be displayed to the given user Revision::RAW get the text regardless of permissions |
User | null | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 892 of file WikiPage.php.
References $user, and loadLastEdit().
Referenced by getContributors().
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 3821 of file WikiPage.php.
References $wgSitename.
Helper method for checking whether two revisions have differences that go beyond the main slot.
MCR migration note: this method should go away!
Definition at line 1526 of file WikiPage.php.
References Revision\getRevisionRecord().
Referenced by EditPage\getContentObject().
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 621 of file WikiPage.php.
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 1329 of file WikiPage.php.
References wfRandom().
Referenced by MediaWiki\Storage\PageUpdater\doCreate().
WikiPage::insertProtectNullRevision | ( | $revCommentMsg, | |
array | $limit, | ||
array | $expiry, | ||
$cascade, | |||
$reason, | |||
$user = null |
|||
) |
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 |
int | $cascade | Set to false if cascading protection isn't allowed. |
string | $reason | |
User | null | $user |
Definition at line 2407 of file WikiPage.php.
References $user, DB_MASTER, getId(), Revision\newNullRevision(), protectDescription(), text, updateRevisionOn(), wfGetDB(), and wfMessage().
Referenced by doUpdateRestrictions().
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 1042 of file WikiPage.php.
References $content, DeferredUpdates\addCallableUpdate(), DB_MASTER, getContent(), getLatest(), insertRedirectEntry(), DeferredUpdates\POSTSEND, use, and wfGetDB().
Referenced by getRedirectTarget().
Insert or update the redirect table entry for this page to indicate it redirects to $rt.
Title | $rt | Redirect target |
int | null | $oldLatest | Prior page_latest for check and set |
Definition at line 1067 of file WikiPage.php.
References DB_MASTER, Title\getDBkey(), Title\getFragment(), getId(), Title\getInterwiki(), Title\getNamespace(), lockAndGetLatest(), and wfGetDB().
Referenced by insertRedirect(), and updateRedirectOn().
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 2564 of file WikiPage.php.
References $dbr, $wgDeleteRevisionsBatchSize, DB_REPLICA, getId(), getRevisionStore(), 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 | bool | $editInfo | (false): object returned by prepareTextForEdit(), if false, the current database state will be used |
Definition at line 942 of file WikiPage.php.
References $content, $wgArticleCountMethod, captcha-old\count, DB_REPLICA, getContent(), getId(), and wfGetDB().
Referenced by doDeleteUpdates(), and MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision().
WikiPage::isLocal | ( | ) |
Whether this content displayed on this page comes from the local database.
Reimplemented in WikiFilePage.
Definition at line 3808 of file WikiPage.php.
WikiPage::isRedirect | ( | ) |
Tests if the article content represents a redirect.
Reimplemented in WikiFilePage.
Definition at line 630 of file WikiPage.php.
References $mIsRedirect, and loadPageData().
Referenced by EditPage\getPreloadedContent(), and MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision().
WikiPage::loadFromRow | ( | $data, | |
$from | |||
) |
Load the object from a database row.
object | bool | $data | DB row containing fields returned by selectFields() or false |
string | int | $from | One of the following:
|
Definition at line 556 of file WikiPage.php.
References $data, $mLatest, clearCacheFields(), convertSelectType(), wfTimestamp(), and wfTimestampOrNull().
Referenced by doDeleteUpdates(), and loadPageData().
|
protected |
Loads everything except the text This isn't necessary for all uses, so it's only done if needed.
Definition at line 734 of file WikiPage.php.
References $dbr, DB_REPLICA, getId(), getLatest(), getTitle(), Revision\newFromPageId(), Revision\newKnownCurrent(), IDBAccessObject\READ_LOCKING, setLastEdit(), and wfGetDB().
Referenced by getComment(), getContent(), getMinorEdit(), getRevision(), getRevisionRecord(), getTimestamp(), getUser(), and getUserText().
WikiPage::loadPageData | ( | $from = 'fromdb' | ) |
Load the object from a given source by title.
object | string | int | $from | One of the following:
|
Definition at line 485 of file WikiPage.php.
References $data, convertSelectType(), DB_REPLICA, getDBLoadBalancer(), DBAccessObjectUtils\getDBOptions(), list, loadFromRow(), and pageDataFromTitle().
Referenced by checkTouched(), doDeleteArticleBatched(), doUpdateRestrictions(), exists(), getId(), getLatest(), getLinksTimestamp(), getTouched(), MediaWiki\Storage\DerivedPageDataUpdater\grabCurrentRevision(), and isRedirect().
WikiPage::lockAndGetLatest | ( | ) |
Lock the page row for this title+id and return page_latest (or 0)
Definition at line 2977 of file WikiPage.php.
References DB_MASTER, getId(), getTitle(), and wfGetDB().
Referenced by doDeleteArticleBatched(), MediaWiki\Storage\PageUpdater\doModify(), and insertRedirectEntry().
WikiPage::makeParserOptions | ( | $context | ) |
Get parser options suitable for rendering the primary article wikitext.
IContextSource | User | string | $context | One of the following:
|
Definition at line 1945 of file WikiPage.php.
References $context, $options, getTitle(), and ParserOptions\newCanonical().
Referenced by CategoryMembershipChangeJob\getCategoriesAtRev(), DifferenceEngine\getParserOutput(), ContentHandler\getParserOutputForIndexing(), and ApiParse\makeParserOptions().
|
private |
Definition at line 1685 of file WikiPage.php.
References $derivedDataUpdater, $wgArticleCountMethod, $wgRCWatchCategoryMembership, DerivedPageDataUpdater, getParserCache(), getRevisionRenderer(), getRevisionStore(), getSlotRoleRegistry(), MediaWiki\Storage\DerivedPageDataUpdater\setArticleCountMethod(), MediaWiki\Storage\DerivedPageDataUpdater\setRcWatchCategoryMembership(), JobQueueGroup\singleton(), and MessageCache\singleton().
Referenced by getDerivedDataUpdater().
|
static |
Constructor from a page id.
int | $id | Article ID to load |
string | int | $from | One of the following values:
|
Definition at line 176 of file WikiPage.php.
References convertSelectType(), DB_MASTER, DB_REPLICA, getQueryInfo(), newFromRow(), and wfGetDB().
Referenced by CleanupInvalidDbKeys\cleanupTable(), RefreshLinks\fixLinksFromArticle(), RefreshLinks\fixRedirect(), ApiBase\getTitleOrPageId(), DeletePageJob\run(), DeleteLinksJob\run(), and CategoryMembershipChangeJob\run().
|
static |
Constructor from a database row.
object | $row | Database row containing at least fields returned by selectFields(). |
string | int | $from | Source of $data:
|
Definition at line 206 of file WikiPage.php.
References factory(), and Title\newFromRow().
Referenced by newFromID().
WikiPage::newPageUpdater | ( | User | $user, |
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.
User | $user | |
RevisionSlotsUpdate | null | $forUpdate | If given, allows any cached ParserOutput that may already have been returned via getDerivedDataUpdater to be re-used. |
Definition at line 1789 of file WikiPage.php.
References $user, $wgAjaxEditStash, $wgPageCreationLog, $wgUseAutomaticEditSummaries, getDBLoadBalancer(), getDerivedDataUpdater(), getRevisionStore(), and getSlotRoleRegistry().
Referenced by commitRollback(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\createRevision(), MediaWiki\Tests\Storage\PageUpdaterTest\createRevision(), doEditContent(), and PoolWorkArticleViewTest\makeRevision().
|
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 3375 of file WikiPage.php.
References $title, DeferredUpdates\addUpdate(), Category\newFromTitle(), and NS_CATEGORY.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), and MovePage\moveToInternal().
|
static |
Clears caches when article is deleted.
Title | $title |
Definition at line 3408 of file WikiPage.php.
References $title, $user, DeferredUpdates\addUpdate(), HTMLFileCache\clearFileCache(), false, BacklinkCache\get(), InfoAction\invalidateCache(), User\newFromName(), NS_FILE, NS_MEDIAWIKI, NS_USER_TALK, purgeInterwikiCheckKey(), RepoGroup\singleton(), and MessageCache\singleton().
Referenced by doDeleteUpdates(), and MovePage\moveToInternal().
|
static |
Purge caches on page update etc.
Title | $title | |
Revision | null | $revision | 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 3462 of file WikiPage.php.
References $title, DeferredUpdates\addCallableUpdate(), DeferredUpdates\addUpdate(), HTMLFileCache\clearFileCache(), InfoAction\invalidateCache(), purgeInterwikiCheckKey(), and use.
Referenced by MediaWiki\Storage\DerivedPageDataUpdater\doUpdates().
|
protected |
Fetch a page record with the given conditions.
IDatabase | $dbr | |
array | $conditions | |
array | $options |
Definition at line 422 of file WikiPage.php.
References $dbr, $options, getQueryInfo(), and Hooks\run().
Referenced by pageDataFromId(), and pageDataFromTitle().
WikiPage::pageDataFromId | ( | $dbr, | |
$id, | |||
$options = [] |
|||
) |
Fetch a page record matching the requested ID.
IDatabase | $dbr | |
int | $id | |
array | $options |
Definition at line 469 of file WikiPage.php.
References $dbr, $options, and pageData().
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 455 of file WikiPage.php.
References $dbr, $options, $title, and pageData().
Referenced by loadPageData().
In both all secondary updates will be triggered handle like object that caches derived data representing a and can trigger updates of cached copies of that e g in the links the and the CDN layer DerivedPageDataUpdater is used by PageUpdater when creating new but can also be used independently when performing meta data updates during or when puring a page It s a stepping stone on the way to a more complete refactoring of WikiPage we want to define interfaces for the different use cases of particularly providing access to post PST content and ParserOutput to callbacks during revision which currently use WikiPage::prepareContentForEdit | ( | Content | $content, |
$revision = null , |
|||
User | $user = null , |
||
$serialFormat = null , |
|||
$useCache = true |
|||
) |
Prepare content which is about to be saved.
Prior to 1.30, this returned a stdClass.
Content | $content | |
Revision | RevisionRecord | int | null | $revision | Revision object. For backwards compatibility, a revision ID is also accepted, but this is deprecated. Used with vary-revision or vary-revision-id. |
User | null | $user | |
string | null | $serialFormat | IGNORED |
bool | $useCache | Check shared prepared edit cache |
Definition at line 1977 of file WikiPage.php.
References $content, $user, getDerivedDataUpdater(), getRevisionStore(), and wfDeprecated().
Referenced by ApiStashEdit\parseAndStash(), and SimpleCaptcha\shouldCheck().
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 2472 of file WikiPage.php.
References as, formatExpiry(), and wfMessage().
Referenced by insertProtectNullRevision().
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 2514 of file WikiPage.php.
References as, and formatExpiry().
Referenced by doUpdateRestrictions().
|
staticprivate |
#-
Purge the check key for cross-wiki cache entries referencing this page
Title | $title |
Definition at line 3507 of file WikiPage.php.
References $cache, $title, $wgEnableScaryTranscluding, DeferredUpdates\addCallableUpdate(), WikiMap\getCurrentWikiDbDomain(), and use.
Referenced by onArticleDelete(), and onArticleEdit().
WikiPage::replaceSectionAtRev | ( | $sectionId, | |
Content | $sectionContent, | ||
$sectionTitle = '' , |
|||
$baseRevId = null |
|||
) |
string | int | null | bool | $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 1624 of file WikiPage.php.
References $rev, getContent(), getContentHandler(), getId(), Revision\newFromId(), supportsSections(), and wfDebug().
Referenced by replaceSectionContent().
WikiPage::replaceSectionContent | ( | $sectionId, | |
Content | $sectionContent, | ||
$sectionTitle = '' , |
|||
$edittime = null |
|||
) |
string | int | null | bool | $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 1585 of file WikiPage.php.
References $dbr, $rev, DB_MASTER, DB_REPLICA, getDBLoadBalancer(), Revision\loadFromTimestamp(), and replaceSectionAtRev().
|
static |
Return the list of revision fields that should be selected to create a new page.
Definition at line 344 of file WikiPage.php.
References $wgContentHandlerUseDB, $wgPageLanguageUseDB, and wfDeprecated().
|
protected |
Set the latest revision.
Revision | $revision |
Definition at line 774 of file WikiPage.php.
References Revision\getTimestamp().
Referenced by doEditContent(), loadLastEdit(), and updateRevisionOn().
WikiPage::setTimestamp | ( | $ts | ) |
Set the page timestamp (use only to avoid DB queries)
string | $ts | MW timestamp of last article revision |
Definition at line 841 of file WikiPage.php.
References wfTimestamp().
WikiPage::shouldCheckParserCache | ( | ParserOptions | $parserOptions, |
$oldId | |||
) |
Should the parser cache be used?
ParserOptions | $parserOptions | ParserOptions to check |
int | $oldId |
Definition at line 1201 of file WikiPage.php.
References exists(), getContentHandler(), getLatest(), and ParserOptions\getStubThreshold().
Referenced by getParserOutput().
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 1567 of file WikiPage.php.
References getContentHandler().
Referenced by replaceSectionAtRev().
WikiPage::triggerOpportunisticLinksUpdate | ( | ParserOutput | $parserOutput | ) |
Opportunistically enqueue link update jobs given fresh parser output if useful.
ParserOutput | $parserOutput | Current version page output |
Definition at line 3687 of file WikiPage.php.
References $cache, $params, CacheTime\getCacheExpiry(), CacheTime\getCacheTime(), getId(), getLinksTimestamp(), ObjectCache\getLocalClusterInstance(), RequestContext\getMain(), getTouched(), ParserOutput\hasDynamicContent(), RefreshLinksJob\newDynamic(), RefreshLinksJob\newPrioritized(), Hooks\run(), JobQueueGroup\singleton(), and wfReadOnly().
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.
array | $added | The names of categories that were added |
array | $deleted | The names of categories that were deleted |
int | $id | Page ID (this should be the original deleted page ID) |
Definition at line 3603 of file WikiPage.php.
References $type, DeferredUpdates\addCallableUpdate(), as, captcha-old\count, DB_MASTER, MWNamespace\getCategoryLinkType(), getId(), getTitle(), Category\newFromName(), Hooks\run(), use, and wfGetDB().
WikiPage::updateIfNewerOn | ( | $dbw, | |
$revision | |||
) |
If the given revision is newer than the currently set page_latest, update the page record.
Otherwise, do nothing.
IDatabase | $dbw | |
Revision | $revision |
Definition at line 1488 of file WikiPage.php.
References $ret, getId(), updateRevisionOn(), and wfTimestamp().
WikiPage::updateParserCache | ( | array | $options = [] | ) |
Update the parser cache.
array | $options |
|
Definition at line 2080 of file WikiPage.php.
References $options, $user, getDerivedDataUpdater(), getRevisionRecord(), and User\newFromIdentity().
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 1453 of file WikiPage.php.
References getId(), getTitle(), insertRedirectEntry(), NS_FILE, and RepoGroup\singleton().
Referenced by updateRevisionOn().
Update the page record to point to a newly saved revision.
IDatabase | $dbw | |
Revision | $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 1374 of file WikiPage.php.
References $content, $wgContentHandlerUseDB, getId(), setLastEdit(), and updateRedirectOn().
Referenced by MediaWiki\Storage\PageUpdater\doCreate(), MediaWiki\Storage\PageUpdater\doModify(), insertProtectNullRevision(), and updateIfNewerOn().
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 530 of file WikiPage.php.
References convertSelectType().
|
private |
Definition at line 112 of file WikiPage.php.
Referenced by getDerivedDataUpdater(), and newDerivedDataUpdater().
bool WikiPage::$mDataLoaded = false |
Definition at line 57 of file WikiPage.php.
|
protected |
One of the READ_* constants.
Definition at line 82 of file WikiPage.php.
|
protected |
Definition at line 77 of file WikiPage.php.
Referenced by getId().
bool WikiPage::$mIsRedirect = false |
Definition at line 92 of file WikiPage.php.
Referenced by getRevision().
False means "not loaded".
Definition at line 69 of file WikiPage.php.
Referenced by getLatest(), and loadFromRow().
|
protected |
Definition at line 107 of file WikiPage.php.
Referenced by getLinksTimestamp().
PreparedEdit WikiPage::$mPreparedEdit = false |
Map of cache fields (text, parser output, ect) for a proposed/new edit.
Definition at line 72 of file WikiPage.php.
Definition at line 87 of file WikiPage.php.
Referenced by WikiFilePage\getRedirectTarget(), and getRedirectTarget().
|
protected |
Timestamp of the current revision or empty string if not loaded.
Definition at line 97 of file WikiPage.php.
Definition at line 51 of file WikiPage.php.
Referenced by __clone(), doDeleteArticleBatched(), WikiFilePage\getForeignCategories(), and getTitle().
|
protected |
Definition at line 102 of file WikiPage.php.
Referenced by getTouched().