MediaWiki  REL1_19
WikiPage Class Reference

Class representing a MediaWiki article and history. More...

Inheritance diagram for WikiPage:
Collaboration diagram for WikiPage:

List of all members.

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 more detailed success/failure status Deletes the article with database consistency, writes logs, purges caches.
 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)
 Do some database updates after deletion.
 doEdit ($text, $summary, $flags=0, $baseRevId=false, $user=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.
 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)
 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 ()
 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".
 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)
 Get the text of the current revision.
 getTimestamp ()
 getTitle ()
 Get the title object of the article.
 getTouched ()
 Get the page_touched field.
 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)
 getUserText ($audience=Revision::FOR_PUBLIC)
 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 ($text=false)
 Tests if the article text represents a redirect.
 loadPageData ($data= 'fromdb')
 Set the general counter, title etc data loaded from some source.
 makeParserOptions ($user)
 Get parser options suitable for rendering the primary article wikitext.
 pageDataFromId ($dbr, $id)
 Fetch a page record matching the requested ID.
 pageDataFromTitle ($dbr, $title)
 Fetch a page record matching the Title object's namespace and title using a sanitized title string.
 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)
 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)
 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)
 Constructor from a page id.
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

 $mTitle = null
const DELETE_HOOK_ABORTED = -1
 Delete operation aborted by hook.
const DELETE_NO_PAGE = 1
 Page not found.
const DELETE_NO_REVISIONS = 2
 No revisions found to delete.
const DELETE_SUCCESS = 0
 Deletion successful.
 $mDataLoaded = false
 $mIsRedirect = false
 $mLatest = false
 $mPreparedEdit = false

Protected Member Functions

 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)
 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

 $mCounter = null
 $mLastRevision = null
 $mRedirectTarget = null
 $mTimestamp = ''
 $mTouched = '19700101000000'

Detailed Description

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 15 of file WikiPage.php.


Constructor & Destructor Documentation

Constructor and clear the article.

Parameters:
$titleTitle Reference to a Title object.

Definition at line 83 of file WikiPage.php.

References $title.


Member Function Documentation

WikiPage::checkFlags ( flags)

Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.

Parameters:
$flagsInt
Returns:
Int updated $flags

Definition at line 1186 of file WikiPage.php.

Referenced by doEdit().

Here is the caller graph for this function:

Loads page_touched and returns a value indicating if it should be used.

Returns:
boolean true if not a redirect

Definition at line 341 of file WikiPage.php.

References loadPageData().

Here is the call graph for this function:

Clear the object.

Definition at line 156 of file WikiPage.php.

Referenced by doPurge().

Here is the caller graph for this function:

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.

Parameters:
$fromPString: Name of the user whose edits to rollback.
$summaryString: Custom summary. Set to default summary if empty.
$botBoolean: If true, mark all reverted edits as bot.
$resultDetailsArray: contains result-specific array of additional values
$guserUser The user performing the rollback

Definition at line 2173 of file WikiPage.php.

References $wgContLang, $wgUseRCPatrol, Revision\DELETED_TEXT, Revision\DELETED_USER, doEdit(), getRevision(), User\isAllowed(), User\isAllowedAny(), Revision\newFromId(), wfGetDB(), wfMsgForContent(), wfMsgReplaceArgs(), wfReadOnly(), wfRunHooks(), and wfTimestamp().

Referenced by doRollback().

Here is the call graph for this function:

Here is the caller graph for this function:

Perform article updates on a special page creation.

Parameters:
$revRevision object
Todo:
This is a shitty interface function. Kill it and replace the other shitty functions like doEditUpdates and such so it's not needed anymore.
Deprecated:
since 1.18, use doEditUpdates()

Definition at line 2701 of file WikiPage.php.

References $wgUser, doEditUpdates(), and wfDeprecated().

Here is the call graph for this function:

Updates cascading protections.

Parameters:
$parserOutputParserOutput object for the current version

Definition at line 2634 of file WikiPage.php.

References $dbr, $res, ParserOutput\getTemplates(), wfGetDB(), and wfReadOnly().

Here is the call graph for this function:

WikiPage::doDeleteArticle ( reason,
suppress = false,
id = 0,
commit = true,
&$  error = '',
User user = null 
)

