MediaWiki  1.32.5
DerivativeResourceLoaderContext.php
Go to the documentation of this file.
1 <?php
31  const INHERIT_VALUE = -1;
32 
36  private $context;
37 
48 
50  $this->context = $context;
51  }
52 
53  public function getModules() {
54  if ( $this->modules === self::INHERIT_VALUE ) {
55  return $this->context->getModules();
56  }
57  return $this->modules;
58  }
59 
63  public function setModules( array $modules ) {
64  $this->modules = $modules;
65  }
66 
67  public function getLanguage() {
68  if ( $this->language === self::INHERIT_VALUE ) {
69  return $this->context->getLanguage();
70  }
71  return $this->language;
72  }
73 
77  public function setLanguage( $language ) {
78  $this->language = $language;
79  // Invalidate direction since it is based on language
80  $this->direction = null;
81  $this->hash = null;
82  }
83 
84  public function getDirection() {
85  if ( $this->direction === self::INHERIT_VALUE ) {
86  return $this->context->getDirection();
87  }
88  if ( $this->direction === null ) {
89  $this->direction = Language::factory( $this->getLanguage() )->getDir();
90  }
91  return $this->direction;
92  }
93 
97  public function setDirection( $direction ) {
98  $this->direction = $direction;
99  $this->hash = null;
100  }
101 
102  public function getSkin() {
103  if ( $this->skin === self::INHERIT_VALUE ) {
104  return $this->context->getSkin();
105  }
106  return $this->skin;
107  }
108 
112  public function setSkin( $skin ) {
113  $this->skin = $skin;
114  $this->hash = null;
115  }
116 
117  public function getUser() {
118  if ( $this->user === self::INHERIT_VALUE ) {
119  return $this->context->getUser();
120  }
121  return $this->user;
122  }
123 
127  public function setUser( $user ) {
128  $this->user = $user;
129  $this->hash = null;
130  $this->userObj = null;
131  }
132 
133  public function getDebug() {
134  if ( $this->debug === self::INHERIT_VALUE ) {
135  return $this->context->getDebug();
136  }
137  return $this->debug;
138  }
139 
143  public function setDebug( $debug ) {
144  $this->debug = $debug;
145  $this->hash = null;
146  }
147 
148  public function getOnly() {
149  if ( $this->only === self::INHERIT_VALUE ) {
150  return $this->context->getOnly();
151  }
152  return $this->only;
153  }
154 
158  public function setOnly( $only ) {
159  $this->only = $only;
160  $this->hash = null;
161  }
162 
163  public function getVersion() {
164  if ( $this->version === self::INHERIT_VALUE ) {
165  return $this->context->getVersion();
166  }
167  return $this->version;
168  }
169 
173  public function setVersion( $version ) {
174  $this->version = $version;
175  $this->hash = null;
176  }
177 
178  public function getRaw() {
179  if ( $this->raw === self::INHERIT_VALUE ) {
180  return $this->context->getRaw();
181  }
182  return $this->raw;
183  }
184 
188  public function setRaw( $raw ) {
189  $this->raw = $raw;
190  }
191 
192  public function getRequest() {
193  return $this->context->getRequest();
194  }
195 
196  public function getResourceLoader() {
197  return $this->context->getResourceLoader();
198  }
199 
200  public function getContentOverrideCallback() {
201  if ( $this->contentOverrideCallback === self::INHERIT_VALUE ) {
202  return $this->context->getContentOverrideCallback();
203  }
205  }
206 
213  public function setContentOverrideCallback( $callback ) {
214  $this->contentOverrideCallback = $callback;
215  }
216 
217 }
ResourceLoaderContext
Object passed around to modules which contains information about the state of a specific loader reque...
Definition: ResourceLoaderContext.php:32
DerivativeResourceLoaderContext\$skin
$skin
Definition: DerivativeResourceLoaderContext.php:41
DerivativeResourceLoaderContext\getContentOverrideCallback
getContentOverrideCallback()
Return the replaced-content mapping callback.
Definition: DerivativeResourceLoaderContext.php:200
DerivativeResourceLoaderContext\setVersion
setVersion( $version)
Definition: DerivativeResourceLoaderContext.php:173
version
Prior to version
Definition: maintenance.txt:1
DerivativeResourceLoaderContext\getResourceLoader
getResourceLoader()
Definition: DerivativeResourceLoaderContext.php:196
DerivativeResourceLoaderContext\$raw
$raw
Definition: DerivativeResourceLoaderContext.php:46
DerivativeResourceLoaderContext\getRequest
getRequest()
Definition: DerivativeResourceLoaderContext.php:192
DerivativeResourceLoaderContext\$modules
$modules
Definition: DerivativeResourceLoaderContext.php:38
DerivativeResourceLoaderContext\$debug
$debug
Definition: DerivativeResourceLoaderContext.php:43
DerivativeResourceLoaderContext\setLanguage
setLanguage( $language)
Definition: DerivativeResourceLoaderContext.php:77
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
DerivativeResourceLoaderContext\$contentOverrideCallback
$contentOverrideCallback
Definition: DerivativeResourceLoaderContext.php:47
DerivativeResourceLoaderContext\setRaw
setRaw( $raw)
Definition: DerivativeResourceLoaderContext.php:188
DerivativeResourceLoaderContext\getModules
getModules()
Definition: DerivativeResourceLoaderContext.php:53
DerivativeResourceLoaderContext\getSkin
getSkin()
Definition: DerivativeResourceLoaderContext.php:102
DerivativeResourceLoaderContext\setContentOverrideCallback
setContentOverrideCallback( $callback)
Definition: DerivativeResourceLoaderContext.php:213
DerivativeResourceLoaderContext\setSkin
setSkin( $skin)
Definition: DerivativeResourceLoaderContext.php:112
user
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Definition: distributors.txt:9
DerivativeResourceLoaderContext\setModules
setModules(array $modules)
Definition: DerivativeResourceLoaderContext.php:63
DerivativeResourceLoaderContext\setDebug
setDebug( $debug)
Definition: DerivativeResourceLoaderContext.php:143
DerivativeResourceLoaderContext\$context
ResourceLoaderContext $context
Definition: DerivativeResourceLoaderContext.php:36
DerivativeResourceLoaderContext\getOnly
getOnly()
Definition: DerivativeResourceLoaderContext.php:148
DerivativeResourceLoaderContext\getRaw
getRaw()
Definition: DerivativeResourceLoaderContext.php:178
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
DerivativeResourceLoaderContext\$version
$version
Definition: DerivativeResourceLoaderContext.php:45
DerivativeResourceLoaderContext\$user
$user
Definition: DerivativeResourceLoaderContext.php:42
language
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 distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying
DerivativeResourceLoaderContext\setDirection
setDirection( $direction)
Definition: DerivativeResourceLoaderContext.php:97
DerivativeResourceLoaderContext
Allows changing specific properties of a context object, without changing the main one.
Definition: DerivativeResourceLoaderContext.php:30
DerivativeResourceLoaderContext\getDirection
getDirection()
Definition: DerivativeResourceLoaderContext.php:84
DerivativeResourceLoaderContext\$language
$language
Definition: DerivativeResourceLoaderContext.php:39
DerivativeResourceLoaderContext\INHERIT_VALUE
const INHERIT_VALUE
Definition: DerivativeResourceLoaderContext.php:31
DerivativeResourceLoaderContext\getLanguage
getLanguage()
Definition: DerivativeResourceLoaderContext.php:67
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:214
DerivativeResourceLoaderContext\getVersion
getVersion()
Definition: DerivativeResourceLoaderContext.php:163
DerivativeResourceLoaderContext\setUser
setUser( $user)
Definition: DerivativeResourceLoaderContext.php:127
DerivativeResourceLoaderContext\setOnly
setOnly( $only)
Definition: DerivativeResourceLoaderContext.php:158
DerivativeResourceLoaderContext\getUser
getUser()
Definition: DerivativeResourceLoaderContext.php:117
DerivativeResourceLoaderContext\__construct
__construct(ResourceLoaderContext $context)
Definition: DerivativeResourceLoaderContext.php:49
DerivativeResourceLoaderContext\$direction
$direction
Definition: DerivativeResourceLoaderContext.php:40
DerivativeResourceLoaderContext\$only
$only
Definition: DerivativeResourceLoaderContext.php:44
DerivativeResourceLoaderContext\getDebug
getDebug()
Definition: DerivativeResourceLoaderContext.php:133