MediaWiki
1.23.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) | |
Backend implementation of doRollback(), please refer there for parameter and return value documentation. More... | |
doCascadeProtectionUpdates (ParserOutput $parserOutput) | |
Updates cascading protections. More... | |
doDeleteArticle ( $reason, $suppress=false, $id=0, $commit=true, &$error='', User $user=null) | |
Same as doDeleteArticleReal(), but returns a simple boolean. More... | |
doDeleteArticleReal ( $reason, $suppress=false, $id=0, $commit=true, &$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, $serialisation_format=null) | |
Change an existing article or create a new article. More... | |
doEditUpdates (Revision $revision, User $user, array $options=array()) | |
Do standard deferred updates after page edit. More... | |
doPurge () | |
Perform the actions of a page purging. More... | |
doQuickEdit ( $text, User $user, $comment='', $minor=0) | |
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... | |
doQuickEditContent (Content $content, User $user, $comment='', $minor=false, $serialisation_format=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) | |
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) | |
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... | |
estimateRevisionCount () | |
Get the approximate revision count of this 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... | |
getCount () | |
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 () | |
getLastNAuthors ( $num, $revLatest=0) | |
Get the last N authors. More... | |
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... | |
getRawText () | |
Get the text of the current revision. 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... | |
getUndoText (Revision $undo, Revision $undoafter=null) | |
Get the text that needs to be saved in order to undo all revisions between $undo and $undoafter. More... | |
getUsedTemplates () | |
Return a list of templates used by this article. 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) | |
Insert a new empty page record for this article. More... | |
insertProtectNullRevision ( $revCommentMsg, array $limit, array $expiry, $cascade, $reason) | |
Insert a new null revision for this page. More... | |
insertRedirect () | |
Insert an entry for this page into the redirect table. More... | |
insertRedirectEntry ( $rt) | |
Insert or update the redirect table entry for this page to indicate it redirects to $rt . More... | |
isBigDeletion () | |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. 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... | |
isParserCacheUsed (ParserOptions $parserOptions, $oldid) | |
Should the parser cache be used? 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') | |
Set the general counter, title etc data loaded from some source. More... | |
makeParserOptions ( $context) | |
Get parser options suitable for rendering the primary article wikitext. More... | |
pageDataFromId ( $dbr, $id, $options=array()) | |
Fetch a page record matching the requested ID. More... | |
pageDataFromTitle ( $dbr, $title, $options=array()) | |
Fetch a page record matching the Title object's namespace and title using a sanitized title string. More... | |
prepareContentForEdit (Content $content, $revid=null, User $user=null, $serialization_format=null) | |
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... | |
preSaveTransform ( $text, User $user=null, ParserOptions $popts=null) | |
This function is called right before saving the wikitext, so we can do things like signatures and links-in-context. 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... | |
replaceSection ( $section, $text, $sectionTitle='', $edittime=null) | |
replaceSectionContent ( $section, Content $sectionContent, $sectionTitle='', $edittime=null) | |
setCachedLastEditTime ( $timestamp) | |
Set the cached timestamp for the last time the page changed. More... | |
setTimestamp ( $ts) | |
Set the page timestamp (use only to avoid DB queries) More... | |
supportsSections () | |
Returns true if this page's content model supports sections. 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... | |
updateRestrictions ( $limit=array(), $reason='', &$cascade=0, $expiry=array(), User $user=null) | |
Update the article's restriction field, and leave a log entry. 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) |
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) |
Clears caches when article is deleted. More... | |
static | onArticleEdit ( $title) |
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 | |
$mDataLoadedFrom = self::READ_NONE | |
$mPreparedEdit = false | |
$mTimestamp = '' | |
Title | $mTitle = null |
$mDataLoaded = false | |
$mIsRedirect = false | |
$mLatest = false | |
Public Attributes inherited from IDBAccessObject | |
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) | |
getCachedLastEditTime () | |
Get the cached timestamp for the last time the page changed. More... | |
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=array()) | |
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 null | $mCounter = null |
int | $mId = null |
Revision | $mLastRevision = null |
string | $mLinksUpdated = '19700101000000' |
Title | $mRedirectTarget = null |
string | $mTouched = '19700101000000' |
int | |
one of the READ_* constants More... | |
string | |
timestamp of the current revision or empty string if not loaded More... | |
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 37 of file WikiPage.php.
WikiPage::__construct | ( | Title | $title | ) |
WikiPage::checkFlags | ( | $flags | ) |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
$flags | Int |
Definition at line 1568 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 523 of file WikiPage.php.
References $mIsRedirect, and loadPageData().
WikiPage::clear | ( | ) |
Clear the object.
Definition at line 229 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 240 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 261 of file WikiPage.php.
WikiPage::commitRollback | ( | $fromP, | |
$summary, | |||
$bot, | |||
& | $resultDetails, | ||
User | $guser | ||
) |
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. |
$bot | Boolean: If true, mark all reverted edits as bot. | |
array | $resultDetails | contains result-specific array of additional values |
$guser | User The user performing the rollback |
Definition at line 2914 of file WikiPage.php.
References $args, $flags, $from, $s, $summary, $user, $wgContLang, array(), DB_MASTER, Revision\DELETED_TEXT, Revision\DELETED_USER, doEditContent(), EDIT_FORCE_BOT, EDIT_MINOR, EDIT_UPDATE, getRevision(), global, User\isAllowed(), User\isAllowedAny(), Revision\newFromId(), TS_MW, wfGetDB(), wfMessage(), wfMsgReplaceArgs(), wfReadOnly(), wfRunHooks(), and wfTimestamp().
Referenced by doRollback().
|
staticprivate |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
$type | object|string|int |
Definition at line 175 of file WikiPage.php.
References $type, IDBAccessObject\READ_LATEST, IDBAccessObject\READ_LOCKING, and IDBAccessObject\READ_NORMAL.
Referenced by loadFromRow(), loadPageData(), and newFromID().
WikiPage::doCascadeProtectionUpdates | ( | ParserOutput | $parserOutput | ) |
Updates cascading protections.
$parserOutput | ParserOutput object for the current version |
Definition at line 3309 of file WikiPage.php.
References $dbr, $res, array(), as, DB_SLAVE, getId(), ParserOutput\getImages(), ParserOutput\getTemplates(), NS_FILE, wfGetDB(), and wfReadOnly().
WikiPage::doDeleteArticle | ( | $reason, | |
$suppress = false , |
|||
$id = 0 , |
|||
$commit = true , |
|||
& | $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 |
$suppress | boolean suppress all revisions and log the deletion in the suppression log instead of the deletion log | |
int | $id | article ID |
$commit | boolean defaults to true, triggers transaction end | |
&$error | Array of errors to append to | |
$user | User The deleting user |
Definition at line 2664 of file WikiPage.php.
References $error, $user, and doDeleteArticleReal().
Referenced by WikiPageTest\testExists().
WikiPage::doDeleteArticleReal | ( | $reason, | |
$suppress = false , |
|||
$id = 0 , |
|||
$commit = true , |
|||
& | $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 |
$suppress | boolean suppress all revisions and log the deletion in the suppression log instead of the deletion log | |
int | $id | article ID |
$commit | boolean defaults to true, triggers transaction end | |
&$error | Array of errors to append to | |
$user | User The deleting user |
Definition at line 2688 of file WikiPage.php.
References $error, $ok, $user, $wgUser, array(), DB_MASTER, Revision\DELETED_COMMENT, Revision\DELETED_RESTRICTED, Revision\DELETED_TEXT, Revision\DELETED_USER, doDeleteUpdates(), getContent(), getTitle(), global, loadPageData(), Status\newGood(), Revision\RAW, wfDebug(), wfEscapeWikiText(), wfGetDB(), and wfRunHooks().
Referenced by doDeleteArticle().
WikiPage::doDeleteUpdates | ( | $id, | |
Content | $content = null |
||
) |
Do some database updates after deletion.
int | $id | 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 2822 of file WikiPage.php.
References DeferredUpdates\addUpdate(), getDeletionUpdates(), isCountable(), loadFromRow(), NS_FILE, onArticleDelete(), LinksUpdate\queueRecursiveJobsForTable(), and DataUpdate\runUpdates().
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 |
$flags | Integer 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_DEFER_UPDATES Defer some of the updates until the end of index.php 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 | int the revision ID this edit was based off, if any |
$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 1629 of file WikiPage.php.
References $flags, $summary, $user, ContentHandler\deprecated(), doEditContent(), getTitle(), and ContentHandler\makeContent().
WikiPage::doEditContent | ( | Content | $content, |
$summary, | |||
$flags = 0 , |
|||
$baseRevId = false , |
|||
User | $user = null , |
||
$serialisation_format = 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 |
$flags | Integer 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_DEFER_UPDATES Defer some of the updates until the end of index.php 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 |
$user | User the user doing the edit | |
$serialisation_format | String: format for storing the content in the database |
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
Definition at line 1685 of file WikiPage.php.
References $changed, $e, $flags, $ok, $serialized, $summary, $user, $wgUser, array(), checkFlags(), DB_MASTER, doEditUpdates(), DeferredUpdates\doUpdates(), EDIT_AUTOSUMMARY, EDIT_DEFER_UPDATES, EDIT_FORCE_BOT, EDIT_MINOR, EDIT_SUPPRESS_RC, EDIT_UPDATE, Content\equals(), getContent(), Content\getContentHandler(), getId(), getLatest(), ContentHandler\getLocalizedName(), Content\getModel(), Content\getSize(), getTimestamp(), getTitle(), global, insertOn(), isCountable(), isRedirect(), Content\isValid(), loadPageData(), Status\newFatal(), Status\newGood(), RecentChange\notifyEdit(), RecentChange\notifyNew(), prepareContentForEdit(), Content\prepareSave(), Revision\RAW, PatrolLog\record(), ContentHandler\runLegacyHooks(), updateRevisionOn(), wfDebug(), wfGetDB(), wfProfileIn(), wfProfileOut(), wfRunHooks(), and wfTimestampNow().
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 object | |
$user | User object that did the revision | |
array | $options | of options, following indexes are used:
|
Definition at line 2112 of file WikiPage.php.
References $mPreparedEdit, $options, $title, $total, $user, DeferredUpdates\addUpdate(), array(), exists(), Revision\getContent(), getId(), Revision\getId(), getTitle(), global, int, isCountable(), User\isIP(), Revision\isMinor(), User\newFromName(), NS_MEDIAWIKI, NS_USER_TALK, onArticleCreate(), onArticleEdit(), prepareContentForEdit(), RecentChange\purgeExpiredChanges(), DataUpdate\runUpdates(), ParserCache\singleton(), MessageCache\singleton(), wfDebug(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by doEditContent().
WikiPage::doPurge | ( | ) |
Perform the actions of a page purging.
Reimplemented in WikiFilePage.
Definition at line 1192 of file WikiPage.php.
References array(), DB_MASTER, exists(), getContent(), global, SquidUpdate\newSimplePurge(), NS_MEDIAWIKI, MessageCache\singleton(), wfGetDB(), and wfRunHooks().
WikiPage::doQuickEdit | ( | $text, | |
User | $user, | ||
$comment = '' , |
|||
$minor = 0 |
|||
) |
Edit an article without doing all that other stuff The article must already exist; link tables etc are not updated, caches are not flushed.
string | $text | text submitted |
$user | User The relevant user | |
string | $comment | comment submitted |
$minor | Boolean: whereas it's a minor modification |
Definition at line 2240 of file WikiPage.php.
References $comment, $user, ContentHandler\deprecated(), doQuickEditContent(), getTitle(), and ContentHandler\makeContent().
WikiPage::doQuickEditContent | ( | Content | $content, |
User | $user, | ||
$comment = '' , |
|||
$minor = false , |
|||
$serialisation_format = 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 |
string | $serialisation_format | Format for storing the content in the database |
bool | $minor | Whereas it's a minor modification |
Definition at line 2258 of file WikiPage.php.
References $comment, $serialized, $user, array(), DB_MASTER, getId(), Content\getSize(), getTitle(), Revision\insertOn(), Content\serialize(), updateRevisionOn(), wfGetDB(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by doQuickEdit().
WikiPage::doRollback | ( | $fromP, | |
$summary, | |||
$token, | |||
$bot, | |||
& | $resultDetails, | ||
User | $user | ||
) |
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. |
$bot | Boolean: If true, mark all reverted edits as bot. | |
array | $resultDetails | contains result-specific array of additional values 'alreadyrolled' : 'current' (rev) success : 'summary' (str), 'current' (rev), 'target' (rev) |
$user | User The user performing the rollback |
Definition at line 2872 of file WikiPage.php.
References $summary, $user, array(), commitRollback(), and wfArrayDiff2().
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 |
Definition at line 2293 of file WikiPage.php.
References $changed, $limit, $params, $user, $wgContLang, array(), as, DB_MASTER, getId(), getLatest(), global, insertProtectNullRevision(), InfoAction\invalidateCache(), loadPageData(), Status\newFatal(), Status\newGood(), protectDescriptionLog(), Title\purgeExpiredRestrictions(), wfGetDB(), wfReadOnly(), wfReadOnlyReason(), and wfRunHooks().
Referenced by updateRestrictions().
WikiPage::doViewUpdates | ( | User | $user, |
$oldid = 0 |
|||
) |
Do standard deferred updates after page view (existing or missing page)
User | $user | The relevant user |
int | $oldid | The revision id being viewed. If not given or 0, latest revision is assumed. |
Definition at line 1172 of file WikiPage.php.
References $user, DeferredUpdates\addUpdate(), exists(), getId(), global, and wfReadOnly().
WikiPage::estimateRevisionCount | ( | ) |
Get the approximate revision count of this page.
Definition at line 3424 of file WikiPage.php.
References wfDeprecated().
WikiPage::exists | ( | ) |
Definition at line 448 of file WikiPage.php.
References loadPageData().
Referenced by LinksDeletionUpdate\__construct(), checkFlags(), doEditUpdates(), doPurge(), doViewUpdates(), getContentModel(), hasViewableContent(), and isParserCacheUsed().
|
static |
Create a WikiPage object of the appropriate class for the given title.
Title | $title |
MWException |
Definition at line 103 of file WikiPage.php.
References $title, NS_CATEGORY, NS_FILE, and NS_MEDIA.
Referenced by MediaWikiTestCase\addCoreDBData(), BackupDumperPageTest\addDBData(), TextPassDumperTest\addDBData(), FetchTextTest\addDBData(), EditPageTest\assertEdit(), Orphans\checkSeparation(), CleanupSpam\cleanupArticle(), Installer\createMainpage(), UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByTitle(), FileDeleteForm\doDelete(), DifferenceEngineTest\doEdits(), MovePageForm\doSubmit(), WatchAction\doUnwatch(), WatchAction\doWatch(), ApiTestCase\editPage(), ApiEditPage\execute(), ApiParse\execute(), ApiPurge\execute(), ApiRollback\execute(), DeleteDefaultMessages\execute(), ImportSiteScripts\execute(), Protect\execute(), RollbackEdits\execute(), AttachLatest\execute(), EditCLI\execute(), DeleteBatch\execute(), DeleteEqualMessages\execute(), SearchEngine\getNearMatchInternal(), AbstractContent\getRedirectChain(), ListredirectsPage\getRedirectTarget(), ApiPageSet\getRedirectTargets(), RequestContext\getWikiPage(), WikiRevision\importOldRevision(), SearchEngineTest\insertPage(), InfoAction\invalidateCache(), SpecialMergeHistory\merge(), Title\moveToInternal(), newFromRow(), XmlDumpWriter\openPage(), DifferenceEngine\renderNewRevision(), ImportReporter\reportPage(), DoubleRedirectJob\run(), RefreshLinksJob\runForTitle(), SpecialUndelete\showDiff(), EditPageTest\testAutoMerge(), ArticleTablesTest\testbug14404(), ApiQueryAllPagesTest\testBug25702(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), TextContentTest\testDeletionUpdates(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_bug41990(), ApiEditPageTest\testEditConflict_redirect(), UserTest\testEditCount(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), WikitextContentTest\testGetSecondaryDataUpdates(), UploadFromUrlTest\testLeaveMessage(), ApiEditPageTest\testNonTextEdit(), RefreshLinksPartitionTest\testRefreshLinks(), TemplateCategoriesTest\testTemplateCategories(), RevisionStorageTest\testUserWasLastToEdit(), RequestContextTest\testWikiPageTitle(), PageArchive\undeleteRevisions(), SpecialEditWatchlist\unwatchTitles(), LinksUpdate\updateCategoryCounts(), LinksDeletionUpdate\updateCategoryCounts(), and Title\updateTitleProtection().
|
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 2633 of file WikiPage.php.
WikiPage::followRedirect | ( | ) |
Get the Title object or URL this page redirects to.
Reimplemented in WikiFilePage.
Definition at line 960 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 2545 of file WikiPage.php.
References $dbr, $wgContLang, DB_SLAVE, global, wfGetDB(), 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.
Reimplemented in WikiFilePage.
Definition at line 199 of file WikiPage.php.
References getContentHandler().
Referenced by Action\factory().
WikiPage::getAutoDeleteReason | ( | & | $hasHistory | ) |
Auto-generates a deletion reason.
&$hasHistory | Boolean: whether the page has a history |
Definition at line 3232 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 3213 of file WikiPage.php.
References $flags, CONTENT_MODEL_WIKITEXT, ContentHandler\deprecated(), and ContentHandler\getForModelID().
Referenced by Article\getAutosummary().
|
protected |
Get the cached timestamp for the last time the page changed.
This is only used to help handle slave lag by comparing to page_touched.
Definition at line 819 of file WikiPage.php.
References $wgMemc, global, and wfMemcKey().
Referenced by loadPageData().
WikiPage::getCategories | ( | ) |
#-
Returns a list of categories this page is a member of. Results will include hidden categories
Definition at line 3157 of file WikiPage.php.
References $dbr, $res, array(), DB_SLAVE, getId(), TitleArray\newFromResult(), NS_CATEGORY, and wfGetDB().
WikiPage::getComment | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
$audience | Integer: 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 object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 791 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...
$audience | Integer: 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 object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 663 of file WikiPage.php.
References $user, and loadLastEdit().
Referenced by doDeleteArticleReal(), doEditContent(), doPurge(), getDeletionUpdates(), ApiParse\getParsedContent(), insertRedirect(), isCountable(), isRedirect(), prepareContentForEdit(), and replaceSectionContent().
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 213 of file WikiPage.php.
References getContentModel(), and ContentHandler\getForModelID().
Referenced by getActionOverrides(), getAutoDeleteReason(), getUndoText(), isParserCacheUsed(), makeParserOptions(), replaceSection(), replaceSectionContent(), 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 502 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 1012 of file WikiPage.php.
References $dbr, $options, $res, $tables, $user, array(), DB_SLAVE, getId(), getUser(), UserArrayFromResult, and wfGetDB().
WikiPage::getCount | ( | ) |
Definition at line 470 of file WikiPage.php.
References $mCounter, and loadPageData().
WikiPage::getCreator | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
Get the User object of the user who created the page.
$audience | Integer: 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 object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 754 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 3457 of file WikiPage.php.
References array(), getContent(), Revision\RAW, and wfRunHooks().
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 3180 of file WikiPage.php.
References $dbr, $res, array(), as, DB_SLAVE, getId(), Title\makeTitle(), NS_CATEGORY, and wfGetDB().
WikiPage::getId | ( | ) |
Definition at line 438 of file WikiPage.php.
References $mId, and loadPageData().
Referenced by doCascadeProtectionUpdates(), doEditContent(), doEditUpdates(), doQuickEditContent(), doUpdateRestrictions(), doViewUpdates(), getCategories(), getContributors(), getHiddenCategories(), getRedirectTarget(), insertProtectNullRevision(), insertRedirectEntry(), isCountable(), loadLastEdit(), replaceSectionContent(), updateIfNewerOn(), updateRedirectOn(), and updateRevisionOn().
WikiPage::getLastNAuthors | ( | $num, | |
$revLatest = 0 |
|||
) |
Get the last N authors.
int | $num | Number of revisions to get |
int | string | $revLatest | the latest rev_id, selected from the master (optional) |
Definition at line 1064 of file WikiPage.php.
References $res, array(), as, DB_MASTER, DB_SLAVE, wfGetDB(), wfProfileIn(), and wfProfileOut().
WikiPage::getLatest | ( | ) |
Get the page_latest field.
Definition at line 556 of file WikiPage.php.
References $mLatest, and loadPageData().
Referenced by doEditContent(), doUpdateRestrictions(), EditPageTest\forceRevisionDate(), ApiEditPageTest\forceRevisionDate(), getParserOutput(), isParserCacheUsed(), and loadLastEdit().
WikiPage::getLinksTimestamp | ( | ) |
Get the page_links_updated field.
Definition at line 545 of file WikiPage.php.
References $mLinksUpdated, and loadPageData().
WikiPage::getMinorEdit | ( | ) |
Returns true if last revision was marked as "minor edit".
Definition at line 805 of file WikiPage.php.
References loadLastEdit().
WikiPage::getOldestRevision | ( | ) |
Get the Revision object of the oldest revision.
Definition at line 567 of file WikiPage.php.
References array(), DB_MASTER, DB_SLAVE, Revision\newFromRow(), Revision\selectFields(), wfGetDB(), wfProfileIn(), and wfProfileOut().
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.
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 1138 of file WikiPage.php.
References getLatest(), ParserOptions\getStubThreshold(), isParserCacheUsed(), ParserCache\singleton(), wfDebug(), wfIncrStats(), wfProfileIn(), and wfProfileOut().
Referenced by ApiParse\getParsedContent(), and DifferenceEngine\getParserOutput().
WikiPage::getRawText | ( | ) |
Get the text of the current revision.
No side-effects...
Definition at line 699 of file WikiPage.php.
References ContentHandler\deprecated(), getText(), and Revision\RAW.
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 889 of file WikiPage.php.
References $dbr, $mRedirectTarget, array(), DB_SLAVE, getId(), insertRedirect(), Title\makeTitle(), and wfGetDB().
Referenced by followRedirect().
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.
$rt | Title Redirect target |
Definition at line 971 of file WikiPage.php.
References $source, and array().
Referenced by followRedirect().
WikiPage::getRevision | ( | ) |
Get the latest revision.
Definition at line 642 of file WikiPage.php.
References $mLastRevision, and loadLastEdit().
Referenced by commitRollback(), getContentModel(), and getUndoContent().
WikiPage::getText | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
Get the text of the current revision.
No side-effects...
$audience | Integer: 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 object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 683 of file WikiPage.php.
References $user, ContentHandler\deprecated(), and loadLastEdit().
Referenced by getRawText().
WikiPage::getTimestamp | ( | ) |
Definition at line 708 of file WikiPage.php.
References loadLastEdit(), TS_MW, and wfTimestamp().
Referenced by doEditContent(), and CreditsAction\getAuthor().
WikiPage::getTitle | ( | ) |
Get the title object of the article.
Definition at line 221 of file WikiPage.php.
References $mTitle.
Referenced by doDeleteArticleReal(), doEdit(), doEditContent(), doEditUpdates(), doQuickEdit(), doQuickEditContent(), getAutoDeleteReason(), ApiParse\getParsedContent(), makeParserOptions(), Article\newFromWikiPage(), prepareTextForEdit(), replaceSection(), RequestContext\setWikiPage(), and updateRedirectOn().
WikiPage::getTouched | ( | ) |
Get the page_touched field.
Definition at line 534 of file WikiPage.php.
References $mTouched, and loadPageData().
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 1425 of file WikiPage.php.
References Revision\getContentHandler(), and getRevision().
Get the text 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 1439 of file WikiPage.php.
References ContentHandler\deprecated(), getContentHandler(), ContentHandler\getContentText(), Revision\getPrevious(), and loadLastEdit().
WikiPage::getUsedTemplates | ( | ) |
Return a list of templates used by this article.
Uses the templatelinks table
Definition at line 3377 of file WikiPage.php.
WikiPage::getUser | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
$audience | Integer: 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 object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 735 of file WikiPage.php.
References $user, and loadLastEdit().
Referenced by getContributors().
WikiPage::getUserText | ( | $audience = Revision::FOR_PUBLIC , |
|
User | $user = null |
||
) |
$audience | Integer: 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 object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
Definition at line 773 of file WikiPage.php.
References $user, and loadLastEdit().
Referenced by CreditsAction\getAuthor().
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 463 of file WikiPage.php.
References exists().
WikiPage::insertOn | ( | $dbw | ) |
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.
$dbw | DatabaseBase |
Definition at line 1244 of file WikiPage.php.
References array(), wfProfileIn(), wfProfileOut(), and wfRandom().
Referenced by doEditContent().
WikiPage::insertProtectNullRevision | ( | $revCommentMsg, | |
array | $limit, | ||
array | $expiry, | ||
$cascade, | |||
$reason | |||
) |
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 |
Definition at line 2503 of file WikiPage.php.
References $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.
Don't call this function directly unless you know what you're doing.
Definition at line 925 of file WikiPage.php.
References $retval, getContent(), and insertRedirectEntry().
Referenced by getRedirectTarget().
WikiPage::insertRedirectEntry | ( | $rt | ) |
Insert or update the redirect table entry for this page to indicate it redirects to $rt .
$rt | Title redirect target |
Definition at line 941 of file WikiPage.php.
References array(), DB_MASTER, getId(), and wfGetDB().
Referenced by insertRedirect(), and updateRedirectOn().
WikiPage::isBigDeletion | ( | ) |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
Definition at line 3413 of file WikiPage.php.
References wfDeprecated().
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.
$editInfo | Object|bool (false): object returned by prepareTextForEdit(), if false, the current database state will be used |
Definition at line 845 of file WikiPage.php.
References array(), DB_SLAVE, getContent(), getId(), global, and wfGetDB().
Referenced by doDeleteUpdates(), doEditContent(), and doEditUpdates().
WikiPage::isParserCacheUsed | ( | ParserOptions | $parserOptions, |
$oldid | |||
) |
Should the parser cache be used?
$parserOptions | ParserOptions to check |
$oldid | int |
Definition at line 1117 of file WikiPage.php.
References exists(), getContentHandler(), getLatest(), ParserOptions\getStubThreshold(), and global.
Referenced by getParserOutput().
WikiPage::isRedirect | ( | ) |
Tests if the article content represents a redirect.
Reimplemented in WikiFilePage.
Definition at line 483 of file WikiPage.php.
References getContent().
Referenced by doEditContent().
WikiPage::loadFromRow | ( | $data, | |
$from | |||
) |
Load the object from a database row.
$data | object: database row containing at least fields returned by selectFields() | |
string | int | $from | One of the following:
|
Definition at line 397 of file WikiPage.php.
References $from, $mLatest, clearCacheFields(), convertSelectType(), 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 607 of file WikiPage.php.
References $flags, getId(), getLatest(), Revision\newFromPageId(), IDBAccessObject\READ_LOCKING, and setLastEdit().
Referenced by getComment(), getContent(), getMinorEdit(), getRevision(), getText(), getTimestamp(), getUndoText(), getUser(), and getUserText().
WikiPage::loadPageData | ( | $from = 'fromdb' | ) |
Set the general counter, title etc data loaded from some source.
$from | object|string|int One of the following:
|
Definition at line 354 of file WikiPage.php.
References $from, array(), convertSelectType(), DB_MASTER, DB_SLAVE, getCachedLastEditTime(), loadFromRow(), pageDataFromTitle(), IDBAccessObject\READ_LATEST, IDBAccessObject\READ_NORMAL, TS_MW, wfGetDB(), and wfTimestamp().
Referenced by checkTouched(), doDeleteArticleReal(), doEditContent(), doUpdateRestrictions(), exists(), getCount(), getId(), getLatest(), getLinksTimestamp(), and getTouched().
WikiPage::makeParserOptions | ( | $context | ) |
Get parser options suitable for rendering the primary article wikitext.
IContextSource | User | string | $context | One of the following:
|
Definition at line 2012 of file WikiPage.php.
References $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 136 of file WikiPage.php.
References $from, array(), convertSelectType(), DB_MASTER, DB_SLAVE, newFromRow(), and wfGetDB().
Referenced by RefreshLinks\fixLinksFromArticle(), and RefreshLinks\fixRedirect().
|
static |
Constructor from a database row.
$row | object: database row containing at least fields returned by selectFields(). | |
string | int | $from | source of $data:
|
Definition at line 163 of file WikiPage.php.
References $from, factory(), and Title\newFromRow().
Referenced by newFromID().
|
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 object |
Definition at line 3066 of file WikiPage.php.
References $title.
Referenced by doEditUpdates(), Title\moveToInternal(), and Article\onArticleCreate().
|
static |
Clears caches when article is deleted.
$title | Title |
Definition at line 3087 of file WikiPage.php.
References $title, $user, HTMLFileCache\clearFileCache(), false, InfoAction\invalidateCache(), User\newFromName(), NS_FILE, NS_MEDIAWIKI, NS_USER_TALK, RepoGroup\singleton(), and MessageCache\singleton().
Referenced by doDeleteUpdates(), Title\moveToInternal(), and Article\onArticleDelete().
|
static |
Purge caches on page update etc.
$title | Title object |
Definition at line 3134 of file WikiPage.php.
References $title, DeferredUpdates\addHTMLCacheUpdate(), HTMLFileCache\clearFileCache(), and InfoAction\invalidateCache().
Referenced by doEditUpdates(), and Article\onArticleEdit().
|
protected |
Fetch a page record with the given conditions.
$dbr | DatabaseBase object |
$conditions | Array |
$options | Array |
Definition at line 303 of file WikiPage.php.
References $dbr, $options, array(), selectFields(), and wfRunHooks().
Referenced by pageDataFromId(), and pageDataFromTitle().
WikiPage::pageDataFromId | ( | $dbr, | |
$id, | |||
$options = array() |
|||
) |
Fetch a page record matching the requested ID.
$dbr | DatabaseBase |
$id | Integer |
$options | Array |
Definition at line 338 of file WikiPage.php.
References $dbr, $options, array(), and pageData().
WikiPage::pageDataFromTitle | ( | $dbr, | |
$title, | |||
$options = array() |
|||
) |
Fetch a page record matching the Title object's namespace and title using a sanitized title string.
$dbr | DatabaseBase object |
$title | Title object |
$options | Array |
Definition at line 324 of file WikiPage.php.
References $dbr, $options, $title, array(), and pageData().
Referenced by loadPageData().
WikiPage::prepareContentForEdit | ( | Content | $content, |
$revid = null , |
|||
User | $user = null , |
||
$serialization_format = null |
|||
) |
Prepare content which is about to be saved.
Returns a stdclass with source, pst and output members
Definition at line 2048 of file WikiPage.php.
References $mPreparedEdit, $user, $wgContLang, $wgUser, array(), getContent(), Content\getContentHandler(), ContentHandler\getContentText(), global, makeParserOptions(), ParserOptions\newFromUserAndLang(), object, Content\preSaveTransform(), Revision\RAW, wfRunHooks(), and wfTimestampNow().
Referenced by doEditContent(), doEditUpdates(), 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
Definition at line 2029 of file WikiPage.php.
References $user, ContentHandler\deprecated(), getTitle(), ContentHandler\makeContent(), and prepareContentForEdit().
WikiPage::preSaveTransform | ( | $text, | |
User | $user = null , |
||
ParserOptions | $popts = null |
||
) |
This function is called right before saving the wikitext, so we can do things like signatures and links-in-context.
string | $text | article contents |
$user | User object: user doing the edit | |
$popts | ParserOptions object: parser options, default options for the user loaded if null given |
Definition at line 3393 of file WikiPage.php.
References $user, $wgParser, $wgUser, global, ParserOptions\newFromUser(), and wfDeprecated().
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 2570 of file WikiPage.php.
References $limit, 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 2611 of file WikiPage.php.
References $limit, $wgContLang, as, formatExpiry(), and global.
Referenced by doUpdateRestrictions().
WikiPage::replaceSection | ( | $section, | |
$text, | |||
$sectionTitle = '' , |
|||
$edittime = null |
|||
) |
mixed | $section | Null/false, a section number (0, 1, 2, T1, T2, ...) or "new". |
string | $text | New text 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 1473 of file WikiPage.php.
References $section, $sectionContent, ContentHandler\deprecated(), getContentHandler(), ContentHandler\getContentText(), getTitle(), ContentHandler\makeContent(), replaceSectionContent(), and supportsSections().
WikiPage::replaceSectionContent | ( | $section, | |
Content | $sectionContent, | ||
$sectionTitle = '' , |
|||
$edittime = null |
|||
) |
mixed | $section | Null/false, a section number (0, 1, 2, T1, T2, ...) or "new". |
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 1518 of file WikiPage.php.
References $rev, $section, $sectionContent, DB_MASTER, getContent(), getContentHandler(), getId(), Revision\loadFromTimestamp(), supportsSections(), wfDebug(), wfGetDB(), wfProfileIn(), and wfProfileOut().
Referenced by replaceSection().
|
static |
Return the list of revision fields that should be selected to create a new page.
Definition at line 271 of file WikiPage.php.
References array(), and global.
Referenced by pageData(), Article\selectFields(), and ArticleTest\testStaticFunctions().
WikiPage::setCachedLastEditTime | ( | $timestamp | ) |
Set the cached timestamp for the last time the page changed.
This is only used to help handle slave lag by comparing to page_touched.
$timestamp | string |
Definition at line 831 of file WikiPage.php.
References $timestamp, $wgMemc, global, TS_MW, wfMemcKey(), and wfTimestamp().
Referenced by updateRevisionOn().
|
protected |
Set the latest revision.
Definition at line 633 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 722 of file WikiPage.php.
References TS_MW, and wfTimestamp().
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 1503 of file WikiPage.php.
References getContentHandler().
Referenced by replaceSection(), and replaceSectionContent().
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 3243 of file WikiPage.php.
References array(), as, DB_MASTER, Category\newFromName(), NS_CATEGORY, NS_FILE, wfGetDB(), and wfRunHooks().
WikiPage::updateIfNewerOn | ( | $dbw, | |
$revision | |||
) |
If the given revision is newer than the currently set page_latest, update the page record.
Otherwise, do nothing.
$dbw | DatabaseBase object |
$revision | Revision object |
Definition at line 1385 of file WikiPage.php.
References $ret, array(), getId(), TS_MW, updateRevisionOn(), wfProfileIn(), wfProfileOut(), and wfTimestamp().
WikiPage::updateRedirectOn | ( | $dbw, | |
$redirectTitle, | |||
$lastRevIsRedirect = null |
|||
) |
Add row to the redirect table if this is a redirect, remove otherwise.
$dbw | DatabaseBase |
$redirectTitle | Title object pointing to the redirect target, or NULL if this is not a redirect |
$lastRevIsRedirect | null|bool If given, will optimize adding and removing rows in redirect table. |
Definition at line 1350 of file WikiPage.php.
References array(), getId(), getTitle(), insertRedirectEntry(), NS_FILE, RepoGroup\singleton(), wfProfileIn(), and wfProfileOut().
Referenced by updateRevisionOn().
WikiPage::updateRestrictions | ( | $limit = array() , |
|
$reason = '' , |
|||
& | $cascade = 0 , |
||
$expiry = array() , |
|||
User | $user = null |
||
) |
Update the article's restriction field, and leave a log entry.
array | $limit | set of restriction keys |
$reason | String | |
&$cascade | Integer. Set to false if cascading protection isn't allowed. | |
array | $expiry | per restriction type expiration |
$user | User The user updating the restrictions |
Definition at line 3440 of file WikiPage.php.
References $limit, $user, $wgUser, doUpdateRestrictions(), and global.
WikiPage::updateRevisionOn | ( | $dbw, | |
$revision, | |||
$lastRevision = null , |
|||
$lastRevIsRedirect = null |
|||
) |
Update the page record to point to a newly saved revision.
$dbw | DatabaseBase: object |
$revision | Revision: For ID number, and text used to set length and redirect status fields |
$lastRevision | Integer: 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. |
$lastRevIsRedirect | Boolean: if given, will optimize adding and removing rows in redirect table. |
Definition at line 1289 of file WikiPage.php.
References array(), getId(), global, setCachedLastEditTime(), setLastEdit(), LinkCache\singleton(), updateRedirectOn(), wfProfileIn(), wfProfileOut(), and wfTimestampNow().
Referenced by doEditContent(), doQuickEditContent(), insertProtectNullRevision(), and updateIfNewerOn().
|
protected |
Definition at line 85 of file WikiPage.php.
Referenced by getCount().
WikiPage::$mDataLoaded = false |
WikiPage::$mDataLoadedFrom = self::READ_NONE |
Definition at line 61 of file WikiPage.php.
|
protected |
Definition at line 57 of file WikiPage.php.
Referenced by getId().
WikiPage::$mIsRedirect = false |
|
protected |
Definition at line 69 of file WikiPage.php.
Referenced by getRevision().
WikiPage::$mLatest = false |
{
Definition at line 49 of file WikiPage.php.
Referenced by getLatest(), and loadFromRow().
|
protected |
Definition at line 81 of file WikiPage.php.
Referenced by getLinksTimestamp().
WikiPage::$mPreparedEdit = false |
Definition at line 53 of file WikiPage.php.
Referenced by doEditUpdates(), and prepareContentForEdit().
|
protected |
Definition at line 65 of file WikiPage.php.
Referenced by WikiFilePage\getRedirectTarget(), and getRedirectTarget().
WikiPage::$mTimestamp = '' |
Definition at line 73 of file WikiPage.php.
Title WikiPage::$mTitle = null |
Definition at line 42 of file WikiPage.php.
Referenced by WikiFilePage\getForeignCategories(), and getTitle().
|
protected |
Definition at line 77 of file WikiPage.php.
Referenced by getTouched().
|
protected |
one of the READ_* constants
Definition at line 61 of file WikiPage.php.
Referenced by doEditUpdates().
|
protected |
timestamp of the current revision or empty string if not loaded
Definition at line 73 of file WikiPage.php.