Same as doDeleteArticleReal(), but returns more detailed success/failure status Deletes the article with database consistency, writes logs, purges caches.

Parameters:
$reasonstring delete reason for deletion log
$suppressbitfield Revision::DELETED_TEXT Revision::DELETED_COMMENT Revision::DELETED_USER Revision::DELETED_RESTRICTED
$idint article ID
$commitboolean defaults to true, triggers transaction end
&$errorArray of errors to append to
$userUser The deleting user
Returns:
boolean true if successful

Definition at line 1931 of file WikiPage.php.

References DELETE_SUCCESS, and doDeleteArticleReal().

Here is the call graph for this function:

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.

Parameters:
$reasonstring delete reason for deletion log
$suppressbitfield Revision::DELETED_TEXT Revision::DELETED_COMMENT Revision::DELETED_USER Revision::DELETED_RESTRICTED
$idint article ID
$commitboolean defaults to true, triggers transaction end
&$errorArray of errors to append to
$userUser The deleting user
Returns:
int: One of WikiPage::DELETE_* constants

Definition at line 1954 of file WikiPage.php.

References $ok, $t, $user, $wgUser, DELETE_HOOK_ABORTED, DELETE_NO_PAGE, DELETE_NO_REVISIONS, DELETE_SUCCESS, Revision\DELETED_COMMENT, Revision\DELETED_RESTRICTED, Revision\DELETED_TEXT, Revision\DELETED_USER, doDeleteUpdates(), Title\GAID_FOR_UPDATE, wfDebug(), wfGetDB(), and wfRunHooks().

Referenced by doDeleteArticle().

Here is the call graph for this function:

Here is the caller graph for this function:

Do some database updates after deletion.

Parameters:
$idInt: page_id value of the page being deleted

Definition at line 2054 of file WikiPage.php.

References $res, DeferredUpdates\addUpdate(), isCountable(), onArticleDelete(), updateCategoryCounts(), and wfGetDB().

Referenced by doDeleteArticleReal().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$textString: new text
$summaryString: edit summary
$flagsInteger 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.

Parameters:
$baseRevIdthe revision ID this edit was based off, if any
$userUser the user doing the edit
Returns:
Status object. Possible errors: edit-hook-aborted: The ArticleSave hook aborted the edit but didn't set the fatal flag of $status edit-gone-missing: In update mode, but the article didn't exist edit-conflict: In update mode, the article changed unexpectedly edit-no-change: Warning that the text was the same as before edit-already-exists: In creation mode, but the article already exists

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 1244 of file WikiPage.php.

References $changed, $ok, $user, $wgDBtransactions, $wgUseAutomaticEditSummaries, $wgUseNPPatrol, $wgUser, $wgUseRCPatrol, checkFlags(), doEditUpdates(), DeferredUpdates\doUpdates(), getAutosummary(), getId(), getLatest(), getRawText(), getTimestamp(), insertOn(), isCountable(), isRedirect(), loadPageData(), Status\newGood(), RecentChange\notifyEdit(), RecentChange\notifyNew(), prepareTextForEdit(), PatrolLog\record(), updateRevisionOn(), wfDebug(), wfGetDB(), wfProfileIn(), wfProfileOut(), wfRunHooks(), and wfTimestampNow().

Referenced by commitRollback().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$revisionRevision object
$userUser object that did the revision
$optionsArray of options, following indexes are used:
  • changed: boolean, whether the revision changed the content (default true)
  • created: boolean, whether the revision created the page (default false)
  • oldcountable: boolean or null (default null):
    • boolean: whether the page was counted as an article before that revision, only used in changed is true and created is false
    • null: don't change the article count

Definition at line 1547 of file WikiPage.php.

References $options, $title, $total, $user, $wgEnableParserCache, $wgRCMaxAge, DeferredUpdates\addUpdate(), getId(), Revision\getId(), Revision\getText(), User\getTitleKey(), User\isAllowed(), isCountable(), User\isIP(), Revision\isMinor(), User\newFromName(), onArticleCreate(), onArticleEdit(), prepareTextForEdit(), ParserCache\singleton(), MessageCache\singleton(), wfDebug(), wfGetDB(), wfProfileIn(), wfProfileOut(), and wfRunHooks().

