MediaWiki
master
|
Class representing a MediaWiki article and history. More...
Public Member Functions | |
__construct (Title $title) | |
Constructor and clear the article. | |
checkFlags ($flags) | |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed. | |
checkTouched () | |
Loads page_touched and returns a value indicating if it should be used. | |
clear () | |
Clear the object. | |
commitRollback ($fromP, $summary, $bot, &$resultDetails, User $guser) | |
Backend implementation of doRollback(), please refer there for parameter and return value documentation. | |
createUpdates ($rev) | |
Perform article updates on a special page creation. | |
doCascadeProtectionUpdates (ParserOutput $parserOutput) | |
Updates cascading protections. | |
doDeleteArticle ($reason, $suppress=false, $id=0, $commit=true, &$error= '', User $user=null) | |
Same as doDeleteArticleReal(), but returns a simple boolean. | |
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. | |
doDeleteUpdates ($id, Content $content=null) | |
Do some database updates after deletion. | |
doEdit ($text, $summary, $flags=0, $baseRevId=false, $user=null) | |
Change an existing article or create a new article. | |
doEditContent (Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialisation_format=null) | |
Change an existing article or create a new article. | |
doEditUpdates (Revision $revision, User $user, array $options=array()) | |
Do standard deferred updates after page edit. | |
doPurge () | |
Perform the actions of a page purging. | |
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. | |
doQuickEditContent (Content $content, User $user, $comment= '', $minor=0, $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. | |
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. | |
doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, User $user) | |
Update the article's restriction field, and leave a log entry. | |
doViewUpdates (User $user) | |
Do standard deferred updates after page view. | |
estimateRevisionCount () | |
Get the approximate revision count of this page. | |
exists () | |
followRedirect () | |
Get the Title object or URL this page redirects to. | |
getActionOverrides () | |
Returns overrides for action handlers. | |
getAutoDeleteReason (&$hasHistory) | |
Auto-generates a deletion reason. | |
getComment ($audience=Revision::FOR_PUBLIC, User $user=null) | |
getContent ($audience=Revision::FOR_PUBLIC, User $user=null) | |
Get the content of the current revision. | |
getContentHandler () | |
Returns the ContentHandler instance to be used to deal with the content of this WikiPage. | |
getContentModel () | |
Returns the page's content model id (see the CONTENT_MODEL_XXX constants). | |
getContributors () | |
Get a list of users who have edited this article, not including the user who made the most recent revision, which you can get from $article->getUser() if you want it. | |
getCount () | |
getCreator ($audience=Revision::FOR_PUBLIC, User $user=null) | |
Get the User object of the user who created the page. | |
getDeletionUpdates (Content $content=null) | |
Returns a list of updates to be performed when this page is deleted. | |
getHiddenCategories () | |
#@- | |
getId () | |
getLastNAuthors ($num, $revLatest=0) | |
Get the last N authors. | |
getLatest () | |
Get the page_latest field. | |
getMinorEdit () | |
Returns true if last revision was marked as "minor edit". | |
getOldestRevision () | |
Get the Revision object of the oldest revision. | |
getParserOutput (ParserOptions $parserOptions, $oldid=null) | |
Get a ParserOutput for the given ParserOptions and revision ID. | |
getRawText () | |
Get the text of the current revision. | |
getRedirectTarget () | |
If this page is a redirect, get its target. | |
getRedirectURL ($rt) | |
Get the Title object or URL to use for a redirect. | |
getRevision () | |
Get the latest revision. | |
getText ($audience=Revision::FOR_PUBLIC, User $user=null) | |
Get the text of the current revision. | |
getTimestamp () | |
getTitle () | |
Get the title object of the article. | |
getTouched () | |
Get the page_touched field. | |
getUndoContent (Revision $undo, Revision $undoafter=null) | |
Get the content that needs to be saved in order to undo all revisions between $undo and $undoafter. | |
getUndoText (Revision $undo, Revision $undoafter=null) | |
Get the text that needs to be saved in order to undo all revisions between $undo and $undoafter. | |
getUsedTemplates () | |
Return a list of templates used by this article. | |
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. | |
insertOn ($dbw) | |
Insert a new empty page record for this article. | |
insertRedirect () | |
Insert an entry for this page into the redirect table. | |
insertRedirectEntry ($rt) | |
Insert or update the redirect table entry for this page to indicate it redirects to $rt . | |
isBigDeletion () | |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. | |
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. | |
isParserCacheUsed (ParserOptions $parserOptions, $oldid) | |
Should the parser cache be used? | |
isRedirect () | |
Tests if the article content represents a redirect. | |
loadFromRow ($data, $from) | |
Load the object from a database row. | |
loadPageData ($from= 'fromdb') | |
Set the general counter, title etc data loaded from some source. | |
makeParserOptions ($context) | |
Get parser options suitable for rendering the primary article wikitext. | |
pageDataFromId ($dbr, $id, $options=array()) | |
Fetch a page record matching the requested ID. | |
pageDataFromTitle ($dbr, $title, $options=array()) | |
Fetch a page record matching the Title object's namespace and title using a sanitized title string. | |
prepareContentForEdit (Content $content, $revid=null, User $user=null, $serialization_format=null) | |
Prepare content which is about to be saved. | |
prepareTextForEdit ($text, $revid=null, User $user=null) | |
Prepare text which is about to be saved. | |
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. | |
quickEdit ($text, $comment= '', $minor=0) | |
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. | |
setTimestamp ($ts) | |
Set the page timestamp (use only to avoid DB queries) | |
supportsSections () | |
Returns true iff this page's content model supports sections. | |
updateCategoryCounts ($added, $deleted) | |
Update all the appropriate counts in the category table, given that we've added the categories $added and deleted the categories $deleted. | |
updateIfNewerOn ($dbw, $revision) | |
If the given revision is newer than the currently set page_latest, update the page record. | |
updateRedirectOn ($dbw, $redirectTitle, $lastRevIsRedirect=null) | |
Add row to the redirect table if this is a redirect, remove otherwise. | |
updateRestrictions ($limit=array(), $reason= '', &$cascade=0, $expiry=array(), User $user=null) | |
Update the article's restriction field, and leave a log entry. | |
updateRevisionOn ($dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null) | |
Update the page record to point to a newly saved revision. | |
useParserCache ($oldid) | |
viewUpdates () | |
Static Public Member Functions | |
static | factory (Title $title) |
Create a WikiPage object of the appropriate class for the given title. | |
static | getAutosummary ($oldtext, $newtext, $flags) |
Return an applicable autosummary if one exists for the given edit. | |
static | newFromID ($id, $from= 'fromdb') |
Constructor from a page id. | |
static | newFromRow ($row, $from= 'fromdb') |
Constructor from a database row. | |
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. | |
static | onArticleDelete ($title) |
Clears caches when article is deleted. | |
static | onArticleEdit ($title) |
Purge caches on page update etc. | |
static | selectFields () |
Return the list of revision fields that should be selected to create a new page. | |
Public Attributes | |
$mDataLoadedFrom = self::READ_NONE | |
$mTimestamp = '' | |
Title | $mTitle = null |
$mDataLoaded = false | |
$mIsRedirect = false | |
$mLatest = false | |
$mPreparedEdit = false | |
Protected Member Functions | |
clearCacheFields () | |
Clear the object cache fields. | |
getCachedLastEditTime () | |
Get the cached timestamp for the last time the page changed. | |
loadLastEdit () | |
Loads everything except the text This isn't necessary for all uses, so it's only done if needed. | |
pageData ($dbr, $conditions, $options=array()) | |
Fetch a page record with the given conditions. | |
setLastEdit (Revision $revision) | |
Set the latest revision. | |
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. | |
Protected Attributes | |
int null | $mCounter = null |
Revision | $mLastRevision = null |
Title | $mRedirectTarget = null |
string | $mTouched = '19700101000000' |
int | |
one of the READ_* constants | |
string | |
timestamp of the current revision or empty string if not loaded | |
Static Private Member Functions | |
static | convertSelectType ($type) |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants. |
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 36 of file WikiPage.php.
WikiPage::__construct | ( | Title $ | title | ) |
Constructor and clear the article.
Definition at line 80 of file WikiPage.php.
WikiPage::checkFlags | ( | $ | flags | ) |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
$flags | Int |
Definition at line 1500 of file WikiPage.php.
Loads page_touched and returns a value indicating if it should be used.
Definition at line 478 of file WikiPage.php.
WikiPage::clear | ( | ) |
Clear the object.
Definition at line 212 of file WikiPage.php.
Referenced by EditPageTest\forceRevisionDate(), and ApiEditPageTest\forceRevisionDate().
WikiPage::clearCacheFields | ( | ) | [protected] |
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.
$fromP | String: Name of the user whose edits to rollback. |
$summary | String: Custom summary. Set to default summary if empty. |
$bot | Boolean: If true, mark all reverted edits as bot. |
$resultDetails | Array: contains result-specific array of additional values |
$guser | User The user performing the rollback |
Definition at line 2704 of file WikiPage.php.
static WikiPage::convertSelectType | ( | $ | type | ) | [static, private] |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
$type | object|string|int |
Definition at line 158 of file WikiPage.php.
References IDBAccessObject\READ_LATEST, IDBAccessObject\READ_LOCKING, and IDBAccessObject\READ_NORMAL.
WikiPage::createUpdates | ( | $ | rev | ) |
Perform article updates on a special page creation.
$rev | Revision object |
Definition at line 3129 of file WikiPage.php.
WikiPage::doCascadeProtectionUpdates | ( | ParserOutput $ | parserOutput | ) |
Updates cascading protections.
$parserOutput | ParserOutput object for the current version |
Definition at line 3061 of file WikiPage.php.
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
$reason | string delete reason for deletion log |
$suppress | boolean suppress all revisions and log the deletion in the suppression log instead of the deletion log |
$id | int 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 2466 of file WikiPage.php.
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.
$reason | string delete reason for deletion log |
$suppress | boolean suppress all revisions and log the deletion in the suppression log instead of the deletion log |
$id | int 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 2490 of file WikiPage.php.
WikiPage::doDeleteUpdates | ( | $ | id, |
Content $ | content = null |
||
) |
Do some database updates after deletion.
$id | Int: page_id value of the page being deleted (B/C, currently unused) |
$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 2620 of file WikiPage.php.
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.
$text | String: new text |
$summary | String: 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 1561 of file WikiPage.php.
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 |
$summary | String: 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|\the | $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 1617 of file WikiPage.php.
WikiPage::doEditUpdates | ( | Revision $ | revision, |
User $ | user, | ||
array $ | options = array() |
||
) |
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 |
$options | Array of options, following indexes are used:
|
Definition at line 2016 of file WikiPage.php.
Perform the actions of a page purging.
Reimplemented in WikiFilePage.
Definition at line 1132 of file WikiPage.php.
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.
$text | String: text submitted |
$user | User The relevant user |
$comment | String: comment submitted |
$minor | Boolean: whereas it's a minor modification |
Definition at line 2143 of file WikiPage.php.
WikiPage::doQuickEditContent | ( | Content $ | content, |
User $ | user, | ||
$ | comment = '' , |
||
$ | minor = 0 , |
||
$ | 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 |
$comment | String: comment submitted |
$serialisation_format | String: format for storing the content in the database |
$minor | Boolean: whereas it's a minor modification |
Definition at line 2161 of file WikiPage.php.
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
$fromP | String: Name of the user whose edits to rollback. |
$summary | String: Custom summary. Set to default summary if empty. |
$token | String: Rollback token. |
$bot | Boolean: If true, mark all reverted edits as bot. |
$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 |
Definition at line 2662 of file WikiPage.php.
WikiPage::doUpdateRestrictions | ( | array $ | limit, |
array $ | expiry, | ||
&$ | cascade, | ||
$ | reason, | ||
User $ | user | ||
) |
Update the article's restriction field, and leave a log entry.
This works for protection both existing and non-existing pages.
$limit | Array: set of restriction keys |
$reason | String |
&$cascade | Integer. Set to false if cascading protection isn't allowed. |
$expiry | Array: per restriction type expiration |
$user | User The user updating the restrictions |
Definition at line 2194 of file WikiPage.php.
WikiPage::doViewUpdates | ( | User $ | user | ) |
Do standard deferred updates after page view.
$user | User The relevant user |
Definition at line 1112 of file WikiPage.php.
Get the approximate revision count of this page.
Definition at line 3178 of file WikiPage.php.
References wfDeprecated().
WikiPage::exists | ( | ) |
Definition at line 408 of file WikiPage.php.
Referenced by LinksDeletionUpdate\__construct().
static WikiPage::factory | ( | Title $ | title | ) | [static] |
Create a WikiPage object of the appropriate class for the given title.
$title | Title |
MWException |
Definition at line 91 of file WikiPage.php.
Referenced by BackupDumperPageTest\addDBData(), TextPassDumperTest\addDBData(), EditPageTest\assertEdit(), Orphans\checkSeparation(), CleanupSpam\cleanupArticle(), UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByTitle(), MovePageForm\doSubmit(), ApiEditPage\execute(), DeleteEqualMessages\execute(), ApiRollback\execute(), DeleteDefaultMessages\execute(), ImportSiteScripts\execute(), AttachLatest\execute(), Protect\execute(), RollbackEdits\execute(), EditCLI\execute(), DeleteBatch\execute(), ApiPurge\execute(), ListredirectsPage\getRedirectTarget(), ApiPageSet\getRedirectTargets(), ApiBase\getTitleOrPageId(), SearchEngineTest\insertPage(), Title\invalidateCache(), SpecialMergeHistory\merge(), Title\moveToInternal(), ImportReporter\reportPage(), EditPageTest\testAutoMerge(), ArticleTablesTest\testbug14404(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), TextContentTest\testDeletionUpdates(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_bug41990(), ApiEditPageTest\testEditConflict_redirect(), WikitextContentTest\testGetSecondaryDataUpdates(), UploadFromUrlTest\testLeaveMessage(), ApiEditPageTest\testNonTextEdit(), TemplateCategoriesTest\testTemplateCategories(), RequestContextTest\testWikiPageTitle(), SpecialEditWatchlist\unwatchTitles(), LinksUpdate\updateCategoryCounts(), LinksDeletionUpdate\updateCategoryCounts(), and Title\updateTitleProtection().
static WikiPage::flattenRestrictions | ( | $ | limit | ) | [static, protected] |
Take an array of page restrictions and flatten it to a string suitable for insertion into the page_restrictions field.
$limit | Array |
MWException |
Definition at line 2433 of file WikiPage.php.
Get the Title object or URL this page redirects to.
Reimplemented in WikiFilePage.
Definition at line 901 of file WikiPage.php.
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 182 of file WikiPage.php.
WikiPage::getAutoDeleteReason | ( | &$ | hasHistory | ) |
Auto-generates a deletion reason.
&$hasHistory | Boolean: whether the page has a history |
Definition at line 2989 of file WikiPage.php.
static WikiPage::getAutosummary | ( | $ | oldtext, |
$ | newtext, | ||
$ | flags | ||
) | [static] |
Return an applicable autosummary if one exists for the given edit.
$oldtext | String|null: the previous text of the page. |
$newtext | String|null: The submitted text of the page. |
$flags | Int bitmask: a bitmask of flags submitted for the edit. |
Definition at line 2970 of file WikiPage.php.
WikiPage::getCachedLastEditTime | ( | ) | [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 762 of file WikiPage.php.
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 734 of file WikiPage.php.
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 606 of file WikiPage.php.
Referenced by insertRedirect().
Returns the ContentHandler instance to be used to deal with the content of this WikiPage.
Shorthand for ContentHandler::getForModelID( $this->getContentModel() );
Definition at line 196 of file WikiPage.php.
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 457 of file WikiPage.php.
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 953 of file WikiPage.php.
Definition at line 427 of file WikiPage.php.
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 697 of file WikiPage.php.
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 3240 of file WikiPage.php.
#@-
Returns a list of hidden categories this page is a member of. Uses the page_props and categorylinks tables.
Definition at line 2937 of file WikiPage.php.
WikiPage::getId | ( | ) |
Definition at line 401 of file WikiPage.php.
WikiPage::getLastNAuthors | ( | $ | num, |
$ | revLatest = 0 |
||
) |
Get the last N authors.
$num | Integer: number of revisions to get |
$revLatest | String: the latest rev_id, selected from the master (optional) |
Definition at line 1005 of file WikiPage.php.
References $res, array(), as, wfGetDB(), wfProfileIn(), and wfProfileOut().
Get the page_latest field.
Definition at line 500 of file WikiPage.php.
Referenced by EditPageTest\forceRevisionDate(), and ApiEditPageTest\forceRevisionDate().
Returns true if last revision was marked as "minor edit".
Definition at line 748 of file WikiPage.php.
Get the Revision object of the oldest revision.
Definition at line 511 of file WikiPage.php.
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 to use for the parse operation |
$oldid | Revision ID to get the text from, passing null or 0 will get the current revision (default value) |
Definition at line 1079 of file WikiPage.php.
Get the text of the current revision.
No side-effects...
Definition at line 642 of file WikiPage.php.
References ContentHandler\deprecated().
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 832 of file WikiPage.php.
WikiPage::getRedirectURL | ( | $ | rt | ) |
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 626 of file WikiPage.php.
Definition at line 651 of file WikiPage.php.
Get the title object of the article.
Definition at line 204 of file WikiPage.php.
Referenced by prepareTextForEdit(), and RequestContext\setWikiPage().
Get the page_touched field.
Definition at line 489 of file WikiPage.php.
WikiPage::getUndoContent | ( | Revision $ | undo, |
Revision $ | undoafter = null |
||
) |
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 1363 of file WikiPage.php.
WikiPage::getUndoText | ( | Revision $ | undo, |
Revision $ | undoafter = null |
||
) |
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 1377 of file WikiPage.php.
Return a list of templates used by this article.
Uses the templatelinks table
Definition at line 3115 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 678 of file WikiPage.php.
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 716 of file WikiPage.php.
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 420 of file WikiPage.php.
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 1183 of file WikiPage.php.
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 866 of file WikiPage.php.
References $retval, getContent(), and insertRedirectEntry().
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 882 of file WikiPage.php.
Referenced by insertRedirect().
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
Definition at line 3167 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 788 of file WikiPage.php.
WikiPage::isParserCacheUsed | ( | ParserOptions $ | parserOptions, |
$ | oldid | ||
) |
Should the parser cache be used?
$parserOptions | ParserOptions to check |
$oldid | int |
Definition at line 1058 of file WikiPage.php.
Tests if the article content represents a redirect.
Reimplemented in WikiFilePage.
Definition at line 440 of file WikiPage.php.
WikiPage::loadFromRow | ( | $ | data, |
$ | from | ||
) |
Load the object from a database row.
$data | object: database row containing at least fields returned by selectFields() |
$from | string|int One of the following:
|
Definition at line 365 of file WikiPage.php.
WikiPage::loadLastEdit | ( | ) | [protected] |
Loads everything except the text This isn't necessary for all uses, so it's only done if needed.
Definition at line 550 of file WikiPage.php.
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 322 of file WikiPage.php.
WikiPage::makeParserOptions | ( | $ | context | ) |
Get parser options suitable for rendering the primary article wikitext.
IContextSource | User | string | $context | One of the following:
|
Definition at line 1924 of file WikiPage.php.
static WikiPage::newFromID | ( | $ | id, |
$ | from = 'fromdb' |
||
) | [static] |
Constructor from a page id.
$id | Int article ID to load |
$from | string|int one of the following values:
|
Definition at line 124 of file WikiPage.php.
Referenced by RefreshLinks\fixLinksFromArticle(), RefreshLinks\fixRedirect(), and ApiBase\getTitleOrPageId().
static WikiPage::newFromRow | ( | $ | row, |
$ | from = 'fromdb' |
||
) | [static] |
Constructor from a database row.
$row | object: database row containing at least fields returned by selectFields(). |
$from | string|int: source of $data:
|
Definition at line 146 of file WikiPage.php.
static WikiPage::onArticleCreate | ( | $ | title | ) | [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 2848 of file WikiPage.php.
Referenced by Title\moveToInternal().
static WikiPage::onArticleDelete | ( | $ | title | ) | [static] |
Clears caches when article is deleted.
$title | Title |
Definition at line 2869 of file WikiPage.php.
Referenced by Title\moveToInternal().
static WikiPage::onArticleEdit | ( | $ | title | ) | [static] |
Purge caches on page update etc.
$title | Title object |
Definition at line 2915 of file WikiPage.php.
References DeferredUpdates\addHTMLCacheUpdate(), HTMLFileCache\clearFileCache(), and Title\purgeSquid().
WikiPage::pageData | ( | $ | dbr, |
$ | conditions, | ||
$ | options = array() |
||
) | [protected] |
Fetch a page record with the given conditions.
$dbr | DatabaseBase object |
$conditions | Array |
$options | Array |
Definition at line 271 of file WikiPage.php.
WikiPage::pageDataFromId | ( | $ | dbr, |
$ | id, | ||
$ | options = array() |
||
) |
Fetch a page record matching the requested ID.
$dbr | DatabaseBase |
$id | Integer |
$options | Array |
Definition at line 306 of file WikiPage.php.
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 292 of file WikiPage.php.
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
\Content | $content | |
null | $revid | |
null|\User | $user | |
null | $serialization_format |
Definition at line 1960 of file WikiPage.php.
Referenced by 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 1941 of file WikiPage.php.
References 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.
$text | String 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 3147 of file WikiPage.php.
WikiPage::quickEdit | ( | $ | text, |
$ | comment = '' , |
||
$ | minor = 0 |
||
) |
Definition at line 3207 of file WikiPage.php.
WikiPage::replaceSection | ( | $ | section, |
$ | text, | ||
$ | sectionTitle = '' , |
||
$ | edittime = null |
||
) |
$section | null|bool|int or a section number (0, 1, 2, T1, T2...) |
$text | String: new text of the section |
$sectionTitle | String: new section's subject, only if $section is 'new' |
$edittime | String: revision timestamp or null to use the current revision |
MWException |
Definition at line 1410 of file WikiPage.php.
WikiPage::replaceSectionContent | ( | $ | section, |
Content $ | sectionContent, | ||
$ | sectionTitle = '' , |
||
$ | edittime = null |
||
) |
$section | null|bool|int or a section number (0, 1, 2, T1, T2...) |
$sectionContent | Content: new content of the section |
$sectionTitle | String: new section's subject, only if $section is 'new' |
$edittime | String: revision timestamp or null to use the current revision |
MWException |
Definition at line 1453 of file WikiPage.php.
static WikiPage::selectFields | ( | ) | [static] |
Return the list of revision fields that should be selected to create a new page.
Definition at line 240 of file WikiPage.php.
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 774 of file WikiPage.php.
References $timestamp, $wgMemc, global, wfMemcKey(), and wfTimestamp().
WikiPage::setLastEdit | ( | Revision $ | revision | ) | [protected] |
Set the latest revision.
Definition at line 576 of file WikiPage.php.
WikiPage::setTimestamp | ( | $ | ts | ) |
Set the page timestamp (use only to avoid DB queries)
$ts | string MW timestamp of last article revision |
Definition at line 665 of file WikiPage.php.
Returns true iff 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 1438 of file WikiPage.php.
WikiPage::updateCategoryCounts | ( | $ | added, |
$ | deleted | ||
) |
Update all the appropriate counts in the category table, given that we've added the categories $added and deleted the categories $deleted.
$added | array The names of categories that were added |
$deleted | array The names of categories that were deleted |
Definition at line 3000 of file WikiPage.php.
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 1323 of file WikiPage.php.
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 1288 of file WikiPage.php.
WikiPage::updateRestrictions | ( | $ | limit = array() , |
$ | reason = '' , |
||
&$ | cascade = 0 , |
||
$ | expiry = array() , |
||
User $ | user = null |
||
) |
Update the article's restriction field, and leave a log entry.
$limit | Array: set of restriction keys |
$reason | String |
&$cascade | Integer. Set to false if cascading protection isn't allowed. |
$expiry | Array: per restriction type expiration |
$user | User The user updating the restrictions |
Definition at line 3194 of file WikiPage.php.
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 1227 of file WikiPage.php.
WikiPage::useParserCache | ( | $ | oldid | ) |
$oldid | int |
Definition at line 3227 of file WikiPage.php.
Definition at line 3216 of file WikiPage.php.
int null WikiPage::$mCounter = null [protected] |
Definition at line 74 of file WikiPage.php.
WikiPage::$mDataLoaded = false |
WikiPage::$mDataLoadedFrom = self::READ_NONE |
Definition at line 54 of file WikiPage.php.
WikiPage::$mIsRedirect = false |
Revision WikiPage::$mLastRevision = null [protected] |
Definition at line 62 of file WikiPage.php.
WikiPage::$mLatest = false |
WikiPage::$mPreparedEdit = false |
Title WikiPage::$mRedirectTarget = null [protected] |
Definition at line 58 of file WikiPage.php.
WikiPage::$mTimestamp = '' |
Definition at line 66 of file WikiPage.php.
Title WikiPage::$mTitle = null |
Definition at line 41 of file WikiPage.php.
string WikiPage::$mTouched = '19700101000000' [protected] |
Definition at line 70 of file WikiPage.php.
WikiPage::int [protected] |
one of the READ_* constants
Definition at line 54 of file WikiPage.php.
WikiPage::string [protected] |
timestamp of the current revision or empty string if not loaded
Definition at line 66 of file WikiPage.php.