MediaWiki  master
InfoAction Class Reference

Displays information about a page. More...

Inheritance diagram for InfoAction:
Collaboration diagram for InfoAction:

Public Member Functions

 __construct (Page $page, IContextSource $context, Language $contentLanguage, HookContainer $hookContainer, LanguageNameUtils $languageNameUtils, LinkBatchFactory $linkBatchFactory, LinkRenderer $linkRenderer, ILoadBalancer $loadBalancer, MagicWordFactory $magicWordFactory, NamespaceInfo $namespaceInfo, PageProps $pageProps, RepoGroup $repoGroup, RevisionLookup $revisionLookup, WANObjectCache $wanObjectCache, WatchedItemStoreInterface $watchedItemStore)
 
 getName ()
 Returns the name of the action this object responds to. More...
 
 onView ()
 Shows page information on GET request. More...
 
 requiresUnblock ()
 Whether this action can still be executed by a blocked user. More...
 
 requiresWrite ()
 Whether this action requires the wiki not to be locked. More...
 
- Public Member Functions inherited from FormlessAction
 show ()
 
- Public Member Functions inherited from Action
 __construct (Page $page, IContextSource $context=null)
 Only public since 1.21. More...
 
 addHelpLink ( $to, $overrideBaseUrl=false)
 Adds help link with an icon via page indicators. More...
 
 doesWrites ()
 Indicates whether this action may perform database writes. More...
 
 getArticle ()
 Get a Article object. More...
 
 getContext ()
 Get the IContextSource in use here. More...
 
 getLanguage ()
 Shortcut to get the user Language being used for this instance. More...
 
 getOutput ()
 Get the OutputPage being used for this instance. More...
 
 getRequest ()
 Get the WebRequest being used for this instance. More...
 
 getRestriction ()
 Get the permission required to perform this action. More...
 
 getSkin ()
 Shortcut to get the Skin being used for this instance. More...
 
 getTitle ()
 Shortcut to get the Title object from the page. More...
 
 getUser ()
 Shortcut to get the User being used for this instance. More...
 
 getWikiPage ()
 Get a WikiPage object. More...
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 

Static Public Member Functions

static invalidateCache (PageIdentity $page, $revid=null)
 Clear the info cache for a given Title. More...
 
- Static Public Member Functions inherited from Action
static exists (string $name)
 Check if a given action is recognised, even if it's disabled. More...
 
static factory (string $action, Article $article, IContextSource $context=null)
 Get an appropriate Action subclass for the given action. More...
 
static getActionName (IContextSource $context)
 Get the action that will be executed, not necessarily the one passed passed through the "action" request parameter. More...
 

Protected Member Functions

 addRow ( $table, $name, $value, $id)
 Adds a row to a table that will be added to the content. More...
 
 addTable ( $content, $table)
 Adds a table to the content that will be added to the output. More...
 
 getDescription ()
 Returns the description that goes below the "<h1>" tag. More...
 
 getNamespaceProtectionMessage (Title $title)
 Get namespace protection message for title or null if no namespace protection has been applied. More...
 
 getPageTitle ()
 Returns the name that goes in the "<h1>" page title. More...
 
 makeHeader ( $header, $canonicalId)
 Creates a header that can be added to the output. More...
 
 pageInfo ()
 Returns an array of info groups (will be rendered as tables), keyed by group ID. More...
 
- Protected Member Functions inherited from Action
 checkCanExecute (User $user)
 Checks if the given user (identified by an object) can perform this action. More...
 
 getHookContainer ()
 
 getHookRunner ()
 
 setHeaders ()
 Set output headers for noindexing etc. More...
 
 useTransactionalTimeLimit ()
 Call wfTransactionalTimeLimit() if this request was POSTed. More...
 

Static Protected Member Functions

static getCacheKey (WANObjectCache $cache, PageIdentity $page, $revId)
 

Private Member Functions

 pageCounts ()
 Returns page counts that would be too "expensive" to retrieve by normal means. More...
 

Private Attributes

Language $contentLanguage
 
HookRunner $hookRunner
 
LanguageNameUtils $languageNameUtils
 
LinkBatchFactory $linkBatchFactory
 
LinkRenderer $linkRenderer
 
ILoadBalancer $loadBalancer
 
MagicWordFactory $magicWordFactory
 
NamespaceInfo $namespaceInfo
 
PageProps $pageProps
 
RepoGroup $repoGroup
 
RevisionLookup $revisionLookup
 
WANObjectCache $wanObjectCache
 
WatchedItemStoreInterface $watchedItemStore
 
const VERSION = 1
 

Additional Inherited Members

- Protected Attributes inherited from Action
IContextSource $context
 IContextSource if specified; otherwise we'll use the Context from the Page. More...
 
array $fields
 The fields used to create the HTMLForm. More...
 
WikiPage Article ImagePage CategoryPage Page $page
 Page on which we're performing the action. More...
 

Detailed Description

Displays information about a page.

Definition at line 42 of file InfoAction.php.

Constructor & Destructor Documentation

◆ __construct()

InfoAction::__construct ( Page  $page,
IContextSource  $context,
Language  $contentLanguage,
HookContainer  $hookContainer,
LanguageNameUtils  $languageNameUtils,
LinkBatchFactory  $linkBatchFactory,
LinkRenderer  $linkRenderer,
ILoadBalancer  $loadBalancer,
MagicWordFactory  $magicWordFactory,
NamespaceInfo  $namespaceInfo,
PageProps  $pageProps,
RepoGroup  $repoGroup,
RevisionLookup  $revisionLookup,
WANObjectCache  $wanObjectCache,
WatchedItemStoreInterface  $watchedItemStore 
)
Parameters
Page$page
IContextSource$context
Language$contentLanguage
HookContainer$hookContainer
LanguageNameUtils$languageNameUtils
LinkBatchFactory$linkBatchFactory
LinkRenderer$linkRenderer
ILoadBalancer$loadBalancer
MagicWordFactory$magicWordFactory
NamespaceInfo$namespaceInfo
PageProps$pageProps
RepoGroup$repoGroup
RevisionLookup$revisionLookup
WANObjectCache$wanObjectCache
WatchedItemStoreInterface$watchedItemStore

Definition at line 101 of file InfoAction.php.

References $contentLanguage, Action\$context, $languageNameUtils, $linkBatchFactory, $linkRenderer, $loadBalancer, $magicWordFactory, $namespaceInfo, Action\$page, $pageProps, $repoGroup, $revisionLookup, $wanObjectCache, and $watchedItemStore.

Member Function Documentation

◆ addRow()

InfoAction::addRow (   $table,
  $name,
  $value,
  $id 
)
protected

Adds a row to a table that will be added to the content.

Parameters
string$tableThe table that will be added to the content
string$nameThe name of the row
string$valueThe value of the row
string | null$idThe ID to use for the 'tr' element
Returns
string The table with the row added

Definition at line 305 of file InfoAction.php.

References Html\rawElement().

Referenced by onView().

◆ addTable()

InfoAction::addTable (   $content,
  $table 
)
protected

Adds a table to the content that will be added to the output.

Parameters
string$contentThe content that will be added to the output
string$table
Returns
string The content with the table added

Definition at line 322 of file InfoAction.php.

References $content, and Html\rawElement().

Referenced by onView().

◆ getCacheKey()

static InfoAction::getCacheKey ( WANObjectCache  $cache,
PageIdentity  $page,
  $revId 
)
staticprotected
Parameters
WANObjectCache$cache
PageIdentity$page
int$revId
Returns
string

Definition at line 1091 of file InfoAction.php.

References $cache, and Action\$page.

Referenced by invalidateCache().

◆ getDescription()

InfoAction::getDescription ( )
protected

Returns the description that goes below the "<h1>" tag.

Returns
string

Reimplemented from Action.

Definition at line 1081 of file InfoAction.php.

◆ getName()

InfoAction::getName ( )

Returns the name of the action this object responds to.

Returns
string Lowercase name

Reimplemented from Action.

Definition at line 139 of file InfoAction.php.

◆ getNamespaceProtectionMessage()

InfoAction::getNamespaceProtectionMessage ( Title  $title)
protected

Get namespace protection message for title or null if no namespace protection has been applied.

Parameters
Title$title
Returns
?string HTML

Definition at line 875 of file InfoAction.php.

References $title, Action\getLanguage(), and Action\msg().

Referenced by pageInfo().

◆ getPageTitle()

InfoAction::getPageTitle ( )
protected

Returns the name that goes in the "<h1>" page title.

Returns
string

Reimplemented from Action.

Definition at line 1072 of file InfoAction.php.

References Action\getTitle(), and Action\msg().

◆ invalidateCache()

static InfoAction::invalidateCache ( PageIdentity  $page,
  $revid = null 
)
static

Clear the info cache for a given Title.

Since
1.22
Parameters
PageIdentity$pageTitle to clear cache for
int | null$revidRevision id to clear

Definition at line 168 of file InfoAction.php.

References $cache, Action\$page, and getCacheKey().

Referenced by WikiPage\doUpdateRestrictions(), WikiPage\onArticleDelete(), WikiPage\onArticleEdit(), and RefreshLinksJob\runForTitle().

◆ makeHeader()

InfoAction::makeHeader (   $header,
  $canonicalId 
)
protected

Creates a header that can be added to the output.

Parameters
string$headerThe header text.
string$canonicalId
Returns
string The HTML.

Definition at line 281 of file InfoAction.php.

References $header, Html\element(), Sanitizer\escapeIdForAttribute(), and Html\rawElement().

Referenced by onView().

◆ onView()

InfoAction::onView ( )

Shows page information on GET request.

Returns
string Page information that will be added to the output

Reimplemented from FormlessAction.

Definition at line 187 of file InfoAction.php.

References $content, $header, Action\addHelpLink(), addRow(), addTable(), Html\element(), Action\getArticle(), Action\getContext(), Action\getOutput(), makeHeader(), Action\msg(), and pageInfo().

◆ pageCounts()

◆ pageInfo()

InfoAction::pageInfo ( )
protected

Returns an array of info groups (will be rendered as tables), keyed by group ID.

Group IDs are arbitrary and used so that extensions may add additional information in arbitrary positions (and as message keys for section headers for the tables, prefixed with 'pageinfo-'). Each info group is a non-associative array of info items (rendered as table rows). Each info item is an array with two elements: the first describes the type of information, the second the value for the current page. Both can be strings (will be interpreted as raw HTML) or messages (will be interpreted as plain text and escaped).

Returns
array

Definition at line 343 of file InfoAction.php.

References $lang, $linkRenderer, $magicWords, $title, Html\element(), Action\exists(), Linker\formatHiddenCategories(), Action\getArticle(), getAuthority(), Action\getContext(), Action\getLanguage(), ContentHandler\getLocalizedName(), getNamespaceProtectionMessage(), Action\getTitle(), SpecialPage\getTitleFor(), SpecialPage\getTitleValueFor(), Action\getUser(), Action\getWikiPage(), MediaWiki\Linker\LinkRenderer\makeKnownLink(), MediaWiki\Linker\LinkRenderer\makeLink(), Action\msg(), User\newFromName(), Category\newFromTitle(), NS_CATEGORY, NS_FILE, NS_USER, NS_USER_TALK, pageCounts(), Html\rawElement(), and Linker\revUserTools().

Referenced by onView().

◆ requiresUnblock()

InfoAction::requiresUnblock ( )

Whether this action can still be executed by a blocked user.

Returns
bool

Reimplemented from Action.

Definition at line 148 of file InfoAction.php.

◆ requiresWrite()

InfoAction::requiresWrite ( )

Whether this action requires the wiki not to be locked.

Returns
bool

Reimplemented from Action.

Definition at line 157 of file InfoAction.php.

Member Data Documentation

◆ $contentLanguage

Language InfoAction::$contentLanguage
private

Definition at line 46 of file InfoAction.php.

Referenced by __construct().

◆ $hookRunner

HookRunner InfoAction::$hookRunner
private

Definition at line 49 of file InfoAction.php.

◆ $languageNameUtils

LanguageNameUtils InfoAction::$languageNameUtils
private

Definition at line 52 of file InfoAction.php.

Referenced by __construct().

◆ $linkBatchFactory

LinkBatchFactory InfoAction::$linkBatchFactory
private

Definition at line 55 of file InfoAction.php.

Referenced by __construct().

◆ $linkRenderer

LinkRenderer InfoAction::$linkRenderer
private

Definition at line 58 of file InfoAction.php.

Referenced by __construct(), and pageInfo().

◆ $loadBalancer

ILoadBalancer InfoAction::$loadBalancer
private

Definition at line 61 of file InfoAction.php.

Referenced by __construct().

◆ $magicWordFactory

MagicWordFactory InfoAction::$magicWordFactory
private

Definition at line 64 of file InfoAction.php.

Referenced by __construct().

◆ $namespaceInfo

NamespaceInfo InfoAction::$namespaceInfo
private

Definition at line 67 of file InfoAction.php.

Referenced by __construct().

◆ $pageProps

PageProps InfoAction::$pageProps
private

Definition at line 70 of file InfoAction.php.

Referenced by __construct().

◆ $repoGroup

RepoGroup InfoAction::$repoGroup
private

Definition at line 73 of file InfoAction.php.

Referenced by __construct().

◆ $revisionLookup

RevisionLookup InfoAction::$revisionLookup
private

Definition at line 76 of file InfoAction.php.

Referenced by __construct().

◆ $wanObjectCache

WANObjectCache InfoAction::$wanObjectCache
private

Definition at line 79 of file InfoAction.php.

Referenced by __construct(), and pageCounts().

◆ $watchedItemStore

WatchedItemStoreInterface InfoAction::$watchedItemStore
private

Definition at line 82 of file InfoAction.php.

Referenced by __construct(), and pageCounts().

◆ VERSION

const InfoAction::VERSION = 1
private

Definition at line 43 of file InfoAction.php.


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