Referenced by createUpdates(), and doEdit().

Here is the call graph for this function:

Here is the caller graph for this function:

Perform the actions of a page purging.

Reimplemented in WikiFilePage.

Definition at line 892 of file WikiPage.php.

References $wgUseSquid, clear(), getRawText(), SquidUpdate\newSimplePurge(), MessageCache\singleton(), wfGetDB(), and wfRunHooks().

Here is the call graph for this function:

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.

Parameters:
$textString: text submitted
$userUser The relevant user
$commentString: comment submitted
$minorBoolean: whereas it's a minor modification

Definition at line 1665 of file WikiPage.php.

References $comment, getId(), Revision\insertOn(), updateRevisionOn(), wfGetDB(), wfProfileIn(), wfProfileOut(), and wfRunHooks().

Referenced by quickEdit().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Todo:
: seperate the business/permission stuff out from backend code
Parameters:
$fromPString: Name of the user whose edits to rollback.
$summaryString: Custom summary. Set to default summary if empty.
$tokenString: Rollback token.
$botBoolean: If true, mark all reverted edits as bot.
$resultDetailsArray: contains result-specific array of additional values 'alreadyrolled' : 'current' (rev) success : 'summary' (str), 'current' (rev), 'target' (rev)
$userUser The user performing the rollback
Returns:
array of errors, each error formatted as array(messagekey, param1, param2, ...). On success, the array is empty. This array can also be passed to OutputPage::showPermissionsErrorPage().

Definition at line 2132 of file WikiPage.php.

References commitRollback(), User\matchEditToken(), User\pingLimiter(), and wfArrayDiff2().

Here is the call graph for this function:

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.

Parameters:
$limitArray: set of restriction keys
$reasonString
&$cascadeInteger. Set to false if cascading protection isn't allowed.
$expiryArray: per restriction type expiration
$userUser The user updating the restrictions
Returns:
bool true on success

Definition at line 1694 of file WikiPage.php.

References $changed, $wgContLang, User\getId(), getLatest(), Status\newFatal(), Status\newGood(), Revision\newNullRevision(), Title\purgeExpiredRestrictions(), wfGetDB(), wfMsgForContent(), wfReadOnly(), wfReadOnlyReason(), wfRunHooks(), and wfTimestampNow().

Referenced by updateRestrictions().

Here is the call graph for this function:

Here is the caller graph for this function:

Do standard deferred updates after page view.

Parameters:
$userUser The relevant user

Definition at line 873 of file WikiPage.php.

References $wgDisableCounters, DeferredUpdates\addUpdate(), User\clearNotification(), getId(), User\isAllowed(), and wfReadOnly().

Referenced by viewUpdates().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the approximate revision count of this page.

Deprecated:
in 1.19; use Title::estimateRevisionCount() instead.
Returns:
int

Definition at line 2750 of file WikiPage.php.

References wfDeprecated().

Here is the call graph for this function:

Returns:
bool Whether or not the page exists in the database

Definition at line 292 of file WikiPage.php.

static WikiPage::factory ( Title title) [static]

Create a WikiPage object of the appropriate class for the given title.

Parameters:
$titleTitle
Returns:
WikiPage object of the appropriate type

Definition at line 93 of file WikiPage.php.

References $page, and Title\getNamespace().

Referenced by ParserTest\addArticle(), MediaWikiTestCase\addCoreDBData(), Orphans\checkSeparation(), CleanupSpam\cleanupArticle(), Installer\createMainpage(), ApiTestCaseUpload\deleteFileByTitle(), FileDeleteForm\doDelete(), MovePageForm\doSubmit(), ImportSiteScripts\execute(), DeleteDefaultMessages\execute(), RollbackEdits\execute(), ApiProtect\execute(), Protect\execute(), AttachLatest\execute(), EditCLI\execute(), ApiPurge\execute(), DeleteBatch\execute(), ApiDelete\execute(), ApiRollback\execute(), RefreshLinks\fixRedirect(), SearchEngine\getNearMatchInternal(), ApiParse\getParsedSectionOrText(), EditPage\getPreloadedText(), ListredirectsPage\getRedirectTarget(), ApiPageSet\getRedirectTargets(), RequestContext\getWikiPage(), WikiRevision\importOldRevision(), SearchEngineTest\insertPage(), SpecialMergeHistory\merge(), Title\moveToInternal(), newFromID(), Title\newFromRedirectArray(), XmlDumpWriter\openPage(), DifferenceEngine\renderNewRevision(), ImportReporter\reportPage(), ArticleTablesTest\testbug14404(), ParserOptionsTest\testGetParserCacheKeyWithDynamicDates(), ArticleTest\testWikiPageFactory(), PageArchive\undeleteRevisions(), SpecialEditWatchlist\unwatchTitles(), LinksUpdate\updateCategoryCounts(), and Title\updateTitleProtection().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$limitArray
Returns:
String

