[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
Base representation for a MediaWiki page. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
File Size: | 3554 lines (111 kb) |
Included or required: | 0 times |
Referenced: | 2 times |
Includes or requires: | 0 files |
Page:: (0 methods):
WikiPage:: (98 methods):
__construct()
factory()
newFromID()
newFromRow()
convertSelectType()
getActionOverrides()
getContentHandler()
getTitle()
clear()
clearCacheFields()
clearPreparedEdit()
selectFields()
pageData()
pageDataFromTitle()
pageDataFromId()
loadPageData()
loadFromRow()
getId()
exists()
hasViewableContent()
getCount()
isRedirect()
getContentModel()
checkTouched()
getTouched()
getLinksTimestamp()
getLatest()
getOldestRevision()
loadLastEdit()
setLastEdit()
getRevision()
getContent()
getText()
getRawText()
getTimestamp()
setTimestamp()
getUser()
getCreator()
getUserText()
getComment()
getMinorEdit()
getCachedLastEditTime()
setCachedLastEditTime()
isCountable()
getRedirectTarget()
insertRedirect()
insertRedirectEntry()
followRedirect()
getRedirectURL()
getContributors()
getLastNAuthors()
isParserCacheUsed()
getParserOutput()
doViewUpdates()
doPurge()
insertOn()
updateRevisionOn()
updateRedirectOn()
updateIfNewerOn()
getUndoContent()
getUndoText()
replaceSection()
supportsSections()
replaceSectionContent()
replaceSectionAtRev()
checkFlags()
doEdit()
doEditContent()
makeParserOptions()
prepareTextForEdit()
prepareContentForEdit()
doEditUpdates()
doQuickEdit()
doQuickEditContent()
doUpdateRestrictions()
insertProtectNullRevision()
formatExpiry()
protectDescription()
protectDescriptionLog()
flattenRestrictions()
doDeleteArticle()
doDeleteArticleReal()
doDeleteUpdates()
doRollback()
commitRollback()
onArticleCreate()
onArticleDelete()
onArticleEdit()
getCategories()
getHiddenCategories()
getAutosummary()
getAutoDeleteReason()
updateCategoryCounts()
doCascadeProtectionUpdates()
getUsedTemplates()
preSaveTransform()
updateRestrictions()
getDeletionUpdates()
__construct( Title $title ) X-Ref |
Constructor and clear the article param: Title $title Reference to a Title object. |
factory( Title $title ) X-Ref |
Create a WikiPage object of the appropriate class for the given title. param: Title $title return: WikiPage Object of the appropriate type |
newFromID( $id, $from = 'fromdb' ) X-Ref |
Constructor from a page id param: int $id Article ID to load param: string|int $from One of the following values: return: WikiPage|null |
newFromRow( $row, $from = 'fromdb' ) X-Ref |
Constructor from a database row param: object $row Database row containing at least fields returned by selectFields(). param: string|int $from Source of $data: return: WikiPage |
convertSelectType( $type ) X-Ref |
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants. param: object|string|int $type return: mixed |
getActionOverrides() X-Ref |
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. return: array |
getContentHandler() X-Ref |
Returns the ContentHandler instance to be used to deal with the content of this WikiPage. Shorthand for ContentHandler::getForModelID( $this->getContentModel() ); return: ContentHandler |
getTitle() X-Ref |
Get the title object of the article return: Title Title object of this page |
clear() X-Ref |
Clear the object return: void |
clearCacheFields() X-Ref |
Clear the object cache fields return: void |
clearPreparedEdit() X-Ref |
Clear the mPreparedEdit cache field, as may be needed by mutable content types return: void |
selectFields() X-Ref |
Return the list of revision fields that should be selected to create a new page. return: array |
pageData( $dbr, $conditions, $options = array() X-Ref |
Fetch a page record with the given conditions param: DatabaseBase $dbr param: array $conditions param: array $options return: object|bool Database result resource, or false on failure |
pageDataFromTitle( $dbr, $title, $options = array() X-Ref |
Fetch a page record matching the Title object's namespace and title using a sanitized title string param: DatabaseBase $dbr param: Title $title param: array $options return: object|bool Database result resource, or false on failure |
pageDataFromId( $dbr, $id, $options = array() X-Ref |
Fetch a page record matching the requested ID param: DatabaseBase $dbr param: int $id param: array $options return: object|bool Database result resource, or false on failure |
loadPageData( $from = 'fromdb' ) X-Ref |
Set the general counter, title etc data loaded from some source. param: object|string|int $from One of the following: return: void |
loadFromRow( $data, $from ) X-Ref |
Load the object from a database row param: object $data Database row containing at least fields returned by selectFields() param: string|int $from One of the following: |
getId() X-Ref |
return: int Page ID |
exists() X-Ref |
return: bool Whether or not the page exists in the database |
hasViewableContent() X-Ref |
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. return: bool |
getCount() X-Ref |
return: int The view count for the page |
isRedirect() X-Ref |
Tests if the article content represents a redirect return: bool |
getContentModel() X-Ref |
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. return: string |
checkTouched() X-Ref |
Loads page_touched and returns a value indicating if it should be used return: bool True if not a redirect |
getTouched() X-Ref |
Get the page_touched field return: string Containing GMT timestamp |
getLinksTimestamp() X-Ref |
Get the page_links_updated field return: string|null Containing GMT timestamp |
getLatest() X-Ref |
Get the page_latest field return: int The rev_id of current revision |
getOldestRevision() X-Ref |
Get the Revision object of the oldest revision return: Revision|null |
loadLastEdit() X-Ref |
Loads everything except the text This isn't necessary for all uses, so it's only done if needed. |
setLastEdit( Revision $revision ) X-Ref |
Set the latest revision param: Revision $revision |
getRevision() X-Ref |
Get the latest revision return: Revision|null |
getContent( $audience = Revision::FOR_PUBLIC, User $user = null ) X-Ref |
Get the content of the current revision. No side-effects... param: int $audience One of: param: User $user User object to check for, only if FOR_THIS_USER is passed return: Content|null The content of the current revision |
getText( $audience = Revision::FOR_PUBLIC, User $user = null ) X-Ref |
Get the text of the current revision. No side-effects... param: int $audience One of: param: User $user User object to check for, only if FOR_THIS_USER is passed return: string|bool The text of the current revision |
getRawText() X-Ref |
Get the text of the current revision. No side-effects... return: string|bool The text of the current revision. False on failure |
getTimestamp() X-Ref |
return: string MW timestamp of last article revision |
setTimestamp( $ts ) X-Ref |
Set the page timestamp (use only to avoid DB queries) param: string $ts MW timestamp of last article revision return: void |
getUser( $audience = Revision::FOR_PUBLIC, User $user = null ) X-Ref |
param: int $audience One of: param: User $user User object to check for, only if FOR_THIS_USER is passed return: int User ID for the user that made the last article revision |
getCreator( $audience = Revision::FOR_PUBLIC, User $user = null ) X-Ref |
Get the User object of the user who created the page param: int $audience One of: param: User $user User object to check for, only if FOR_THIS_USER is passed return: User|null |
getUserText( $audience = Revision::FOR_PUBLIC, User $user = null ) X-Ref |
param: int $audience One of: param: User $user User object to check for, only if FOR_THIS_USER is passed return: string Username of the user that made the last article revision |
getComment( $audience = Revision::FOR_PUBLIC, User $user = null ) X-Ref |
param: int $audience One of: param: User $user User object to check for, only if FOR_THIS_USER is passed return: string Comment stored for the last article revision |
getMinorEdit() X-Ref |
Returns true if last revision was marked as "minor edit" return: bool Minor edit indicator for the last article revision. |
getCachedLastEditTime() X-Ref |
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. return: string MW timestamp |
setCachedLastEditTime( $timestamp ) X-Ref |
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. param: string $timestamp return: void |
isCountable( $editInfo = false ) X-Ref |
Determine whether a page would be suitable for being counted as an article in the site_stats table based on the title & its content param: object|bool $editInfo (false): object returned by prepareTextForEdit(), return: bool |
getRedirectTarget() X-Ref |
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() return: Title|null Title object, or null if this page is not a redirect |
insertRedirect() X-Ref |
Insert an entry for this page into the redirect table. Don't call this function directly unless you know what you're doing. return: Title|null Title object or null if not a redirect |
insertRedirectEntry( $rt ) X-Ref |
Insert or update the redirect table entry for this page to indicate it redirects to $rt . param: Title $rt Redirect target |
followRedirect() X-Ref |
Get the Title object or URL this page redirects to return: bool|Title|string False, Title of in-wiki target, or string with URL |
getRedirectURL( $rt ) X-Ref |
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. param: Title $rt Redirect target return: bool|Title|string False, Title object of local target, or string with URL |
getContributors() X-Ref |
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 return: UserArrayFromResult |
getLastNAuthors( $num, $revLatest = 0 ) X-Ref |
Get the last N authors param: int $num Number of revisions to get param: int|string $revLatest The latest rev_id, selected from the master (optional) return: array Array of authors, duplicates not removed |
isParserCacheUsed( ParserOptions $parserOptions, $oldid ) X-Ref |
Should the parser cache be used? param: ParserOptions $parserOptions ParserOptions to check param: int $oldid return: bool |
getParserOutput( ParserOptions $parserOptions, $oldid = null ) X-Ref |
Get a ParserOutput for the given ParserOptions and revision ID. The parser cache will be used if possible. param: ParserOptions $parserOptions ParserOptions to use for the parse operation param: null|int $oldid Revision ID to get the text from, passing null or 0 will return: ParserOutput|bool ParserOutput or false if the revision was not found |
doViewUpdates( User $user, $oldid = 0 ) X-Ref |
Do standard deferred updates after page view (existing or missing page) param: User $user The relevant user param: int $oldid The revision id being viewed. If not given or 0, latest revision is assumed. |
doPurge() X-Ref |
Perform the actions of a page purging return: bool |
insertOn( $dbw ) X-Ref |
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. param: DatabaseBase $dbw return: int The newly created page_id key, or false if the title already existed |
updateRevisionOn( $dbw, $revision, $lastRevision = null,$lastRevIsRedirect = null) X-Ref |
Update the page record to point to a newly saved revision. param: DatabaseBase $dbw param: Revision $revision For ID number, and text used to set param: int $lastRevision If given, will not overwrite the page field param: bool $lastRevIsRedirect If given, will optimize adding and return: bool True on success, false on failure |
updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect = null ) X-Ref |
Add row to the redirect table if this is a redirect, remove otherwise. param: DatabaseBase $dbw param: Title $redirectTitle Title object pointing to the redirect target, param: null|bool $lastRevIsRedirect If given, will optimize adding and return: bool True on success, false on failure |
updateIfNewerOn( $dbw, $revision ) X-Ref |
If the given revision is newer than the currently set page_latest, update the page record. Otherwise, do nothing. param: DatabaseBase $dbw param: Revision $revision return: bool |
getUndoContent( Revision $undo, Revision $undoafter = null ) X-Ref |
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 param: Revision $undo param: Revision $undoafter Must be an earlier revision than $undo return: mixed String on success, false on failure |
getUndoText( Revision $undo, Revision $undoafter = null ) X-Ref |
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 param: Revision $undo param: Revision $undoafter Must be an earlier revision than $undo return: string|bool String on success, false on failure |
replaceSection( $sectionId, $text, $sectionTitle = '',$edittime = null) X-Ref |
param: string|number|null|bool $sectionId Section identifier as a number or string param: string $text New text of the section. param: string $sectionTitle New section's subject, only if $section is "new". param: string $edittime Revision timestamp or null to use the current revision. return: string New complete article text, or null if error. |
supportsSections() X-Ref |
Returns true if this page's content model supports sections. return: bool |
replaceSectionContent( $sectionId, Content $sectionContent, $sectionTitle = '',$edittime = null ) X-Ref |
param: string|number|null|bool $sectionId Section identifier as a number or string param: Content $sectionContent New content of the section. param: string $sectionTitle New section's subject, only if $section is "new". param: string $edittime Revision timestamp or null to use the current revision. return: Content New complete article content, or null if error. |
replaceSectionAtRev( $sectionId, Content $sectionContent,$sectionTitle = '', $baseRevId = null) X-Ref |
param: string|number|null|bool $sectionId Section identifier as a number or string param: Content $sectionContent New content of the section. param: string $sectionTitle New section's subject, only if $section is "new". param: int|null $baseRevId return: Content New complete article content, or null if error. |
checkFlags( $flags ) X-Ref |
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed. param: int $flags return: int Updated $flags |
doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) X-Ref |
Change an existing article or create a new article. Updates RC and all necessary caches, optionally via the deferred update array. param: string $text New text param: string $summary Edit summary param: int $flags Bitfield: param: bool|int $baseRevId The revision ID this edit was based off, if any param: User $user The user doing the edit return: Status Possible errors: |
doEditContent( Content $content, $summary, $flags = 0, $baseRevId = false,User $user = null, $serialisation_format = null) X-Ref |
Change an existing article or create a new article. Updates RC and all necessary caches, optionally via the deferred update array. param: Content $content New content param: string $summary Edit summary param: int $flags Bitfield: param: bool|int $baseRevId The revision ID this edit was based off, if any param: User $user The user doing the edit param: string $serialisation_format Format for storing the content in the return: Status Possible errors: |
makeParserOptions( $context ) X-Ref |
Get parser options suitable for rendering the primary article wikitext param: IContextSource|User|string $context One of the following: return: ParserOptions |
prepareTextForEdit( $text, $revid = null, User $user = null ) X-Ref |
Prepare text which is about to be saved. Returns a stdclass with source, pst and output members return: object |
prepareContentForEdit( Content $content, $revid = null, User $user = null,$serialization_format = null) X-Ref |
Prepare content which is about to be saved. Returns a stdclass with source, pst and output members param: Content $content param: int|null $revid param: User|null $user param: string|null $serialization_format return: bool|object |
doEditUpdates( Revision $revision, User $user, array $options = array() X-Ref |
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. param: Revision $revision param: User $user User object that did the revision param: array $options Array of options, following indexes are used: |
doQuickEdit( $text, User $user, $comment = '', $minor = 0 ) X-Ref |
Edit an article without doing all that other stuff The article must already exist; link tables etc are not updated, caches are not flushed. param: string $text Text submitted param: User $user The relevant user param: string $comment Comment submitted param: bool $minor Whereas it's a minor modification |
doQuickEditContent( Content $content, User $user, $comment = '', $minor = false,$serialisation_format = null) X-Ref |
Edit an article without doing all that other stuff The article must already exist; link tables etc are not updated, caches are not flushed. param: Content $content Content submitted param: User $user The relevant user param: string $comment Comment submitted param: bool $minor Whereas it's a minor modification param: string $serialisation_format Format for storing the content in the database |
doUpdateRestrictions( array $limit, array $expiry,&$cascade, $reason, User $user) X-Ref |
Update the article's restriction field, and leave a log entry. This works for protection both existing and non-existing pages. param: array $limit Set of restriction keys param: array $expiry Per restriction type expiration param: int &$cascade Set to false if cascading protection isn't allowed. param: string $reason param: User $user The user updating the restrictions return: Status |
insertProtectNullRevision( $revCommentMsg, array $limit,array $expiry, $cascade, $reason, $user = null) X-Ref |
Insert a new null revision for this page. param: string $revCommentMsg Comment message key for the revision param: array $limit Set of restriction keys param: array $expiry Per restriction type expiration param: int $cascade Set to false if cascading protection isn't allowed. param: string $reason param: User|null $user return: Revision|null Null on error |
formatExpiry( $expiry ) X-Ref |
param: string $expiry 14-char timestamp or "infinity", or false if the input was invalid return: string |
protectDescription( array $limit, array $expiry ) X-Ref |
Builds the description to serve as comment for the edit. param: array $limit Set of restriction keys param: array $expiry Per restriction type expiration return: string |
protectDescriptionLog( array $limit, array $expiry ) X-Ref |
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. param: array $limit Set of restriction keys param: array $expiry Per restriction type expiration return: string |
flattenRestrictions( $limit ) X-Ref |
Take an array of page restrictions and flatten it to a string suitable for insertion into the page_restrictions field. param: string[] $limit return: string |
doDeleteArticle($reason, $suppress = false, $id = 0, $commit = true, &$error = '', User $user = null) X-Ref |
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 param: string $reason Delete reason for deletion log param: bool $suppress Suppress all revisions and log the deletion in param: int $id Article ID param: bool $commit Defaults to true, triggers transaction end param: array &$error Array of errors to append to param: User $user The deleting user return: bool True if successful |
doDeleteArticleReal($reason, $suppress = false, $id = 0, $commit = true, &$error = '', User $user = null) X-Ref |
Back-end article deletion Deletes the article with database consistency, writes logs, purges caches param: string $reason Delete reason for deletion log param: bool $suppress Suppress all revisions and log the deletion in param: int $id Article ID param: bool $commit Defaults to true, triggers transaction end param: array &$error Array of errors to append to param: User $user The deleting user return: Status Status object; if successful, $status->value is the log_id of the |
doDeleteUpdates( $id, Content $content = null ) X-Ref |
Do some database updates after deletion param: int $id The page_id value of the page being deleted param: Content $content Optional page content to be used when determining |
doRollback($fromP, $summary, $token, $bot, &$resultDetails, User $user) X-Ref |
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 param: string $fromP Name of the user whose edits to rollback. param: string $summary Custom summary. Set to default summary if empty. param: string $token Rollback token. param: bool $bot If true, mark all reverted edits as bot. param: array $resultDetails Array contains result-specific array of additional values param: User $user The user performing the rollback return: array Array of errors, each error formatted as |
commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser ) X-Ref |
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. param: string $fromP Name of the user whose edits to rollback. param: string $summary Custom summary. Set to default summary if empty. param: bool $bot If true, mark all reverted edits as bot. param: array $resultDetails Contains result-specific array of additional values param: User $guser The user performing the rollback return: array |
onArticleCreate( $title ) X-Ref |
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 param: Title $title |
onArticleDelete( $title ) X-Ref |
Clears caches when article is deleted param: Title $title |
onArticleEdit( $title ) X-Ref |
Purge caches on page update etc param: Title $title |
getCategories() X-Ref |
Returns a list of categories this page is a member of. Results will include hidden categories return: TitleArray |
getHiddenCategories() X-Ref |
Returns a list of hidden categories this page is a member of. Uses the page_props and categorylinks tables. return: array Array of Title objects |
getAutosummary( $oldtext, $newtext, $flags ) X-Ref |
Return an applicable autosummary if one exists for the given edit. param: string|null $oldtext The previous text of the page. param: string|null $newtext The submitted text of the page. param: int $flags Bitmask: a bitmask of flags submitted for the edit. return: string An appropriate autosummary, or an empty string. |
getAutoDeleteReason( &$hasHistory ) X-Ref |
Auto-generates a deletion reason param: bool &$hasHistory Whether the page has a history return: string|bool String containing deletion reason or empty string, or boolean false |
updateCategoryCounts( array $added, array $deleted ) X-Ref |
Update all the appropriate counts in the category table, given that we've added the categories $added and deleted the categories $deleted. param: array $added The names of categories that were added param: array $deleted The names of categories that were deleted |
doCascadeProtectionUpdates( ParserOutput $parserOutput ) X-Ref |
No description |
getUsedTemplates() X-Ref |
Return a list of templates used by this article. Uses the templatelinks table return: array Array of Title objects |
preSaveTransform( $text, User $user = null, ParserOptions $popts = null ) X-Ref |
This function is called right before saving the wikitext, so we can do things like signatures and links-in-context. param: string $text Article contents param: User $user User doing the edit param: ParserOptions $popts Parser options, default options for return: string Article contents with altered wikitext markup (signatures |
updateRestrictions($limit = array() X-Ref |
Update the article's restriction field, and leave a log entry. param: array $limit Set of restriction keys param: string $reason param: int &$cascade Set to false if cascading protection isn't allowed. param: array $expiry Per restriction type expiration param: User $user The user updating the restrictions return: bool True on success |
getDeletionUpdates( Content $content = null ) X-Ref |
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. param: Content|null $content Optional Content object for determining the return: array An array of DataUpdates objects |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |