MediaWiki REL1_33
ContextSource.php
Go to the documentation of this file.
1<?php
22
29abstract class ContextSource implements IContextSource {
33 private $context;
34
40 public function getContext() {
41 if ( $this->context === null ) {
42 $class = static::class;
43 wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
44 "Using RequestContext::getMain() for sanity\n" );
45 $this->context = RequestContext::getMain();
46 }
47
48 return $this->context;
49 }
50
55 public function setContext( IContextSource $context ) {
56 $this->context = $context;
57 }
58
63 public function getConfig() {
64 return $this->getContext()->getConfig();
65 }
66
71 public function getRequest() {
72 return $this->getContext()->getRequest();
73 }
74
79 public function getTitle() {
80 return $this->getContext()->getTitle();
81 }
82
91 public function canUseWikiPage() {
92 return $this->getContext()->canUseWikiPage();
93 }
94
104 public function getWikiPage() {
105 return $this->getContext()->getWikiPage();
106 }
107
112 public function getOutput() {
113 return $this->getContext()->getOutput();
114 }
115
120 public function getUser() {
121 return $this->getContext()->getUser();
122 }
123
128 public function getLanguage() {
129 return $this->getContext()->getLanguage();
130 }
131
136 public function getSkin() {
137 return $this->getContext()->getSkin();
138 }
139
144 public function getTiming() {
145 return $this->getContext()->getTiming();
146 }
147
154 public function getStats() {
155 return MediaWikiServices::getInstance()->getStatsdDataFactory();
156 }
157
168 public function msg( $key /* $args */ ) {
170
171 return $this->getContext()->msg( ...$args );
172 }
173
181 public function exportSession() {
182 return $this->getContext()->exportSession();
183 }
184}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
if( $line===false) $args
Definition cdb.php:64
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
exportSession()
Export the resolved user IP, HTTP headers, user ID, and session ID.
IContextSource $context
getWikiPage()
Get the WikiPage object.
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
MediaWikiServices is the service locator for the application scope of MediaWiki.
Interface for objects which can provide a MediaWiki context on request.