Definition at line 1898 of file WikiPage.php.

References $limit.

Get the Title object or URL this page redirects to.

Returns:
mixed false, Title of in-wiki target, or string with URL

Reimplemented in WikiFilePage.

Definition at line 663 of file WikiPage.php.

References getRedirectTarget(), and getRedirectURL().

Here is the call graph for this function:

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.

Todo:
: move this UI stuff somewhere else
Returns:
Array

Reimplemented in WikiFilePage.

Definition at line 141 of file WikiPage.php.

WikiPage::getAutoDeleteReason ( &$  hasHistory)

Auto-generates a deletion reason.

Parameters:
&$hasHistoryBoolean: whether the page has a history
Returns:
mixed String containing deletion reason or empty string, or boolean false if no revision occurred

Definition at line 2478 of file WikiPage.php.

References $res, $wgContLang, Revision\DELETED_USER, getRevision(), wfGetDB(), and wfMsgForContent().

Here is the call graph for this function:

static WikiPage::getAutosummary ( oldtext,
newtext,
flags 
) [static]

Return an applicable autosummary if one exists for the given edit.

Parameters:
$oldtextString: the previous text of the page.
$newtextString: The submitted text of the page.
$flagsInt bitmask: a bitmask of flags submitted for the edit.
Returns:
string An appropriate autosummary, or an empty string.

Definition at line 2423 of file WikiPage.php.

References $wgContLang, Title\newFromRedirect(), and wfMsgForContent().

Referenced by doEdit().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns:
string MW timestamp

Definition at line 527 of file WikiPage.php.

References $wgMemc, and wfMemcKey().

Referenced by loadPageData().

Here is the call graph for this function:

Here is the caller graph for this function:

Parameters:
$audienceInteger: 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
Returns:
string Comment stored for the last article revision

Definition at line 499 of file WikiPage.php.

References loadLastEdit().

Here is the call graph for this function:

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.

Returns:
UserArrayFromResult

Definition at line 715 of file WikiPage.php.

References $dbr, $options, $res, $user, getId(), getUser(), and wfGetDB().

Here is the call graph for this function:

Returns:
int The view count for the page

Definition at line 311 of file WikiPage.php.

References loadPageData().

Here is the call graph for this function:

#@-

Returns a list of hidden categories this page is a member of. Uses the page_props and categorylinks tables.

Returns:
Array of Title objects

Definition at line 2392 of file WikiPage.php.

References $dbr, $res, $result, Title\makeTitle(), and wfGetDB().

Here is the call graph for this function:

WikiPage::getLastNAuthors ( num,
revLatest = 0 
)

Get the last N authors.

Parameters:
$numInteger: number of revisions to get
$revLatestString: the latest rev_id, selected from the master (optional)
Returns:
array Array of authors, duplicates not removed

Definition at line 767 of file WikiPage.php.

References $res, wfGetDB(), wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

Get the page_latest field.

Returns:
integer rev_id of current revision

Definition at line 363 of file WikiPage.php.

References loadPageData().

Referenced by doEdit(), doUpdateRestrictions(), getParserOutput(), isParserCacheUsed(), and loadLastEdit().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if last revision was marked as "minor edit".

Returns:
boolean Minor edit indicator for the last article revision.

Definition at line 513 of file WikiPage.php.

References loadLastEdit().

Here is the call graph for this function:

WikiPage::getParserOutput ( ParserOptions parserOptions,
oldid = null 
)

Get a ParserOutput for the given ParserOptions and revision ID.

