MediaWiki
1.27.2
|
Class representing a MediaWiki article and history. More...
Public Member Functions | |
__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) | |
Same as doDeleteArticleReal(), but returns a simple boolean. More... | |
doDeleteArticleReal ($reason, $suppress=false, $u1=null, $u2=null, &$error= '', User $user=null) | |
Back-end article deletion Deletes the article with database consistency, writes logs, purges caches. More... | |
doDeleteUpdates ($id, Content $content=null) | |
Do some database updates after deletion. More... | |
doEdit ($text, $summary, $flags=0, $baseRevId=false, $user=null) | |
Change an existing article or create a new article. More... | |
doEditContent (Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialFormat=null, $tags=null) | |
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... | |
doQuickEditContent (Content $content, User $user, $comment= '', $minor=false, $serialFormat=null) | |
Edit an article without doing all that other stuff The article must already exist; link tables etc are not updated, caches are not flushed. 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... | |
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 () | |
Returns overrides for action handlers. More... | |
getAutoDeleteReason (&$hasHistory) | |
Auto-generates a deletion reason. More... | |
getCategories () | |
#@- 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 (Content $content=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... | |
getOldestRevision () | |
Get the Revision object of the oldest revision. More... | |
getParserOutput (ParserOptions $parserOptions, $oldid=null) | |
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... | |
getText ($audience=Revision::FOR_PUBLIC, User $user=null) | |
Get the text of the current revision. More... | |
getTimestamp () | |
getTitle () | |
Get the title object of the article. More... | |
getTouched () | |
Get the page_touched field. More... | |
getUndoContent (Revision $undo, Revision $undoafter=null) | |
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) | |
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... | |
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... | |
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... | |
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... | |
prepareTextForEdit ($text, $revid=null, User $user=null) | |
Prepare text 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) | |
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... | |
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... | |
Static Public Member Functions | |
static | factory (Title $title) |
Create a WikiPage object of the appropriate class for the given title. More... | |
static | getAutosummary ($oldtext, $newtext, $flags) |
Return an applicable autosummary if one exists for the given edit. 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) |
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 | |
stdClass | $mPreparedEdit = false |
Map of cache fields (text, parser output, ect) for a proposed/new edit. More... | |
Title | $mTitle = null |
$mDataLoaded = false | |
$mIsRedirect = false | |
$mLatest = false | |
Public Attributes inherited from IDBAccessObject | |
const | READ_EXCLUSIVE = 7 |
const | READ_LATEST = 1 |
const | READ_LOCKING = 3 |
const | READ_NONE = -1 |
const | READ_NORMAL = 0 |
Protected Member Functions | |
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 | 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 | |
doCreate (Content $content, $flags, User $user, $summary, array $meta) | |
doModify (Content $content, $flags, User $user, $summary, array $meta) | |
Static Private Member Functions | |
static | convertSelectType ($type) |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants. More... | |
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 29 of file WikiPage.php.
WikiPage::__construct | ( | Title | $title | ) |
WikiPage::checkFlags | ( | $flags | ) |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
int | $flags |
Definition at line 1458 of file WikiPage.php.
References $flags, EDIT_NEW, EDIT_UPDATE, and exists().
Referenced by doEditContent().
WikiPage::checkTouched | ( | ) |
Loads page_touched and returns a value indicating if it should be used.
Definition at line 505 of file WikiPage.php.
References $mIsRedirect, and loadPageData().
WikiPage::clear | ( | ) |
Clear the object.
Definition at line 225 of file WikiPage.php.
References clearCacheFields().
Referenced by EditPageTest\forceRevisionDate(), and ApiEditPageTest\forceRevisionDate().
|
protected |
Clear the object cache fields.
Definition at line 236 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 256 of file WikiPage.php.
WikiPage::commitRollback | ( | $fromP, | |
$summary, | |||
$bot, | |||
& | $resultDetails, | ||
User | $guser, | ||
$tags = null |
|||
) |
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 3068 of file WikiPage.php.
References $args, $flags, $from, $revId, $s, $status, $summary, $user, $wgContLang, DB_MASTER, Revision\DELETED_TEXT, Revision\DELETED_USER, doEditContent(), EDIT_FORCE_BOT, EDIT_MINOR, EDIT_UPDATE, getRevision(), global, User\isAllowed(), User\isAllowedAny(), Revision\newFromId(), Revision\RAW, IDBAccessObject\READ_LATEST, Hooks\run(), TS_MW, wfGetDB(), wfMessage(), wfMsgReplaceArgs(), wfReadOnly(), and wfTimestamp().
Referenced by doRollback().
|
staticprivate |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
object | string | int | $type |
Definition at line 171 of file WikiPage.php.
References $type.
Content | $content | Pre-save transform content |
integer | $flags | |
User | $user | |
string | $summary | |
array | $meta |
DBUnexpectedError | |
Exception | |
FatalError | |
MWException |
Definition at line 1848 of file WikiPage.php.
References $content, $flags, $params, $status, $summary, $user, DB_MASTER, DBO_TRX, EDIT_MINOR, EDIT_SUPPRESS_RC, User\getId(), Content\getModel(), User\getName(), Content\getSize(), global, User\incEditCount(), insertOn(), Revision\insertOn(), Status\newGood(), RecentChange\notifyNew(), Content\prepareSave(), Hooks\run(), ContentHandler\runLegacyHooks(), updateRevisionOn(), use, wfGetDB(), and wfTimestampNow().
Referenced by doEditContent().
WikiPage::doDeleteArticle | ( | $reason, | |
$suppress = false , |
|||
$u1 = null , |
|||
$u2 = null , |
|||
& | $error = '' , |
||
User | $user = null |
||
) |
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 | $u1 | Unused |
bool | $u2 | Unused |
array | string | &$error | Array of errors to append to |
User | $user | The deleting user |
Definition at line 2759 of file WikiPage.php.
References $status, $user, and doDeleteArticleReal().
Referenced by WikiPageTest\testExists().
WikiPage::doDeleteArticleReal | ( | $reason, | |
$suppress = false , |
|||
$u1 = null , |
|||
$u2 = null , |
|||
& | $error = '' , |
||
User | $user = null |
||
) |
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 | $u1 | Unused |
bool | $u2 | Unused |
array | string | &$error | Array of errors to append to |
User | $user | The deleting user |
Definition at line 2783 of file WikiPage.php.
References $cache, $content, $key, $mTitle, $status, $user, $wgUser, DB_MASTER, Revision\DELETED_COMMENT, Revision\DELETED_RESTRICTED, Revision\DELETED_TEXT, Revision\DELETED_USER, doDeleteUpdates(), getContent(), getId(), getLatest(), ObjectCache\getMainStashInstance(), getTitle(), global, loadPageData(), lockAndGetLatest(), Status\newGood(), Revision\RAW, Hooks\run(), use, wfDebug(), wfEscapeWikiText(), wfGetDB(), and wfMemcKey().
Referenced by doDeleteArticle(), EditPageTest\testCreatePage(), and EditPageTest\testCreatePageTrx().
WikiPage::doDeleteUpdates | ( | $id, | |
Content | $content = null |
||
) |
Do some database updates after deletion.
int | $id | The page_id value of the page being deleted |
Content | $content | Optional 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. |
Definition at line 2966 of file WikiPage.php.
References $content, DeferredUpdates\addUpdate(), as, getDeletionUpdates(), isCountable(), loadFromRow(), NS_FILE, onArticleDelete(), and LinksUpdate\queueRecursiveJobsForTable().
Referenced by doDeleteArticleReal().
WikiPage::doEdit | ( | $text, | |
$summary, | |||
$flags = 0 , |
|||
$baseRevId = false , |
|||
$user = null |
|||
) |
Change an existing article or create a new article.
Updates RC and all necessary caches, optionally via the deferred update array.
string | $text | New text |
string | $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 |
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 | $baseRevId | The revision ID this edit was based off, if any. This is not the parent revision ID, rather the revision ID for older content used as the source for a rollback, for example. |
User | $user | The user doing the edit |
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.
Compatibility note: this function previously returned a boolean value indicating success/failure
Definition at line 1522 of file WikiPage.php.
References $content, $flags, $summary, $user, ContentHandler\deprecated(), doEditContent(), getTitle(), and ContentHandler\makeContent().
WikiPage::doEditContent | ( | Content | $content, |
$summary, | |||
$flags = 0 , |
|||
$baseRevId = false , |
|||
User | $user = null , |
||
$serialFormat = null , |
|||
$tags = null |
|||
) |
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 | $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 |
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 | $baseRevId | The revision ID this edit was based off, if any. This is not the parent revision ID, rather the revision ID for older content used as the source for a rollback, for example. |
User | $user | The user doing the edit |
string | $serialFormat | Format for storing the content in the database. |
array | null | $tags | Change tags to apply to this edit Callers are responsible for permission checks (with ChangeTags::canAddTagsAccompanyingChange) |
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 1585 of file WikiPage.php.
References $content, $flags, $handler, $status, $summary, $user, $wgUser, DeferredUpdates\addCallableUpdate(), array(), checkFlags(), doCreate(), doModify(), EDIT_AUTOSUMMARY, EDIT_FORCE_BOT, EDIT_MINOR, EDIT_UPDATE, getContent(), Content\getContentHandler(), getLatest(), ContentHandler\getLocalizedName(), Content\getModel(), getRevision(), global, isCountable(), isRedirect(), loadPageData(), Status\newFatal(), Status\newGood(), prepareContentForEdit(), Revision\RAW, Hooks\run(), ContentHandler\runLegacyHooks(), and use.
Referenced by commitRollback(), and doEdit().
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 2149 of file WikiPage.php.
References $content, $mPreparedEdit, $options, $title, $wgContLang, DeferredUpdates\addUpdate(), as, exists(), Revision\getContent(), getContentHandler(), getId(), Revision\getTimestamp(), getTitle(), User\getTitleKey(), global, User\isAllowed(), isCountable(), User\isIP(), Revision\isMinor(), User\newFromName(), RecentChangesUpdateJob\newPurgeJob(), NS_MEDIAWIKI, NS_USER_TALK, prepareContentForEdit(), Hooks\run(), ParserCache\singleton(), JobQueueGroup\singleton(), MessageCache\singleton(), and wfDebug().
Content | $content | Pre-save transform content |
integer | $flags | |
User | $user | |
string | $summary | |
array | $meta |
DBUnexpectedError | |
Exception | |
FatalError | |
MWException |
Definition at line 1681 of file WikiPage.php.
References $content, $flags, $params, $status, $summary, $user, DB_MASTER, DBO_TRX, EDIT_MINOR, EDIT_SUPPRESS_RC, Content\equals(), getId(), User\getId(), getLatest(), Content\getModel(), User\getName(), Content\getSize(), getTimestamp(), global, User\incEditCount(), lockAndGetLatest(), Status\newGood(), RecentChange\notifyEdit(), Content\prepareSave(), Hooks\run(), ContentHandler\runLegacyHooks(), updateRevisionOn(), use, wfGetDB(), and wfTimestampNow().
Referenced by doEditContent().
WikiPage::doPurge | ( | ) |
Perform the actions of a page purging.
Definition at line 1105 of file WikiPage.php.
References $content, $mTitle, $title, DeferredUpdates\addUpdate(), DB_MASTER, exists(), getContent(), NS_MEDIAWIKI, DeferredUpdates\PRESEND, Hooks\run(), MessageCache\singleton(), use, and wfGetDB().
WikiPage::doQuickEditContent | ( | Content | $content, |
User | $user, | ||
$comment = '' , |
|||
$minor = false , |
|||
$serialFormat = null |
|||
) |
Edit an article without doing all that other stuff The article must already exist; link tables etc are not updated, caches are not flushed.
Content | $content | Content submitted |
User | $user | The relevant user |
string | $comment | Comment submitted |
bool | $minor | Whereas it's a minor modification |
string | $serialFormat | Format for storing the content in the database |
Definition at line 2304 of file WikiPage.php.
References $comment, $serialized, DB_MASTER, getId(), User\getId(), User\getName(), Content\getSize(), getTitle(), Revision\insertOn(), Hooks\run(), Content\serialize(), updateRevisionOn(), and wfGetDB().
WikiPage::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.
user is the sole contributor. This function performs permissions checks on $user, then calls commitRollback() to do the dirty work
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 3022 of file WikiPage.php.
References $summary, commitRollback(), User\matchEditToken(), User\pingLimiter(), and wfArrayDiff2().
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[] | $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 2342 of file WikiPage.php.
References $key, $params, $wgContLang, as, DB_MASTER, getId(), User\getId(), getLatest(), global, insertProtectNullRevision(), InfoAction\invalidateCache(), loadPageData(), Status\newFatal(), Status\newGood(), protectDescriptionLog(), Title\purgeExpiredRestrictions(), Hooks\run(), wfGetDB(), 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 1086 of file WikiPage.php.
References $e, User\clearNotification(), MWExceptionHandler\logException(), Hooks\run(), and wfReadOnly().
WikiPage::exists | ( | ) |
Definition at line 442 of file WikiPage.php.
References loadPageData().
Referenced by LinksDeletionUpdate\__construct(), checkFlags(), doEditUpdates(), doPurge(), getContentModel(), hasViewableContent(), and shouldCheckParserCache().
|
static |
Create a WikiPage object of the appropriate class for the given title.
Title | $title |
MWException |
Definition at line 99 of file WikiPage.php.
References $page, Title\getNamespace(), NS_CATEGORY, NS_FILE, and NS_MEDIA.
Referenced by ParserTest\addArticle(), MediaWikiTestCase\addCoreDBData(), BackupDumperPageTest\addDBData(), TextPassDumperDatabaseTest\addDBData(), FetchTextTest\addDBData(), SpecialMyLanguageTest\addDBDataOnce(), CategoryMembershipChangeTest\addDBDataOnce(), EditPageTest\assertEdit(), WikiImporter\beforeImportPage(), Orphans\checkSeparation(), CleanupSpam\cleanupArticle(), Installer\createMainpage(), UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByTitle(), FileDeleteForm\doDelete(), DifferenceEngineTest\doEdits(), MovePageForm\doSubmit(), WatchAction\doUnwatch(), WatchAction\doWatch(), ApiTestCase\editPage(), CategoryMembershipChangeJobTest\editPageText(), CompareParserCache\execute(), ApiEditPage\execute(), ApiPurge\execute(), DeleteDefaultMessages\execute(), MakeTestEdits\execute(), ImportSiteScripts\execute(), ApiRollback\execute(), Protect\execute(), AttachLatest\execute(), ApiStashEdit\execute(), ApiParse\execute(), EditCLI\execute(), RollbackEdits\execute(), DeleteBatch\execute(), DeleteEqualMessages\execute(), WikiImporter\finishImportPage(), SearchNearMatcher\getNearMatchInternal(), ActionTest\getPage(), EditPage\getPreloadedContent(), AbstractContent\getRedirectChain(), ListredirectsPage\getRedirectTarget(), SearchExactMatchRescorer\getRedirectTarget(), ApiPageSet\getRedirectTargets(), ApiBase\getTitleOrPageId(), RequestContext\getWikiPage(), WikiRevision\importOldRevision(), MediaWiki\initializeArticle(), MediaWikiTestCase\insertPage(), MergeHistory\merge(), MovePage\moveToInternal(), RecentChange\newForCategorization(), SpecialChangeContentModel\onSubmit(), XmlDumpWriter\openPage(), DifferenceEngine\renderNewRevision(), ImportReporter\reportPage(), DeleteLinksJob\run(), DoubleRedirectJob\run(), RefreshLinksJob\runForTitle(), ApiFormatXmlTest\setUpBeforeClass(), SpecialUndelete\showDiff(), EditPageTest\testAutoMerge(), EditPageTest\testCheckDirectEditingDisallowed_forNonTextContent(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), TextContentTest\testDeletionUpdates(), ApiEditPageTest\testEdit_redirect(), ApiEditPageTest\testEdit_redirectText(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_bug41990(), ApiEditPageTest\testEditConflict_newSection(), UserTest\testEditCount(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), WikitextContentTest\testGetSecondaryDataUpdates(), WikiCategoryPageTest\testHiddenCategory_PropertyIsSet(), WikiCategoryPageTest\testHiddenCategory_PropertyNotSet(), ApiQueryAllPagesTest\testPrefixNormalizationSearchBug(), RefreshLinksPartitionTest\testRefreshLinks(), ApiEditPageTest\testSupportsDirectApiEditing_withContentHandlerOverride(), TemplateCategoriesTest\testTemplateCategories(), ArticleTablesTest\testTemplatelinksUsesContentLanguage(), MovePageTest\testTitleMoveCompleteIntegrationTest(), ImportTest\testUnknownXMLTags(), RevisionStorageTest\testUserWasLastToEdit(), RequestContextTest\testWikiPageTitle(), PageArchive\undeleteRevisions(), SpecialEditWatchlist\unwatchTitles(), 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 2728 of file WikiPage.php.
WikiPage::followRedirect | ( | ) |
Get the Title object or URL this page redirects to.
Definition at line 932 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 2640 of file WikiPage.php.
References $wgContLang, global, and wfMessage().
Referenced by protectDescription(), and protectDescriptionLog().
WikiPage::getActionOverrides | ( | ) |
Returns overrides for action handlers.
Classes listed here will be used instead of the default one when (and only when) $wgActions[$action] === true. This allows subclasses to override the default behavior.
Definition at line 195 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 3401 of file WikiPage.php.
References getContentHandler(), and getTitle().
|
static |
Return an applicable autosummary if one exists for the given edit.
string | null | $oldtext | The previous text of the page. |
string | null | $newtext | The submitted text of the page. |
int | $flags | Bitmask: a bitmask of flags submitted for the edit. |
Definition at line 3381 of file WikiPage.php.
References $flags, $handler, CONTENT_MODEL_WIKITEXT, ContentHandler\deprecated(), and ContentHandler\getForModelID().
Referenced by Article\getAutosummary().
WikiPage::getCategories | ( | ) |
#@-
Returns a list of categories this page is a member of. Results will include hidden categories
Definition at line 3325 of file WikiPage.php.
References $dbr, $res, DB_SLAVE, 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 770 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 654 of file WikiPage.php.
References $user, and loadLastEdit().
Referenced by doDeleteArticleReal(), doEditContent(), doPurge(), ApiParse\getContent(), getDeletionUpdates(), ApiParse\getParsedContent(), EditPage\getPreloadedContent(), insertRedirect(), isCountable(), prepareContentForEdit(), and replaceSectionAtRev().
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 209 of file WikiPage.php.
References getContentModel(), and ContentHandler\getForModelID().
Referenced by doEditUpdates(), getActionOverrides(), getAutoDeleteReason(), makeParserOptions(), replaceSectionAtRev(), shouldCheckParserCache(), and supportsSections().
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 484 of file WikiPage.php.
References $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 981 of file WikiPage.php.
References $dbr, $options, $res, $tables, $user, DB_SLAVE, getId(), getUser(), 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 733 of file WikiPage.php.
References $user, getOldestRevision(), and User\newFromName().
WikiPage::getDeletionUpdates | ( | Content | $content = 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.
Definition at line 3555 of file WikiPage.php.
References $content, getContent(), Revision\RAW, and Hooks\run().
Referenced by doDeleteUpdates().
WikiPage::getHiddenCategories | ( | ) |
Returns a list of hidden categories this page is a member of.
Uses the page_props and categorylinks tables.
Definition at line 3348 of file WikiPage.php.
References $dbr, $res, as, DB_SLAVE, getId(), Title\makeTitle(), NS_CATEGORY, and wfGetDB().
WikiPage::getId | ( | ) |
Definition at line 432 of file WikiPage.php.
References $mId, and loadPageData().
Referenced by LinksDeletionUpdate\__construct(), doDeleteArticleReal(), doEditUpdates(), doModify(), doQuickEditContent(), doUpdateRestrictions(), getCategories(), getContributors(), getHiddenCategories(), getRedirectTarget(), insertProtectNullRevision(), insertRedirectEntry(), isCountable(), loadLastEdit(), lockAndGetLatest(), replaceSectionAtRev(), triggerOpportunisticLinksUpdate(), updateIfNewerOn(), updateRedirectOn(), and updateRevisionOn().
WikiPage::getLatest | ( | ) |
Get the page_latest field.
Definition at line 538 of file WikiPage.php.
References $mLatest, and loadPageData().
Referenced by doDeleteArticleReal(), doEditContent(), doModify(), doUpdateRestrictions(), EditPageTest\forceRevisionDate(), ApiEditPageTest\forceRevisionDate(), getParserOutput(), insertRedirect(), loadLastEdit(), shouldCheckParserCache(), EditPageTest\testCreatePage(), and EditPageTest\testCreatePageTrx().
WikiPage::getLinksTimestamp | ( | ) |
Get the page_links_updated field.
Definition at line 527 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 784 of file WikiPage.php.
References loadLastEdit().
WikiPage::getOldestRevision | ( | ) |
Get the Revision object of the oldest revision.
Definition at line 549 of file WikiPage.php.
References DB_MASTER, DB_SLAVE, Revision\newFromRow(), Revision\selectFields(), and wfGetDB().
Referenced by getCreator().
WikiPage::getParserOutput | ( | ParserOptions | $parserOptions, |
$oldid = null |
|||
) |
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.
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) |
Definition at line 1055 of file WikiPage.php.
References $parserOutput, getLatest(), ParserOptions\getStubThreshold(), shouldCheckParserCache(), ParserCache\singleton(), wfDebug(), and wfIncrStats().
Referenced by ApiParse\getParsedContent(), and DifferenceEngine\getParserOutput().
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()
Definition at line 845 of file WikiPage.php.
References $dbr, $mRedirectTarget, DB_SLAVE, getId(), insertRedirect(), Title\makeTitle(), 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 943 of file WikiPage.php.
References $source.
Referenced by followRedirect().
WikiPage::getRevision | ( | ) |
Get the latest revision.
Definition at line 633 of file WikiPage.php.
References $mLastRevision, and loadLastEdit().
Referenced by PoolWorkArticleView\__construct(), commitRollback(), doEditContent(), getContentModel(), and getUndoContent().
WikiPage::getText | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
Get the text 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 the given user Revision::RAW get the text regardless of permissions |
User | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 674 of file WikiPage.php.
References $user, ContentHandler\deprecated(), and loadLastEdit().
WikiPage::getTimestamp | ( | ) |
Definition at line 687 of file WikiPage.php.
References loadLastEdit(), TS_MW, and wfTimestamp().
Referenced by doModify().
WikiPage::getTitle | ( | ) |
Get the title object of the article.
Definition at line 217 of file WikiPage.php.
References $mTitle.
Referenced by PoolWorkArticleView\__construct(), doDeleteArticleReal(), doEdit(), doEditUpdates(), doQuickEditContent(), getAutoDeleteReason(), ApiParse\getContent(), ApiParse\getParsedContent(), WikiCategoryPage\isHidden(), lockAndGetLatest(), makeParserOptions(), Article\newFromWikiPage(), CategoryMembershipChangeJob\notifyUpdatesForRevision(), ApiStashEdit\parseAndStash(), prepareContentForEdit(), prepareTextForEdit(), RequestContext\setWikiPage(), and updateRedirectOn().
WikiPage::getTouched | ( | ) |
Get the page_touched field.
Definition at line 516 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 1343 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 714 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 | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 752 of file WikiPage.php.
References $user, and loadLastEdit().
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.
Definition at line 457 of file WikiPage.php.
References exists().
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 1156 of file WikiPage.php.
References wfRandom().
Referenced by 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 2595 of file WikiPage.php.
References $user, $wgContLang, DB_MASTER, getId(), global, 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 884 of file WikiPage.php.
References $content, $retval, DeferredUpdates\addCallableUpdate(), getContent(), getLatest(), and use.
Referenced by getRedirectTarget().
WikiPage::insertRedirectEntry | ( | Title | $rt, |
$oldLatest = null |
|||
) |
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 906 of file WikiPage.php.
References DB_MASTER, Title\getDBkey(), Title\getFragment(), getId(), Title\getInterwiki(), Title\getNamespace(), lockAndGetLatest(), and wfGetDB().
Referenced by updateRedirectOn().
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.
object | bool | $editInfo | (false): object returned by prepareTextForEdit(), if false, the current database state will be used |
Definition at line 801 of file WikiPage.php.
References $content, DB_SLAVE, getContent(), getId(), global, and wfGetDB().
Referenced by doDeleteUpdates(), doEditContent(), and doEditUpdates().
WikiPage::isRedirect | ( | ) |
Tests if the article content represents a redirect.
Definition at line 466 of file WikiPage.php.
References $mIsRedirect, and loadPageData().
Referenced by doEditContent(), and EditPage\getPreloadedContent().
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 392 of file WikiPage.php.
References $from, $mLatest, clearCacheFields(), LinkCache\singleton(), TS_MW, 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 587 of file WikiPage.php.
References $flags, getId(), getLatest(), Revision\newFromPageId(), IDBAccessObject\READ_LATEST, IDBAccessObject\READ_LOCKING, and setLastEdit().
Referenced by getComment(), getContent(), getMinorEdit(), getRevision(), getText(), 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 352 of file WikiPage.php.
References $from, DB_SLAVE, DBAccessObjectUtils\getDBOptions(), list, loadFromRow(), pageDataFromTitle(), wfGetDB(), and wfGetLB().
Referenced by checkTouched(), doDeleteArticleReal(), doEditContent(), doUpdateRestrictions(), exists(), getId(), getLatest(), getLinksTimestamp(), getTouched(), and isRedirect().
WikiPage::lockAndGetLatest | ( | ) |
Lock the page row for this title+id and return page_latest (or 0)
Definition at line 2942 of file WikiPage.php.
References DB_MASTER, getId(), getTitle(), and wfGetDB().
Referenced by doDeleteArticleReal(), 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 1974 of file WikiPage.php.
References $context, $options, getContentHandler(), and getTitle().
Referenced by DifferenceEngine\getParserOutput(), ApiParse\makeParserOptions(), and prepareContentForEdit().
|
static |
Constructor from a page id.
int | $id | Article ID to load |
string | int | $from | One of the following values:
|
Definition at line 132 of file WikiPage.php.
References $from, DB_MASTER, DB_SLAVE, and wfGetDB().
Referenced by RefreshLinks\fixLinksFromArticle(), RefreshLinks\fixRedirect(), SearchUpdate\getLatestPage(), ApiBase\getTitleOrPageId(), 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 159 of file WikiPage.php.
References $from, $page, and Title\newFromRow().
|
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 3236 of file WikiPage.php.
References Title\deleteTitleProtection(), Title\getOtherPage(), Title\purgeSquid(), and Title\touchLinks().
Referenced by MovePage\moveToInternal(), and Article\onArticleCreate().
|
static |
Clears caches when article is deleted.
Title | $title |
Definition at line 3252 of file WikiPage.php.
References $user, $wgContLang, DeferredUpdates\addUpdate(), HTMLFileCache\clearFileCache(), false, Title\getDBkey(), Title\getNamespace(), Title\getOtherPage(), Title\getText(), global, InfoAction\invalidateCache(), User\newFromName(), NS_FILE, NS_MEDIAWIKI, NS_USER_TALK, Title\purgeSquid(), RepoGroup\singleton(), MessageCache\singleton(), and Title\touchLinks().
Referenced by doDeleteUpdates(), MovePage\moveToInternal(), and Article\onArticleDelete().
Purge caches on page update etc.
Definition at line 3299 of file WikiPage.php.
References DeferredUpdates\addCallableUpdate(), DeferredUpdates\addUpdate(), HTMLFileCache\clearFileCache(), InfoAction\invalidateCache(), Title\purgeSquid(), and use.
Referenced by Article\onArticleEdit().
|
protected |
Fetch a page record with the given conditions.
IDatabase | $dbr | |
array | $conditions | |
array | $options |
Definition at line 301 of file WikiPage.php.
References $dbr, $options, 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 336 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.
Definition at line 322 of file WikiPage.php.
References $dbr, $options, $title, and pageData().
Referenced by loadPageData().
WikiPage::prepareContentForEdit | ( | Content | $content, |
$revision = null , |
|||
User | $user = null , |
||
$serialFormat = null , |
|||
$useCache = true |
|||
) |
Prepare content which is about to be saved.
Returns a stdClass with source, pst and output members
Content | $content | |
Revision | int | null | $revision | Revision object. For backwards compatibility, a revision ID is also accepted, but this is deprecated. |
User | null | $user | |
string | null | $serialFormat | |
bool | $useCache | Check shared prepared edit cache |
Definition at line 2017 of file WikiPage.php.
References $content, $mPreparedEdit, $parser, $title, $user, $wgContLang, $wgUser, ApiStashEdit\checkCache(), Title\equals(), getContent(), Content\getContentHandler(), ContentHandler\getContentText(), getTitle(), global, makeParserOptions(), Revision\newFromId(), ParserOptions\newFromUserAndLang(), object, Content\preSaveTransform(), Revision\RAW, IDBAccessObject\READ_LATEST, Hooks\run(), use, and wfTimestampNow().
Referenced by doEditContent(), doEditUpdates(), ApiStashEdit\parseAndStash(), and prepareTextForEdit().
WikiPage::prepareTextForEdit | ( | $text, | |
$revid = null , |
|||
User | $user = null |
||
) |
Prepare text which is about to be saved.
Returns a stdClass with source, pst and output members
string | $text | |
int | null | $revid | |
User | null | $user |
Definition at line 1996 of file WikiPage.php.
References $content, $user, ContentHandler\deprecated(), getTitle(), ContentHandler\makeContent(), and prepareContentForEdit().
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 2663 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 2705 of file WikiPage.php.
References $wgContLang, as, formatExpiry(), and global.
Referenced by doUpdateRestrictions().
WikiPage::replaceSectionAtRev | ( | $sectionId, | |
Content | $sectionContent, | ||
$sectionTitle = '' , |
|||
$baseRevId = null |
|||
) |
string | number | 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 1415 of file WikiPage.php.
References $rev, $sectionContent, getContent(), getContentHandler(), getId(), Revision\newFromId(), supportsSections(), and wfDebug().
Referenced by replaceSectionContent().
WikiPage::replaceSectionContent | ( | $sectionId, | |
Content | $sectionContent, | ||
$sectionTitle = '' , |
|||
$edittime = null |
|||
) |
string | number | 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 1376 of file WikiPage.php.
References $dbr, $rev, DB_MASTER, DB_SLAVE, Revision\loadFromTimestamp(), replaceSectionAtRev(), wfGetDB(), and wfGetLB().
|
static |
Return the list of revision fields that should be selected to create a new page.
Definition at line 266 of file WikiPage.php.
References global.
Referenced by Title\getLinksFrom(), Article\selectFields(), and ArticleTest\testStaticFunctions().
|
protected |
Set the latest revision.
Revision | $revision |
Definition at line 624 of file WikiPage.php.
References Revision\getTimestamp().
Referenced by 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 701 of file WikiPage.php.
References TS_MW, and wfTimestamp().
WikiPage::shouldCheckParserCache | ( | ParserOptions | $parserOptions, |
$oldId | |||
) |
Should the parser cache be used?
ParserOptions | $parserOptions | ParserOptions to check |
int | $oldId |
Definition at line 1035 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 1358 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 3501 of file WikiPage.php.
References $cache, $key, $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.
array | $added | The names of categories that were added |
array | $deleted | The names of categories that were deleted |
Definition at line 3412 of file WikiPage.php.
References as, DB_MASTER, Category\newFromName(), NS_CATEGORY, NS_FILE, 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.
Definition at line 1306 of file WikiPage.php.
References $ret, getId(), TS_MW, updateRevisionOn(), and wfTimestamp().
WikiPage::updateRedirectOn | ( | $dbw, | |
$redirectTitle, | |||
$lastRevIsRedirect = null |
|||
) |
Add row to the redirect table if this is a redirect, remove otherwise.
IDatabase | $dbw | |
Title | $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 1271 of file WikiPage.php.
References getId(), getTitle(), insertRedirectEntry(), NS_FILE, and RepoGroup\singleton().
Referenced by updateRevisionOn().
WikiPage::updateRevisionOn | ( | $dbw, | |
$revision, | |||
$lastRevision = null , |
|||
$lastRevIsRedirect = null |
|||
) |
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 | $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 | $lastRevIsRedirect | If given, will optimize adding and removing rows in redirect table. |
Definition at line 1200 of file WikiPage.php.
References $content, getId(), global, setLastEdit(), LinkCache\singleton(), and updateRedirectOn().
Referenced by doCreate(), doModify(), doQuickEditContent(), insertProtectNullRevision(), and updateIfNewerOn().
WikiPage::$mDataLoaded = false |
|
protected |
One of the READ_* constants.
Definition at line 56 of file WikiPage.php.
|
protected |
Definition at line 51 of file WikiPage.php.
Referenced by getId().
WikiPage::$mIsRedirect = false |
{
Definition at line 41 of file WikiPage.php.
Referenced by checkTouched(), and isRedirect().
|
protected |
Definition at line 66 of file WikiPage.php.
Referenced by getRevision().
WikiPage::$mLatest = false |
{
Definition at line 42 of file WikiPage.php.
Referenced by getLatest(), and loadFromRow().
|
protected |
Definition at line 81 of file WikiPage.php.
Referenced by getLinksTimestamp().
stdClass WikiPage::$mPreparedEdit = false |
Map of cache fields (text, parser output, ect) for a proposed/new edit.
Definition at line 46 of file WikiPage.php.
Referenced by doEditUpdates(), and prepareContentForEdit().
|
protected |
Definition at line 61 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 71 of file WikiPage.php.
Title WikiPage::$mTitle = null |
Definition at line 35 of file WikiPage.php.
Referenced by doDeleteArticleReal(), doPurge(), WikiFilePage\getForeignCategories(), and getTitle().
|
protected |
Definition at line 76 of file WikiPage.php.
Referenced by getTouched().