MediaWiki
master
|
Class for viewing MediaWiki article and history. More...
Public Member Functions | |
__call ($fname, $args) | |
Use PHP's magic __call handler to transform instance calls to WikiPage functions for backwards compatibility. | |
__construct (Title $title, $oldId=null) | |
Constructor and clear the article. | |
__get ($fname) | |
Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility. | |
__set ($fname, $fvalue) | |
Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility. | |
adjustDisplayTitle (ParserOutput $pOutput) | |
Adjust title for pages with displaytitle, -{T|}- or language conversion. | |
clear () | |
Clear the object. | |
commitRollback ($fromP, $summary, $bot, &$resultDetails, User $guser=null) | |
confirmDelete ($reason) | |
Output deletion confirmation dialog. | |
delete () | |
UI entry point for page deletion. | |
doDelete ($reason, $suppress=false) | |
Perform a deletion and output success or failure messages. | |
doDeleteArticle ($reason, $suppress=false, $id=0, $commit=true, &$error= '') | |
doRollback ($fromP, $summary, $token, $bot, &$resultDetails, User $user=null) | |
doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, User $user) | |
fetchContent () | |
Get text of an article from database Does *NOT* follow redirects. | |
generateReason (&$hasHistory) | |
getContent () | |
Note that getContent/loadContent do not follow redirects anymore. | |
getContext () | |
Gets the context this Article is executed in. | |
getOldID () | |
getOldIDFromRequest () | |
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect. | |
getPage () | |
Get the WikiPage object of this instance. | |
getParserOptions () | |
Get parser options suitable for rendering the primary article wikitext. | |
getParserOutput ($oldid=null, User $user=null) | |
#@- | |
getRevIdFetched () | |
Use this to fetch the rev ID used on page views. | |
getRevisionFetched () | |
Get the fetched Revision object depending on request parameters or null on failure. | |
getRobotPolicy ($action, $pOutput=null) | |
Get the robot policy to be used for the current view. | |
getTitle () | |
Get the title object of the article. | |
info () | |
Info about this page. | |
isCurrent () | |
Returns true if the currently-referenced revision is the current edit to this page (and it exists). | |
isFileCacheable () | |
Check if the page can be cached. | |
loadContent () | |
Load the revision (including text) into this object. | |
protect () | |
action=protect handler | |
purge () | |
Handle action=purge. | |
render () | |
Handle action=render. | |
revert () | |
Handle action=revert. | |
rollback () | |
Handle action=rollback. | |
setContext ($context) | |
Sets the context this Article is executed in. | |
setOldSubtitle ($oldid=0) | |
Generate the navigation links when browsing through an article revisions It shows the information as: Revision as of <date>; view current revision <- Previous version | Next Version -> | |
setParserOptions (ParserOptions $options) | |
Override the ParserOptions used to render the primary article wikitext. | |
setRedirectedFrom (Title $from) | |
Tell the page view functions that this view was redirected from another page on the wiki. | |
showDeletedRevisionHeader () | |
If the revision requested for view is deleted, check permissions. | |
showDiffPage () | |
Show a diff page according to current request variables. | |
showMissingArticle () | |
Show the error text for a missing article. | |
showNamespaceHeader () | |
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]]. | |
showPatrolFooter () | |
If patrol is possible, output a patrol UI box. | |
showRedirectedFromHeader () | |
If this request is a redirect view, send "redirected from" subtitle to the output. | |
showViewFooter () | |
Show the footer section of an ordinary page view. | |
unprotect () | |
action=unprotect handler (alias) | |
updateRestrictions ($limit=array(), $reason= '', &$cascade=0, $expiry=array()) | |
view () | |
This is the default action of the index.php entry point: just view the page of the given title. | |
viewRedirect ($target, $appendSubtitle=true, $forceKnown=false) | |
Return the HTML for the top of a redirect page. | |
Static Public Member Functions | |
static | formatRobotPolicy ($policy) |
Converts a String robot policy into an associative array, to allow merging of several policies using array_merge(). | |
static | getAutosummary ($oldtext, $newtext, $flags) |
static | getRedirectHeaderHtml (Language $lang, $target, $forceKnown=false) |
Return the HTML for the top of a redirect page. | |
static | newFromID ($id) |
Constructor from a page id. | |
static | newFromTitle ($title, IContextSource $context) |
Create an Article object of the appropriate class for the given page. | |
static | newFromWikiPage (WikiPage $page, IContextSource $context) |
Create an Article object of the appropriate class for the given page. | |
static | onArticleCreate ($title) |
static | onArticleDelete ($title) |
static | onArticleEdit ($title) |
static | selectFields () |
Protected Member Functions | |
fetchContentObject () | |
Get text content object Does *NOT* follow redirects. | |
getContentObject () | |
Returns a Content object representing the pages effective display content, not necessarily the revision's content! | |
newPage (Title $title) | |
showCssOrJsPage ($showCacheHint=true) | |
Show a page view for a page formatted as CSS or JavaScript. | |
tryFileCache () | |
checkLastModified returns true if it has taken care of all output to the client that is necessary for this request. | |
IContextSource | $mContext |
The context this Article is executed in $mContext. | |
WikiPage | $mPage |
The WikiPage object of this instance $mPage. | |
ParserOptions | $mParserOptions |
ParserOptions object for $wgUser articles $mParserOptions. | |
string | $mContent |
Text of the revision we are working on $mContent. | |
Content | $mContentObject |
Content of the revision we are working on. | |
bool | $mContentLoaded = false |
Is the content ($mContent) already loaded? $mContentLoaded. | |
int null | $mOldId |
The oldid of the article that is to be shown, 0 for the current revision $mOldId. | |
Title | $mRedirectedFrom = null |
Title from which we were redirected here $mRedirectedFrom. | |
string false | $mRedirectUrl = false |
URL to redirect to or false if none $mRedirectUrl. | |
int | $mRevIdFetched = 0 |
Revision ID of revision we are working on $mRevIdFetched. | |
Revision | $mRevision = null |
Revision we are working on $mRevision. | |
ParserOutput | $mParserOutput |
ParserOutput object $mParserOutput. |
Class for viewing MediaWiki article and history.
This maintains WikiPage functions for backwards compatibility.
See design.txt for an overview. Note: edit user interface and cache support functions have been moved to separate EditPage and HTMLFileCache classes.
Definition at line 36 of file Article.php.
Article::__construct | ( | Title $ | title, |
$ | oldId = null |
||
) |
Constructor and clear the article.
$title | Title Reference to a Title object. |
$oldId | Integer revision ID, null to fetch from request, zero for current |
Definition at line 110 of file Article.php.
Article::__call | ( | $ | fname, |
$ | args | ||
) |
Use PHP's magic __call handler to transform instance calls to WikiPage functions for backwards compatibility.
string | $fname | Name of called method |
array | $args | Arguments to the method |
Definition at line 1951 of file Article.php.
Article::__get | ( | $ | fname | ) |
Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility.
string | $fname | Field name |
Definition at line 1916 of file Article.php.
Article::__set | ( | $ | fname, |
$ | fvalue | ||
) |
Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility.
string | $fname | Field name |
$fvalue | mixed New value |
Definition at line 1931 of file Article.php.
Article::adjustDisplayTitle | ( | ParserOutput $ | pOutput | ) |
Adjust title for pages with displaytitle, -{T|}- or language conversion.
$pOutput | ParserOutput |
Definition at line 752 of file Article.php.
Article::clear | ( | ) |
Clear the object.
Definition at line 211 of file Article.php.
Article::commitRollback | ( | $ | fromP, |
$ | summary, | ||
$ | bot, | ||
&$ | resultDetails, | ||
User $ | guser = null |
||
) |
$fromP | |
$summary | |
$bot | |
$resultDetails | |
$guser | User |
Definition at line 2024 of file Article.php.
Article::confirmDelete | ( | $ | reason | ) |
Output deletion confirmation dialog.
string | $reason | prefilled reason |
Definition at line 1597 of file Article.php.
Article::delete | ( | ) |
UI entry point for page deletion.
Reimplemented in ImagePage.
Definition at line 1492 of file Article.php.
Article::doDelete | ( | $ | reason, |
$ | suppress = false |
||
) |
Perform a deletion and output success or failure messages.
$reason | |
$suppress | bool |
Definition at line 1709 of file Article.php.
Article::doDeleteArticle | ( | $ | reason, |
$ | suppress = false , |
||
$ | id = 0 , |
||
$ | commit = true , |
||
&$ | error = '' |
||
) |
$reason | string |
$suppress | bool |
$id | int |
$commit | bool |
$error | string |
Definition at line 1998 of file Article.php.
Article::doRollback | ( | $ | fromP, |
$ | summary, | ||
$ | token, | ||
$ | bot, | ||
&$ | resultDetails, | ||
User $ | user = null |
||
) |
$fromP | |
$summary | |
$token | |
$bot | |
$resultDetails | |
$user | User |
Definition at line 2011 of file Article.php.
Article::doUpdateRestrictions | ( | array $ | limit, |
array $ | expiry, | ||
&$ | cascade, | ||
$ | reason, | ||
User $ | user | ||
) |
$limit | array |
$expiry | array |
$cascade | bool |
$reason | string |
$user | User |
Definition at line 1969 of file Article.php.
Get text of an article from database Does *NOT* follow redirects.
Definition at line 365 of file Article.php.
Article::fetchContentObject | ( | ) | [protected] |
Get text content object Does *NOT* follow redirects.
TODO: when is this null?
Definition at line 396 of file Article.php.
References array(), Revision\FOR_THIS_USER, getContext(), getOldID(), getTitle(), Revision\newFromId(), wfDebug(), wfProfileIn(), and wfProfileOut().
static Article::formatRobotPolicy | ( | $ | policy | ) | [static] |
Converts a String robot policy into an associative array, to allow merging of several policies using array_merge().
$policy | Mixed, returns empty array on null/false/'', transparent to already-converted arrays, converts String. |
Definition at line 915 of file Article.php.
Article::generateReason | ( | &$ | hasHistory | ) |
static Article::getAutosummary | ( | $ | oldtext, |
$ | newtext, | ||
$ | flags | ||
) | [static] |
$oldtext | |
$newtext | |
$flags |
Definition at line 2076 of file Article.php.
Note that getContent/loadContent do not follow redirects anymore.
If you need to fetch redirectable content easily, try the shortcut in WikiPage::getRedirectTarget()
This function has side effects! Do not use this function if you only want the real revision text if any.
Definition at line 233 of file Article.php.
Article::getContentObject | ( | ) | [protected] |
Returns a Content object representing the pages effective display content, not necessarily the revision's content!
Note that getContent/loadContent do not follow redirects anymore. If you need to fetch redirectable content easily, try the shortcut in WikiPage::getRedirectTarget()
This function has side effects! Do not use this function if you only want the real revision text if any.
Reimplemented in ImagePage.
Definition at line 254 of file Article.php.
Gets the context this Article is executed in.
Definition at line 1865 of file Article.php.
Referenced by CategoryPage\closeShowCategory(), fetchContentObject(), protect(), showDiffPage(), CategoryPage\view(), and viewRedirect().
Definition at line 284 of file Article.php.
Referenced by fetchContentObject().
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.
Definition at line 297 of file Article.php.
Article::getPage | ( | ) |
Get the WikiPage object of this instance.
Definition at line 204 of file Article.php.
Get parser options suitable for rendering the primary article wikitext.
Definition at line 1841 of file Article.php.
Article::getParserOutput | ( | $ | oldid = null , |
User $ | user = null |
||
) |
#@-
Lightweight method to get the parser output for a page, checking the parser cache and so on. Doesn't consider most of the stuff that WikiPage::view is forced to consider, so it's not appropriate to use there.
Definition at line 1810 of file Article.php.
static Article::getRedirectHeaderHtml | ( | Language $ | lang, |
$ | target, | ||
$ | forceKnown = false |
||
) | [static] |
Return the HTML for the top of a redirect page.
Chances are you should just be using the ParserOutput from WikitextContent::getParserOutput instead of calling this for redirects.
Language | $lang | |
Title | array | $target | destination(s) to redirect |
bool | $forceKnown | Should the image be shown as a bluelink regardless of existence? |
Definition at line 1426 of file Article.php.
Referenced by WikitextContent\getParserOutput(), and viewRedirect().
Use this to fetch the rev ID used on page views.
Definition at line 483 of file Article.php.
Get the fetched Revision object depending on request parameters or null on failure.
Definition at line 472 of file Article.php.
Article::getRobotPolicy | ( | $ | action, |
$ | pOutput = null |
||
) |
Get the robot policy to be used for the current view.
string | $action | the action= GET parameter |
$pOutput | ParserOutput|null |
Definition at line 835 of file Article.php.
Get the title object of the article.
Definition at line 194 of file Article.php.
Referenced by EditPage\__construct(), ImageHistoryList\__construct(), CategoryPage\closeShowCategory(), fetchContentObject(), CategoryPage\view(), and viewRedirect().
Article::info | ( | ) |
Returns true if the currently-referenced revision is the current edit to this page (and it exists).
Definition at line 456 of file Article.php.
Load the revision (including text) into this object.
Definition at line 348 of file Article.php.
static Article::newFromID | ( | $ | id | ) | [static] |
Constructor from a page id.
int | $id | article ID to load |
Reimplemented in ImagePage, and CategoryPage.
Definition at line 128 of file Article.php.
static Article::newFromTitle | ( | $ | title, |
IContextSource $ | context | ||
) | [static] |
Create an Article object of the appropriate class for the given page.
$title | Title |
$context | IContextSource |
Definition at line 142 of file Article.php.
Referenced by RebuildFileCache\execute().
static Article::newFromWikiPage | ( | WikiPage $ | page, |
IContextSource $ | context | ||
) | [static] |
Create an Article object of the appropriate class for the given page.
$page | WikiPage |
$context | IContextSource |
Definition at line 174 of file Article.php.
Referenced by ApiEditPage\execute().
Article::newPage | ( | Title $ | title | ) | [protected] |
$title | Title |
Reimplemented in ImagePage, and CategoryPage.
Definition at line 119 of file Article.php.
static Article::onArticleCreate | ( | $ | title | ) | [static] |
static Article::onArticleDelete | ( | $ | title | ) | [static] |
$title | Title |
Definition at line 2058 of file Article.php.
static Article::onArticleEdit | ( | $ | title | ) | [static] |
$title | Title |
Definition at line 2065 of file Article.php.
Article::protect | ( | ) |
action=protect handler
Definition at line 1477 of file Article.php.
References getContext(), and view().
Article::purge | ( | ) |
Handle action=purge.
Definition at line 1888 of file Article.php.
Article::render | ( | ) |
Article::revert | ( | ) |
static Article::selectFields | ( | ) | [static] |
Article::setContext | ( | $ | context | ) |
Sets the context this Article is executed in.
$context | IContextSource |
Definition at line 1855 of file Article.php.
Article::setOldSubtitle | ( | $ | oldid = 0 | ) |
Generate the navigation links when browsing through an article revisions It shows the information as: Revision as of <date>; view current revision <- Previous version | Next Version ->
int | $oldid | revision ID of this article revision |
Definition at line 1277 of file Article.php.
Article::setParserOptions | ( | ParserOptions $ | options | ) |
Override the ParserOptions used to render the primary article wikitext.
ParserOptions | $options |
MWException | if the parser options where already initialized. |
Definition at line 1828 of file Article.php.
Article::setRedirectedFrom | ( | Title $ | from | ) |
Tell the page view functions that this view was redirected from another page on the wiki.
$from | Title object. |
Definition at line 185 of file Article.php.
Article::showCssOrJsPage | ( | $ | showCacheHint = true | ) | [protected] |
Show a page view for a page formatted as CSS or JavaScript.
To be called by Article::view() only.
This is hooked by SyntaxHighlight_GeSHi to do syntax highlighting of these page views.
bool | $showCacheHint | whether to show a message telling the user to clear the browser cache (default: true). |
Definition at line 806 of file Article.php.
If the revision requested for view is deleted, check permissions.
Send either an error message or a warning header to the output.
Definition at line 1234 of file Article.php.
Show a diff page according to current request variables.
For use within Article::view() only, other callers should use the DifferenceEngine class.
Definition at line 766 of file Article.php.
References getContext().
Show the error text for a missing article.
For articles in the MediaWiki namespace, show the default message text. To be called from Article::view().
Definition at line 1137 of file Article.php.
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].
For Article::view().
Definition at line 995 of file Article.php.
If patrol is possible, output a patrol UI box.
This is called from the footer section of ordinary page views. If patrol is not possible or not desired, does nothing. Side effect: When the patrol link is build, this method will call OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.
Definition at line 1028 of file Article.php.
If this request is a redirect view, send "redirected from" subtitle to the output.
Returns true if the header was needed, false if this is not a redirect view. Handles both local and remote redirects.
Definition at line 944 of file Article.php.
Show the footer section of an ordinary page view.
Definition at line 1006 of file Article.php.
Article::tryFileCache | ( | ) | [protected] |
checkLastModified returns true if it has taken care of all output to the client that is necessary for this request.
(that is, it has sent a cached version of the page)
Definition at line 1752 of file Article.php.
Article::updateRestrictions | ( | $ | limit = array() , |
$ | reason = '' , |
||
&$ | cascade = 0 , |
||
$ | expiry = array() |
||
) |
$limit | array |
$reason | string |
$cascade | int |
$expiry | array |
Definition at line 1980 of file Article.php.
Article::view | ( | ) |
This is the default action of the index.php entry point: just view the page of the given title.
Reimplemented in ImagePage, and CategoryPage.
Definition at line 495 of file Article.php.
Referenced by protect().
Article::viewRedirect | ( | $ | target, |
$ | appendSubtitle = true , |
||
$ | forceKnown = false |
||
) |
Return the HTML for the top of a redirect page.
Chances are you should just be using the ParserOutput from WikitextContent::getParserOutput instead of calling this for redirects.
$target | Title|Array of destination(s) to redirect |
$appendSubtitle | Boolean [optional] |
$forceKnown | Boolean: should the image be shown as a bluelink regardless of existence? |
Definition at line 1405 of file Article.php.
References $out, getContext(), getRedirectHeaderHtml(), getTitle(), and wfMessage().
string Article::$mContent |
Text of the revision we are working on $mContent.
Definition at line 59 of file Article.php.
bool Article::$mContentLoaded = false |
Is the content ($mContent) already loaded? $mContentLoaded.
Definition at line 70 of file Article.php.
Content Article::$mContentObject |
IContextSource Article::$mContext [protected] |
The context this Article is executed in $mContext.
{
Definition at line 44 of file Article.php.
int null Article::$mOldId |
The oldid of the article that is to be shown, 0 for the current revision $mOldId.
Definition at line 76 of file Article.php.
WikiPage Article::$mPage [protected] |
The WikiPage object of this instance $mPage.
Definition at line 49 of file Article.php.
ParserOptions Article::$mParserOptions |
ParserOptions object for $wgUser articles $mParserOptions.
Definition at line 54 of file Article.php.
ParserOutput Article::$mParserOutput |
ParserOutput object $mParserOutput.
Definition at line 101 of file Article.php.
Title Article::$mRedirectedFrom = null |
Title from which we were redirected here $mRedirectedFrom.
Definition at line 81 of file Article.php.
URL to redirect to or false if none $mRedirectUrl.
Definition at line 86 of file Article.php.
int Article::$mRevIdFetched = 0 |
Revision ID of revision we are working on $mRevIdFetched.
Definition at line 91 of file Article.php.
Revision Article::$mRevision = null |
Revision we are working on $mRevision.
Definition at line 96 of file Article.php.