The parser cache will be used if possible.

Since:
1.19
Parameters:
$parserOptionsParserOptions to use for the parse operation
$oldidRevision ID to get the text from, passing null or 0 will get the current revision (default value)
Returns:
ParserOutput or false if the revision was not found

Definition at line 840 of file WikiPage.php.

References getLatest(), ParserOptions\getStubThreshold(), isParserCacheUsed(), ParserCache\singleton(), wfDebug(), wfIncrStats(), wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

Get the text of the current revision.

No side-effects...

Returns:
String|false The text of the current revision

Definition at line 432 of file WikiPage.php.

References loadLastEdit().

Referenced by doEdit(), doPurge(), getUndoText(), insertRedirect(), isCountable(), prepareTextForEdit(), and replaceSection().

Here is the call graph for this function:

Here is the caller graph for this function:

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()

Returns:
Title|mixed object, or null if this page is not a redirect

Reimplemented in WikiFilePage.

Definition at line 595 of file WikiPage.php.

References $dbr, getId(), insertRedirect(), Title\makeTitle(), and wfGetDB().

Referenced by followRedirect().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$rtTitle Redirect target
Returns:
mixed false, Title object of local target, or string with URL

Definition at line 674 of file WikiPage.php.

Referenced by followRedirect().

Here is the caller graph for this function:

Get the latest revision.

Returns:
Revision|null

Definition at line 402 of file WikiPage.php.

References loadLastEdit().

Referenced by commitRollback(), and getAutoDeleteReason().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the text of the current revision.

No side-effects...

Parameters:
$audienceInteger: 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
Returns:
String|false The text of the current revision

Definition at line 419 of file WikiPage.php.

References loadLastEdit().

Here is the call graph for this function:

Returns:
string MW timestamp of last article revision

Definition at line 443 of file WikiPage.php.

References loadLastEdit(), and wfTimestamp().

Referenced by doEdit().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the title object of the article.

Returns:
Title object of this page

Definition at line 149 of file WikiPage.php.

Referenced by Article\newFromWikiPage(), and updateRedirectOn().

Here is the caller graph for this function:

Get the page_touched field.

Returns:
string containing GMT timestamp

Definition at line 352 of file WikiPage.php.

References loadPageData().

Here is the call graph for this function:

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

Parameters:
$undoRevision
$undoafterRevision Must be an earlier revision than $undo
Returns:
mixed string on success, false on failure

Definition at line 1104 of file WikiPage.php.

References getRawText(), Revision\getText(), and wfMerge().

Here is the call graph for this function:

Return a list of templates used by this article.

Uses the templatelinks table

Deprecated:
in 1.19; use Title::getTemplateLinksFrom()
Returns:
Array of Title objects

Definition at line 2687 of file WikiPage.php.

Parameters:
$audienceInteger: 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
Returns:
int user ID for the user that made the last article revision

Definition at line 467 of file WikiPage.php.

References loadLastEdit().

Referenced by getContributors().

Here is the call graph for this function:

Here is the caller graph for this function:

Parameters:
$audienceInteger: 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
Returns:
string username of the user that made the last article revision

Definition at line 483 of file WikiPage.php.

References loadLastEdit().

Here is the call graph for this function:

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.

Returns:
bool

Reimplemented in WikiCategoryPage.

Definition at line 304 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.

Parameters:
$dbwDatabaseBase
Returns:
int The newly created page_id key, or false if the title already existed

Definition at line 935 of file WikiPage.php.

References wfProfileIn(), wfProfileOut(), and wfRandom().

Referenced by doEdit().

Here is the call graph for this function:

Here is the caller graph for this function:

Insert an entry for this page into the redirect table.

Don't call this function directly unless you know what you're doing.

Returns:
Title object or null if not a redirect

Definition at line 629 of file WikiPage.php.

References getRawText(), insertRedirectEntry(), and Title\newFromRedirectRecurse().

Referenced by getRedirectTarget().

Here is the call graph for this function:

Here is the caller graph for this function:

Insert or update the redirect table entry for this page to indicate it redirects to $rt .

Parameters:
$rtTitle redirect target

Definition at line 644 of file WikiPage.php.

References getId(), and wfGetDB().

