MediaWiki
master
|
Legacy class representing an editable page and handling UI for some page actions. More...
Public Member Functions | |
__construct (Title $title, $oldId=null) | |
__get ( $fname) | |
__set ( $fname, $fvalue) | |
addHelpLink ( $to, $overrideBaseUrl=false) | |
Adds help link with an icon via page indicators. More... | |
adjustDisplayTitle (ParserOutput $pOutput) | |
Adjust title for pages with displaytitle, -{T|}- or language conversion. More... | |
clear () | |
fetchRevisionRecord () | |
Fetches the revision to work on. More... | |
getActionOverrides () | |
Call to WikiPage function for backwards compatibility. More... | |
getContext () | |
Gets the context this Article is executed in. More... | |
getOldID () | |
getOldIDFromRequest () | |
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect. More... | |
getPage () | |
Get the WikiPage object of this instance. More... | |
getParserOptions () | |
Get parser options suitable for rendering the primary article wikitext. More... | |
getParserOutput ( $oldid=null, UserIdentity $user=null) | |
#- More... | |
getRedirectedFrom () | |
Get the page this view was redirected from. More... | |
getRevIdFetched () | |
Use this to fetch the rev ID used on page views. More... | |
getRobotPolicy ( $action, ParserOutput $pOutput=null) | |
Get the robot policy to be used for the current view. More... | |
getTimestamp () | |
getTitle () | |
Get the title object of the article. More... | |
isCurrent () | |
Returns true if the currently-referenced revision is the current edit to this page (and it exists). More... | |
isFileCacheable ( $mode=HTMLFileCache::MODE_NORMAL) | |
Check if the page can be cached. More... | |
protect () | |
action=protect handler More... | |
render () | |
Handle action=render. More... | |
setContext ( $context) | |
Sets the context this Article is executed in. More... | |
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 -\> More... | |
setRedirectedFrom (Title $from) | |
Tell the page view functions that this view was redirected from another page on the wiki. More... | |
showDeletedRevisionHeader () | |
If the revision requested for view is deleted, check permissions. More... | |
showMissingArticle () | |
Show the error text for a missing article. More... | |
showNamespaceHeader () | |
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]]. More... | |
showPatrolFooter () | |
If patrol is possible, output a patrol UI box. More... | |
showRedirectedFromHeader () | |
If this request is a redirect view, send "redirected from" subtitle to the output. More... | |
showViewFooter () | |
Show the footer section of an ordinary page view. More... | |
unprotect () | |
action=unprotect handler (alias) More... | |
view () | |
This is the default action of the index.php entry point: just view the page of the given title. More... | |
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(). More... | |
static | getRedirectHeaderHtml (Language $lang, Title $target, $forceKnown=false) |
Return the HTML for the top of a redirect page. More... | |
static | newFromID ( $id) |
Constructor from a page id. More... | |
static | newFromTitle ( $title, IContextSource $context) |
Create an Article object of the appropriate class for the given page. More... | |
static | newFromWikiPage (WikiPage $page, IContextSource $context) |
Create an Article object of the appropriate class for the given page. More... | |
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. More... | |
Public Attributes | |
int null | $mOldId |
The oldid of the article that was requested to be shown, 0 for the current revision. More... | |
ParserOutput null false | $mParserOutput = null |
The ParserOutput generated for viewing the page, initialized by view(). More... | |
Title null | $mRedirectedFrom = null |
Title from which we were redirected here, if any. More... | |
string false | $mRedirectUrl = false |
URL to redirect to or false if none. More... | |
Protected Member Functions | |
isDiffOnlyView () | |
newPage (Title $title) | |
showDiffPage () | |
Show a diff page according to current request variables. More... | |
tryFileCache () | |
checkLastModified returns true if it has taken care of all output to the client that is necessary for this request. More... | |
Protected Attributes | |
LinkRenderer | $linkRenderer |
IContextSource null | $mContext |
The context this Article is executed in. More... | |
WikiPage | $mPage |
The WikiPage object of this instance. More... | |
bool | $viewIsRenderAction = false |
Whether render() was called. More... | |
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 56 of file Article.php.
Article::__construct | ( | Title | $title, |
$oldId = null |
|||
) |
Title | $title | |
int | null | $oldId | Revision ID, null to fetch from request, zero for current |
Definition at line 143 of file Article.php.
References newPage().
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 1998 of file Article.php.
References wfDeprecatedMsg().
Article::__set | ( | $fname, | |
$fvalue | |||
) |
Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility
string | $fname | Field name |
mixed | $fvalue | New value |
Definition at line 2017 of file Article.php.
References wfDeprecatedMsg().
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 1834 of file Article.php.
References $title, getContext(), and getTitle().
Referenced by CategoryPage\closeShowCategory().
Article::adjustDisplayTitle | ( | ParserOutput | $pOutput | ) |
Adjust title for pages with displaytitle, -{T|}- or language conversion.
ParserOutput | $pOutput |
Definition at line 886 of file Article.php.
References getContext(), and ParserOutput\getTitleText().
Article::clear | ( | ) |
Definition at line 259 of file Article.php.
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 358 of file Article.php.
References $title, getTitle(), StatusValue\newFatal(), StatusValue\newGood(), 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 1058 of file Article.php.
Referenced by OutputPage\setRobotPolicy().
Article::getActionOverrides | ( | ) |
Call to WikiPage function for backwards compatibility.
Definition at line 2036 of file Article.php.
Referenced by MediaWiki\Actions\ActionFactory\getAction().
Article::getContext | ( | ) |
Gets the context this Article is executed in.
Definition at line 1979 of file Article.php.
Referenced by ImageHistoryList\__construct(), MediaWiki\EditPage\EditPage\__construct(), MediaWiki\Page\ProtectionForm\__construct(), CategoryPage\closeShowCategory(), ImagePage\doRenderLangOpt(), Action\factory(), ImagePage\getThumbPrevText(), ImagePage\getThumbSizes(), ImagePage\imageDupes(), ImagePage\imageHistory(), ImagePage\imageLinks(), ImagePage\makeMetadataTable(), ImagePage\openShowImage(), ImagePage\printSharedImageText(), ImagePage\showError(), ImagePage\showTOC(), ImagePage\uploadLinksBox(), CategoryPage\view(), and ImagePage\view().
Article::getOldID | ( | ) |
Definition at line 277 of file Article.php.
Article::getOldIDFromRequest | ( | ) |
Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect.
Definition at line 290 of file Article.php.
References getContext(), and getTitle().
Article::getPage | ( | ) |
Get the WikiPage object of this instance.
Definition at line 255 of file Article.php.
Referenced by ImageHistoryList\__construct(), MediaWiki\EditPage\EditPage\__construct(), CategoryPage\closeShowCategory(), ImagePage\imageDupes(), ImagePage\loadFile(), ImagePage\openShowImage(), ImagePage\printSharedImageText(), ImagePage\setFile(), CategoryPage\view(), and ImagePage\view().
Article::getParserOptions | ( | ) |
Get parser options suitable for rendering the primary article wikitext.
Definition at line 1957 of file Article.php.
References getContext(), and ParserOptions\setRenderReason().
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 1942 of file Article.php.
References ParserOptions\setRenderReason().
Article::getRedirectedFrom | ( | ) |
Get the page this view was redirected from.
Definition at line 227 of file Article.php.
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 1794 of file Article.php.
References $lang, MediaWiki\Title\Title\getFullText(), MediaWiki\Title\Title\isRedirect(), MediaWiki\Linker\LinkRenderer\makeKnownLink(), MediaWiki\Linker\LinkRenderer\makeLink(), and wfMessage().
Referenced by WikitextContentHandler\fillParserOutput().
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 435 of file Article.php.
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 974 of file Article.php.
References $title, getContext(), ParserOutput\getIndexPolicy(), getTitle(), NS_USER, and NS_USER_TALK.
Article::getTimestamp | ( | ) |
Definition at line 2045 of file Article.php.
References wfDeprecated().
Article::getTitle | ( | ) |
Get the title object of the article.
Definition at line 245 of file Article.php.
Referenced by ImageHistoryList\__construct(), MediaWiki\EditPage\EditPage\__construct(), MediaWiki\Page\ProtectionForm\__construct(), ImagePage\doRenderLangOpt(), ImagePage\imageDupes(), ImagePage\imageLinks(), ImagePage\loadFile(), ImagePage\openShowImage(), ImagePage\uploadLinksBox(), CategoryPage\view(), and ImagePage\view().
Article::isCurrent | ( | ) |
Returns true if the currently-referenced revision is the current edit to this page (and it exists).
Definition at line 416 of file Article.php.
|
protected |
Definition at line 960 of file Article.php.
References getContext().
Referenced by CategoryPage\view(), and ImagePage\view().
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 1914 of file Article.php.
References getContext(), getTitle(), and HTMLFileCache\useFileCache().
|
static |
Constructor from a page id.
int | $id | Article ID to load |
Definition at line 170 of file Article.php.
References $t.
|
static |
Create an Article object of the appropriate class for the given page.
Title | $title | |
IContextSource | $context |
Definition at line 182 of file Article.php.
References $title, and NS_FILE.
Referenced by RebuildFileCache\execute().
|
static |
Create an Article object of the appropriate class for the given page.
WikiPage | $page | |
IContextSource | $context |
Definition at line 216 of file Article.php.
References WikiPage\getTitle().
Referenced by ApiEditPage\execute().
|
protected |
Title | $title |
Reimplemented in ImagePage, and CategoryPage.
Definition at line 161 of file Article.php.
References $title.
Referenced by __construct().
Article::protect | ( | ) |
action=protect handler
Definition at line 1862 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 1368 of file Article.php.
Article::render | ( | ) |
Article::setContext | ( | $context | ) |
Sets the context this Article is executed in.
IContextSource | $context |
Definition at line 1969 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 1630 of file Article.php.
References OutputPage\addModuleStyles(), OutputPage\addSubtitle(), getContext(), ContextSource\getOutput(), and getTitle().
Article::setRedirectedFrom | ( | Title | $from | ) |
Tell the page view functions that this view was redirected from another page on the wiki.
Title | $from |
Definition at line 236 of file Article.php.
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 1570 of file Article.php.
References OutputPage\addHTML(), getContext(), MediaWiki\Rest\Handler\getRequest(), getTitle(), and ContextSource\msg().
|
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 901 of file Article.php.
References getContext(), and MediaWiki\Revision\RevisionRecord\getSlot().
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 1377 of file Article.php.
References $dbr, $lang, $title, OutputPage\addHTML(), OutputPage\addWikiTextAsContent(), OutputPage\addWikiTextAsInterface(), DB_REPLICA, getContext(), ContextSource\getOutput(), getTitle(), User\newFromName(), NS_MEDIAWIKI, NS_USER, NS_USER_TALK, Xml\openElement(), OutputPage\setFollowPolicy(), OutputPage\setIndexPolicy(), LogEventsList\showLogExtract(), wfEscapeWikiText(), and wfGetDB().
Article::showNamespaceHeader | ( | ) |
Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]].
For Article::view().
Definition at line 1158 of file Article.php.
References getContext(), and getTitle().
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 1194 of file Article.php.
References $dbr, $title, OutputPage\addHTML(), OutputPage\addModules(), OutputPage\addModuleStyles(), DB_REPLICA, getContext(), ContextSource\getOutput(), getTitle(), RecentChange\isInRCLifespan(), RecentChange\newFromConds(), NS_FILE, RC_LOG, RC_NEW, OutputPage\setPreventClickjacking(), and wfGetDB().
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 1085 of file Article.php.
References OutputPage\addJsConfigVars(), OutputPage\addModules(), OutputPage\addSubtitle(), getContext(), ContextSource\getOutput(), getTitle(), OutputPage\setCanonicalUrl(), and OutputPage\setRedirectedFrom().
Article::showViewFooter | ( | ) |
Show the footer section of an ordinary page view.
Definition at line 1170 of file Article.php.
References getContext(), 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 1883 of file Article.php.
References getContext(), getTitle(), and wfDebug().
Article::unprotect | ( | ) |
action=unprotect handler (alias)
Definition at line 1870 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 449 of file Article.php.
References Parser\formatPageTitle(), getContext(), getTitle(), true, wfDebug(), and wfMessage().
|
protected |
Definition at line 105 of file Article.php.
Referenced by ImagePage\imageDupes(), ImagePage\imageLinks(), and ImagePage\openShowImage().
|
protected |
The context this Article is executed in.
If null, RequestContext::getMain() is used.
Definition at line 65 of file Article.php.
int null Article::$mOldId |
The oldid of the article that was requested to be shown, 0 for the current revision.
Definition at line 74 of file Article.php.
|
protected |
The WikiPage object of this instance.
Definition at line 68 of file Article.php.
ParserOutput null false 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 93 of file Article.php.
Title null Article::$mRedirectedFrom = null |
Title from which we were redirected here, if any.
Definition at line 77 of file Article.php.
string false Article::$mRedirectUrl = false |
URL to redirect to or false if none.
Definition at line 80 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 100 of file Article.php.