MediaWiki master
|
Legacy class representing an editable page and handling UI for some page actions. More...
Inherits MediaWiki\Page\Page.
Inherited by MediaWiki\Page\CategoryPage, and MediaWiki\Page\ImagePage.
Public Member Functions | |
__construct (Title $title, $oldId=null) | |
addHelpLink ( $to, $overrideBaseUrl=false) | |
Adds help link with an icon via page indicators. | |
adjustDisplayTitle (ParserOutput $pOutput) | |
Adjust title for pages with displaytitle, -{T|}- or language conversion. | |
clear () | |
fetchRevisionRecord () | |
Fetches the revision to work on. | |
getActionOverrides () | |
Call to WikiPage function for backwards compatibility. | |
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, ?UserIdentity $user=null) | |
Lightweight method to get the parser output for a page, checking the parser cache and so on. | |
getRedirectedFrom () | |
Get the page this view was redirected from. | |
getRevIdFetched () | |
Use this to fetch the rev ID used on page views. | |
getRobotPolicy ( $action, ?ParserOutput $pOutput=null) | |
Get the robot policy to be used for the current view. | |
getTitle () | |
Get the title object of the article. | |
isCurrent () | |
Returns true if the currently-referenced revision is the current edit to this page (and it exists). | |
isFileCacheable ( $mode=HTMLFileCache::MODE_NORMAL) | |
Check if the page can be cached. | |
protect () | |
action=protect handler | |
render () | |
Handle action=render. | |
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 -\> | |
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. | |
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. | |
showProtectionIndicator () | |
Show a lock icon above the article body if the page is protected. | |
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) | |
view () | |
This is the default action of the index.php entry point: just view the page of the given title. | |
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 | getRedirectHeaderHtml (Language $lang, Title $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 | purgePatrolFooterCache ( $articleID) |
Purge the cache used to check if it is worth showing the patrol footer For example, it is done during re-uploads when file patrol is used. | |
Public Attributes | |
int null | $mOldId |
The oldid of the article that was requested to be shown, 0 for the current revision. | |
ParserOutput null false | $mParserOutput = null |
The ParserOutput generated for viewing the page, initialized by view(). | |
Title null | $mRedirectedFrom = null |
Title from which we were redirected here, if any. | |
string false | $mRedirectUrl = false |
URL to redirect to or false if none. | |
Protected Member Functions | |
isDiffOnlyView () | |
newPage (Title $title) | |
showDiffPage () | |
Show a diff page according to current request variables. | |
tryFileCache () | |
checkLastModified returns true if it has taken care of all output to the client that is necessary for this request. | |
Protected Attributes | |
DatabaseBlockStore | $blockStore |
IConnectionProvider | $dbProvider |
LinkRenderer | $linkRenderer |
IContextSource null | $mContext |
The context this Article is executed in. | |
WikiPage | $mPage |
The WikiPage object of this instance. | |
RestrictionStore | $restrictionStore |
bool | $viewIsRenderAction = false |
Whether render() was called. | |
Legacy class representing an editable page and handling UI for some page actions.
This has largely been superseded by WikiPage, with Action subclasses for the user interface of page actions, and service classes for their backend logic.
Move and refactor remaining code
Deprecate
Definition at line 76 of file Article.php.
MediaWiki\Page\Article::__construct | ( | Title | $title, |
$oldId = null ) |
Title | $title | |
int | null | $oldId | Revision ID, null to fetch from request, zero for current |
Definition at line 147 of file Article.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Page\Article\newPage().
MediaWiki\Page\Article::addHelpLink | ( | $to, | |
$overrideBaseUrl = false ) |
Adds help link with an icon via page indicators.
Link target can be overridden by a local message containing a wikilink: the message key is: 'namespace-' + namespace number + '-helppage'.
string | $to | Target MediaWiki.org page title or encoded URL. |
bool | $overrideBaseUrl | Whether $url is a full URL, to avoid MW.o. |
Definition at line 1924 of file Article.php.
References getTitle().
Referenced by MediaWiki\Page\CategoryPage\closeShowCategory().
MediaWiki\Page\Article::adjustDisplayTitle | ( | ParserOutput | $pOutput | ) |
Adjust title for pages with displaytitle, -{T|}- or language conversion.
Definition at line 1001 of file Article.php.
References MediaWiki\Parser\ParserOutput\getTitleText().
MediaWiki\Page\Article::clear | ( | ) |
Definition at line 266 of file Article.php.
MediaWiki\Page\Article::fetchRevisionRecord | ( | ) |
Fetches the revision to work on.
The revision is loaded from the database. Refer to $this->fetchResult for the revision or any errors encountered while loading it.
Public since 1.35
Definition at line 365 of file Article.php.
References StatusValue\fatal(), getTitle(), and wfDebug().
|
static |
Converts a String robot policy into an associative array, to allow merging of several policies using array_merge().
array | string | $policy | Returns empty array on null/false/'', transparent to already-converted arrays, converts string. |
Definition at line 1190 of file Article.php.
MediaWiki\Page\Article::getActionOverrides | ( | ) |
Call to WikiPage function for backwards compatibility.
Definition at line 2082 of file Article.php.
MediaWiki\Page\Article::getContext | ( | ) |
Gets the context this Article is executed in.
Definition at line 2067 of file Article.php.
Referenced by MediaWiki\Page\ImageHistoryList\__construct(), MediaWiki\EditPage\EditPage\__construct(), MediaWiki\Page\ProtectionForm\__construct(), MediaWiki\Page\CategoryPage\closeShowCategory(), MediaWiki\Page\ImagePage\doRenderLangOpt(), MediaWiki\Actions\Action\factory(), MediaWiki\Page\ImagePage\getThumbPrevText(), MediaWiki\Page\ImagePage\getThumbSizes(), MediaWiki\Page\ImagePage\imageDupes(), MediaWiki\Page\ImagePage\imageHistory(), MediaWiki\Page\ImagePage\imageLinks(), MediaWiki\Page\ImagePage\makeMetadataTable(), MediaWiki\Page\ImagePage\openShowImage(), MediaWiki\Page\ImagePage\printSharedImageText(), MediaWiki\Page\ImagePage\showError(), MediaWiki\Page\ImagePage\showTOC(), MediaWiki\Page\ImagePage\uploadLinksBox(), MediaWiki\Page\CategoryPage\view(), and MediaWiki\Page\ImagePage\view().
MediaWiki\Page\Article::getOldID | ( | ) |
Definition at line 284 of file Article.php.
MediaWiki\Page\Article::getOldIDFromRequest | ( | ) |
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.
Definition at line 297 of file Article.php.
References getTitle().
MediaWiki\Page\Article::getPage | ( | ) |
Get the WikiPage object of this instance.
Definition at line 262 of file Article.php.
Referenced by MediaWiki\Page\ImageHistoryList\__construct(), MediaWiki\EditPage\EditPage\__construct(), MediaWiki\Page\CategoryPage\closeShowCategory(), MediaWiki\Page\ImagePage\imageDupes(), MediaWiki\Page\ImagePage\loadFile(), MediaWiki\Page\ImagePage\openShowImage(), MediaWiki\Page\ImagePage\printSharedImageText(), MediaWiki\Page\ImagePage\setFile(), MediaWiki\Page\CategoryPage\view(), and MediaWiki\Page\ImagePage\view().
MediaWiki\Page\Article::getParserOptions | ( | ) |
Get parser options suitable for rendering the primary article wikitext.
Definition at line 2045 of file Article.php.
MediaWiki\Page\Article::getParserOutput | ( | $oldid = null, | |
?UserIdentity | $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 Article::view() is forced to consider, so it's not appropriate to use there.
int | null | $oldid | Revision ID or null |
UserIdentity | null | $user | The relevant user |
Definition at line 2030 of file Article.php.
MediaWiki\Page\Article::getRedirectedFrom | ( | ) |
Get the page this view was redirected from.
Definition at line 235 of file Article.php.
|
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 | $target | Destination to redirect |
bool | $forceKnown | Should the image be shown as a bluelink regardless of existence? |
Definition at line 1910 of file Article.php.
References MediaWiki\Linker\LinkRenderer\makeRedirectHeader(), and wfDeprecated().
MediaWiki\Page\Article::getRevIdFetched | ( | ) |
Use this to fetch the rev ID used on page views.
Before fetchRevisionRecord was called, this returns the page's latest revision, regardless of what getOldID() returns.
Definition at line 442 of file Article.php.
MediaWiki\Page\Article::getRobotPolicy | ( | $action, | |
?ParserOutput | $pOutput = null ) |
Get the robot policy to be used for the current view.
string | $action | The action= GET parameter |
ParserOutput | null | $pOutput |
Definition at line 1104 of file Article.php.
References getTitle(), NS_USER, and NS_USER_TALK.
MediaWiki\Page\Article::getTitle | ( | ) |
Get the title object of the article.
Definition at line 252 of file Article.php.
Referenced by MediaWiki\Page\ImageHistoryList\__construct(), MediaWiki\EditPage\EditPage\__construct(), MediaWiki\Page\ProtectionForm\__construct(), MediaWiki\Page\ImagePage\doRenderLangOpt(), MediaWiki\Page\ImagePage\imageDupes(), MediaWiki\Page\ImagePage\imageLinks(), MediaWiki\Page\ImagePage\loadFile(), MediaWiki\Page\ImagePage\openShowImage(), MediaWiki\Page\ImagePage\uploadLinksBox(), MediaWiki\Page\CategoryPage\view(), and MediaWiki\Page\ImagePage\view().
MediaWiki\Page\Article::isCurrent | ( | ) |
Returns true if the currently-referenced revision is the current edit to this page (and it exists).
Definition at line 423 of file Article.php.
|
protected |
Definition at line 1090 of file Article.php.
Referenced by MediaWiki\Page\CategoryPage\view(), and MediaWiki\Page\ImagePage\view().
MediaWiki\Page\Article::isFileCacheable | ( | $mode = HTMLFileCache::MODE_NORMAL | ) |
Check if the page can be cached.
int | $mode | One of the HTMLFileCache::MODE_* constants (since 1.28) |
Definition at line 2004 of file Article.php.
References getTitle().
|
static |
Constructor from a page id.
int | $id | Article ID to load |
Definition at line 178 of file Article.php.
|
static |
Create an Article object of the appropriate class for the given page.
Title | $title | |
IContextSource | $context |
Definition at line 190 of file Article.php.
References NS_FILE.
|
static |
Create an Article object of the appropriate class for the given page.
WikiPage | $page | |
IContextSource | $context |
Definition at line 224 of file Article.php.
References MediaWiki\Page\WikiPage\getTitle().
|
protected |
Title | $title |
Reimplemented in MediaWiki\Page\CategoryPage, and MediaWiki\Page\ImagePage.
Definition at line 169 of file Article.php.
Referenced by MediaWiki\Page\Article\__construct().
MediaWiki\Page\Article::protect | ( | ) |
action=protect handler
Definition at line 1952 of file Article.php.
|
static |
Purge the cache used to check if it is worth showing the patrol footer For example, it is done during re-uploads when file patrol is used.
int | $articleID | ID of the article to purge |
Definition at line 1504 of file Article.php.
MediaWiki\Page\Article::render | ( | ) |
Handle action=render.
Definition at line 1941 of file Article.php.
MediaWiki\Page\Article::setContext | ( | $context | ) |
Sets the context this Article is executed in.
IContextSource | $context |
Definition at line 2057 of file Article.php.
MediaWiki\Page\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 1744 of file Article.php.
References MediaWiki\Output\OutputPage\addModuleStyles(), MediaWiki\Output\OutputPage\addSubtitle(), MediaWiki\Context\ContextSource\getOutput(), and getTitle().
MediaWiki\Page\Article::setRedirectedFrom | ( | Title | $from | ) |
Tell the page view functions that this view was redirected from another page on the wiki.
Definition at line 243 of file Article.php.
MediaWiki\Page\Article::showDeletedRevisionHeader | ( | ) |
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 1677 of file Article.php.
References getTitle().
|
protected |
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 1016 of file Article.php.
MediaWiki\Page\Article::showMissingArticle | ( | ) |
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 1513 of file Article.php.
References getTitle(), NS_MEDIAWIKI, NS_USER, NS_USER_TALK, and wfEscapeWikiText().
MediaWiki\Page\Article::showNamespaceHeader | ( | ) |
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].
For Article::view().
Definition at line 1290 of file Article.php.
References getTitle().
MediaWiki\Page\Article::showPatrolFooter | ( | ) |
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::setPreventClickjacking(true) and load a JS module.
Definition at line 1326 of file Article.php.
References getTitle(), NS_FILE, RC_LOG, RC_NEW, and SCHEMA_COMPAT_READ_OLD.
MediaWiki\Page\Article::showProtectionIndicator | ( | ) |
Show a lock icon above the article body if the page is protected.
Definition at line 603 of file Article.php.
MediaWiki\Page\Article::showRedirectedFromHeader | ( | ) |
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 1217 of file Article.php.
References getTitle().
MediaWiki\Page\Article::showViewFooter | ( | ) |
Show the footer section of an ordinary page view.
Definition at line 1302 of file Article.php.
References getTitle(), and NS_USER_TALK.
|
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 1973 of file Article.php.
References getTitle(), and wfDebug().
MediaWiki\Page\Article::unprotect | ( | ) |
action=unprotect handler (alias)
Definition at line 1960 of file Article.php.
MediaWiki\Page\Article::view | ( | ) |
This is the default action of the index.php entry point: just view the page of the given title.
Reimplemented in MediaWiki\Page\CategoryPage, and MediaWiki\Page\ImagePage.
Definition at line 456 of file Article.php.
References MediaWiki\MainConfigNames\EnableEditRecovery, MediaWiki\MediaWikiServices\getInstance(), getTitle(), MediaWiki\MainConfigNames\UseFileCache, wfDebug(), and wfMessage().
|
protected |
Definition at line 131 of file Article.php.
|
protected |
Definition at line 130 of file Article.php.
|
protected |
Definition at line 122 of file Article.php.
|
protected |
The context this Article is executed in.
If null, RequestContext::getMain() is used.
getContext
Definition at line 85 of file Article.php.
int null MediaWiki\Page\Article::$mOldId |
The oldid of the article that was requested to be shown, 0 for the current revision.
Definition at line 94 of file Article.php.
|
protected |
The WikiPage object of this instance.
Definition at line 88 of file Article.php.
ParserOutput null false MediaWiki\Page\Article::$mParserOutput = null |
The ParserOutput generated for viewing the page, initialized by view().
If no ParserOutput could be generated, this is set to false.
Definition at line 113 of file Article.php.
Title null MediaWiki\Page\Article::$mRedirectedFrom = null |
Title from which we were redirected here, if any.
Definition at line 97 of file Article.php.
string false MediaWiki\Page\Article::$mRedirectUrl = false |
URL to redirect to or false if none.
Definition at line 100 of file Article.php.
|
protected |
Definition at line 133 of file Article.php.
|
protected |
Whether render() was called.
With the way subclasses work here, there doesn't seem to be any other way to stop calling OutputPage::enableSectionEditLinks() and still have it work as it did before.
Definition at line 120 of file Article.php.