Referenced by insertRedirect(), and updateRedirectOn().

Here is the call graph for this function:

Here is the caller graph for this function:

Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.

Deprecated:
in 1.19; use Title::isBigDeletion() instead.
Returns:
bool

Definition at line 2739 of file WikiPage.php.

References wfDeprecated().

Here is the call graph for this function:

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.

Parameters:
$editInfoObject or false: object returned by prepareTextForEdit(), if false, the current database state will be used
Returns:
Boolean

Definition at line 553 of file WikiPage.php.

References $wgArticleCountMethod, getId(), getRawText(), isRedirect(), and wfGetDB().

Referenced by doDeleteUpdates(), doEdit(), and doEditUpdates().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::isParserCacheUsed ( ParserOptions parserOptions,
oldid 
)

Should the parser cache be used?

Parameters:
$parserOptionsParserOptions to check
$oldidint
Returns:
boolean

Definition at line 820 of file WikiPage.php.

References $wgEnableParserCache, getLatest(), and ParserOptions\getStubThreshold().

Referenced by getParserOutput(), and useParserCache().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::isRedirect ( text = false)

Tests if the article text represents a redirect.

Parameters:
$textmixed string containing article contents, or boolean
Returns:
bool

Reimplemented in WikiFilePage.

Definition at line 325 of file WikiPage.php.

References loadPageData(), and Title\newFromRedirect().

Referenced by doEdit(), and isCountable().

Here is the call graph for this function:

Here is the caller graph for this function:

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 374 of file WikiPage.php.

References getId(), getLatest(), Revision\newFromPageId(), and setLastEdit().

Referenced by getComment(), getMinorEdit(), getRawText(), getRevision(), getText(), getTimestamp(), getUser(), and getUserText().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::loadPageData ( data = 'fromdb')

Set the general counter, title etc data loaded from some source.

Parameters:
$dataObject|String One of the following: A DB query result object or... "fromdb" to get from a slave DB or... "fromdbmaster" to get from the master DB
Returns:
void

Definition at line 244 of file WikiPage.php.

References getCachedLastEditTime(), pageDataFromTitle(), LinkCache\singleton(), wfGetDB(), and wfTimestamp().

Referenced by checkTouched(), doEdit(), getCount(), getLatest(), getTouched(), and isRedirect().

Here is the call graph for this function:

Here is the caller graph for this function:

Get parser options suitable for rendering the primary article wikitext.

Parameters:
User | string$userUser object or 'canonical'
Returns:
ParserOptions

Definition at line 1486 of file WikiPage.php.

References $options, $user, $wgContLang, ParserOptions\newFromUser(), and ParserOptions\newFromUserAndLang().

Referenced by prepareTextForEdit().

Here is the call graph for this function:

Here is the caller graph for this function:

static WikiPage::newFromID ( id) [static]

Constructor from a page id.

Parameters:
$idInt article ID to load
Returns:
WikiPage

Definition at line 123 of file WikiPage.php.

References $t, and factory().

Here is the call graph for this function:

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

Parameters:
$titleTitle object

Definition at line 2302 of file WikiPage.php.

References $title.

Referenced by doEditUpdates(), and Title\moveToInternal().

Here is the caller graph for this function:

static WikiPage::onArticleDelete ( title) [static]

Clears caches when article is deleted.

Parameters:
$titleTitle

Definition at line 2323 of file WikiPage.php.

References $title, HTMLFileCache\clearFileCache(), false, User\newFromName(), User\setNewtalk(), RepoGroup\singleton(), and MessageCache\singleton().

Referenced by doDeleteUpdates(), and Title\moveToInternal().

Here is the call graph for this function:

Here is the caller graph for this function:

static WikiPage::onArticleEdit ( title) [static]

Purge caches on page update etc.

Parameters:
$titleTitle object
Todo:
: verify that $title is always a Title object (and never false or null), add Title hint to parameter $title

Definition at line 2369 of file WikiPage.php.

References $title, DeferredUpdates\addHTMLCacheUpdate(), and HTMLFileCache\clearFileCache().

Referenced by doEditUpdates().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::pageData ( dbr,
conditions 
) [protected]

Fetch a page record with the given conditions.

Parameters:
$dbrDatabaseBase object
$conditionsArray
Returns:
mixed Database result resource, or false on failure

Definition at line 197 of file WikiPage.php.

References $dbr, selectFields(), and wfRunHooks().

Referenced by pageDataFromId(), and pageDataFromTitle().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::pageDataFromId ( dbr,
id 
)

Fetch a page record matching the requested ID.

Parameters:
$dbrDatabaseBase
$idInteger
Returns:
mixed Database result resource, or false on failure

Definition at line 230 of file WikiPage.php.

References $dbr, and pageData().

Here is the call graph for this function:

WikiPage::pageDataFromTitle ( dbr,
title 
)

Fetch a page record matching the Title object's namespace and title using a sanitized title string.

Parameters:
$dbrDatabaseBase object
$titleTitle object
Returns:
mixed Database result resource, or false on failure

Definition at line 217 of file WikiPage.php.

References $dbr, $title, and pageData().

Referenced by loadPageData().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1502 of file WikiPage.php.

References $user, $wgContLang, $wgParser, $wgUser, getRawText(), makeParserOptions(), ParserOptions\newFromUserAndLang(), and wfRunHooks().

Referenced by doEdit(), and doEditUpdates().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Deprecated:
in 1.19; use Parser::preSaveTransform() instead
Parameters:
$textString article contents
$userUser object: user doing the edit
$poptsParserOptions object: parser options, default options for the user loaded if null given
Returns:
string article contents with altered wikitext markup (signatures converted, {{subst:}}, templates, etc.)

Definition at line 2719 of file WikiPage.php.

References $user, $wgParser, $wgUser, ParserOptions\newFromUser(), and wfDeprecated().

Here is the call graph for this function:

WikiPage::quickEdit ( text,
comment = '',
minor = 0 
)
Deprecated:
since 1.18

Definition at line 2779 of file WikiPage.php.

References $comment, $wgUser, doQuickEdit(), and wfDeprecated().

Here is the call graph for this function:

WikiPage::replaceSection ( section,
text,
sectionTitle = '',
edittime = null 
)
Parameters:
$sectionempty/null/false or a section number (0, 1, 2, T1, T2...)
$textString: new text of the section
$sectionTitleString: new section's subject, only if $section is 'new'
$edittimeString: revision timestamp or null to use the current revision
Returns:
string Complete article text, or null if error

Definition at line 1133 of file WikiPage.php.

References $section, $wgParser, getId(), getRawText(), Revision\loadFromTimestamp(), wfDebug(), wfGetDB(), wfMsgForContent(), wfProfileIn(), wfProfileOut(), and wfRunHooks().

Here is the call graph for this function:

static WikiPage::selectFields ( ) [static]

Return the list of revision fields that should be selected to create a new page.

Returns:
array

Definition at line 175 of file WikiPage.php.

Referenced by pageData(), and ArticleTest\testStaticFunctions().

Here is the caller graph for this function:

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.

Parameters:
$timestampstring
Returns:
void

Definition at line 539 of file WikiPage.php.

References $wgMemc, wfMemcKey(), and wfTimestamp().

Referenced by updateRevisionOn().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::setLastEdit ( Revision revision) [protected]

Set the latest revision.

Definition at line 393 of file WikiPage.php.

References Revision\getTimestamp().

Referenced by loadLastEdit(), and updateRevisionOn().

Here is the call graph for this function:

Here is the caller graph for this function:

Set the page timestamp (use only to avoid DB queries)

Parameters:
$tsstring MW timestamp of last article revision
Returns:
void

Definition at line 456 of file WikiPage.php.

References wfTimestamp().

Here is the call graph for this function:

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.

Parameters:
$addedarray The names of categories that were added
$deletedarray The names of categories that were deleted

Definition at line 2573 of file WikiPage.php.

References wfGetDB().

Referenced by doDeleteUpdates().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::updateIfNewerOn ( dbw,
revision 
)

If the given revision is newer than the currently set page_latest, update the page record.

Otherwise, do nothing.

Parameters:
$dbwDatabase object
$revisionRevision object
Returns:
mixed

Definition at line 1066 of file WikiPage.php.

References getId(), updateRevisionOn(), wfProfileIn(), wfProfileOut(), and wfTimestamp().

Here is the call graph for this function:

WikiPage::updateRedirectOn ( dbw,
redirectTitle,
lastRevIsRedirect = null 
)

Add row to the redirect table if this is a redirect, remove otherwise.

Parameters:
$dbwDatabaseBase
$redirectTitleTitle object pointing to the redirect target, or NULL if this is not a redirect
$lastRevIsRedirectIf given, will optimize adding and removing rows in redirect table.
Returns:
bool true on success, false on failure

Definition at line 1031 of file WikiPage.php.

References getId(), getTitle(), insertRedirectEntry(), RepoGroup\singleton(), wfProfileIn(), and wfProfileOut().

Referenced by updateRevisionOn().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiPage::updateRestrictions ( limit = array(),
reason = '',
&$  cascade = 0,
expiry = array(),
User user = null 
)

Update the article's restriction field, and leave a log entry.

Deprecated:
since 1.19
Parameters:
$limitArray: set of restriction keys
$reasonString
&$cascadeInteger. Set to false if cascading protection isn't allowed.
$expiryArray: per restriction type expiration
$userUser The user updating the restrictions
Returns:
bool true on success

Definition at line 2766 of file WikiPage.php.

References $limit, $user, $wgUser, and doUpdateRestrictions().

Here is the call graph for this function:

WikiPage::updateRevisionOn ( dbw,
revision,
lastRevision = null,
lastRevIsRedirect = null 
)

Update the page record to point to a newly saved revision.

Parameters:
$dbwDatabaseBase: object
$revisionRevision: For ID number, and text used to set length and redirect status fields
$lastRevisionInteger: 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.
$lastRevIsRedirectBoolean: if given, will optimize adding and removing rows in redirect table.
Returns:
bool true on success, false on failure

Definition at line 979 of file WikiPage.php.

References $result, getId(), Title\newFromRedirectRecurse(), setCachedLastEditTime(), setLastEdit(), LinkCache\singleton(), updateRedirectOn(), wfProfileIn(), wfProfileOut(), and wfTimestampNow().

Referenced by doEdit(), doQuickEdit(), and updateIfNewerOn().

Here is the call graph for this function:

Here is the caller graph for this function:

Deprecated:
since 1.18

Definition at line 2797 of file WikiPage.php.

References $wgUser, isParserCacheUsed(), ParserOptions\newFromUser(), and wfDeprecated().

Here is the call graph for this function:

Deprecated:
since 1.18

Definition at line 2788 of file WikiPage.php.

References $wgUser, doViewUpdates(), and wfDeprecated().

Here is the call graph for this function:


Member Data Documentation

WikiPage::$mCounter = null [protected]

Definition at line 77 of file WikiPage.php.

WikiPage::$mDataLoaded = false

{

Access:
protected

Definition at line 48 of file WikiPage.php.

WikiPage::$mIsRedirect = false

{

Access:
protected

Definition at line 49 of file WikiPage.php.

WikiPage::$mLastRevision = null [protected]

Definition at line 62 of file WikiPage.php.

WikiPage::$mLatest = false

{

Access:
protected

Definition at line 50 of file WikiPage.php.

WikiPage::$mPreparedEdit = false

{

Access:
protected

Definition at line 51 of file WikiPage.php.

WikiPage::$mRedirectTarget = null [protected]

Definition at line 57 of file WikiPage.php.

WikiPage::$mTimestamp = '' [protected]

Definition at line 67 of file WikiPage.php.

WikiPage::$mTitle = null

Definition at line 43 of file WikiPage.php.

WikiPage::$mTouched = '19700101000000' [protected]

Definition at line 72 of file WikiPage.php.

Delete operation aborted by hook.

Definition at line 23 of file WikiPage.php.

Referenced by doDeleteArticleReal().

Page not found.

Definition at line 33 of file WikiPage.php.

Referenced by doDeleteArticleReal().

No revisions found to delete.

Definition at line 38 of file WikiPage.php.

Referenced by doDeleteArticleReal().

Deletion successful.

Definition at line 28 of file WikiPage.php.

Referenced by FileDeleteForm\doDelete(), doDeleteArticle(), and doDeleteArticleReal().


The documentation for this class was generated from the following file: