MediaWiki  1.33.0
ProxySpecialPage.php
Go to the documentation of this file.
1 <?php
23 abstract class ProxySpecialPage extends SpecialPage {
27  private $target = null;
28 
37  abstract protected function getTargetPage();
38 
42  private function init() {
43  if ( $this->target === null ) {
44  $this->target = $this->getTargetPage();
45  }
46  }
47 
56  public function __call( $method, $args ) {
57  $this->init();
58  return call_user_func_array( [ $this->target, $method ], $args );
59  }
60 
64  public function getName() {
65  $this->init();
66  return $this->target->getName();
67  }
68 
73  public function getPageTitle( $subpage = false ) {
74  $this->init();
75  return $this->target->getPageTitle( $subpage );
76  }
77 
81  public function getLocalName() {
82  $this->init();
83  return $this->target->getLocalName();
84  }
85 
89  public function getRestriction() {
90  $this->init();
91  return $this->target->getRestriction();
92  }
93 
97  public function isListed() {
98  $this->init();
99  return $this->target->isListed();
100  }
101 
106  public function setListed( $listed ) {
107  $this->init();
108  return $this->target->setListed( $listed );
109  }
110 
115  public function listed( $x = null ) {
116  $this->init();
117  return $this->target->listed( $x );
118  }
119 
123  public function isIncludable() {
124  $this->init();
125  return $this->target->isIncludable();
126  }
127 
132  public function including( $x = null ) {
133  $this->init();
134  return $this->target->including( $x );
135  }
136 
140  public function isRestricted() {
141  $this->init();
142  return $this->target->isRestricted();
143  }
144 
149  public function userCanExecute( User $user ) {
150  $this->init();
151  return $this->target->userCanExecute( $user );
152  }
153 
157  public function displayRestrictionError() {
158  $this->init();
159  $this->target->displayRestrictionError();
160  }
161 
166  public function checkPermissions() {
167  $this->init();
168  $this->target->checkPermissions();
169  }
170 
174  protected function beforeExecute( $subPage ) {
175  $this->init();
176  $this->target->beforeExecute( $subPage );
177  }
178 
182  protected function afterExecute( $subPage ) {
183  $this->init();
184  $this->target->afterExecute( $subPage );
185  }
186 
190  public function execute( $subPage ) {
191  $this->init();
192  $this->target->execute( $subPage );
193  }
194 
198  public function getDescription() {
199  $this->init();
200  return $this->target->getDescription();
201  }
202 
206  public function setContext( $context ) {
207  $this->init();
208  $this->target->setContext( $context );
209  parent::setContext( $context );
210  }
211 
215  protected function getRobotPolicy() {
216  $this->init();
217  return $this->target->getRobotPolicy();
218  }
219 
223  protected function getGroupName() {
224  $this->init();
225  return $this->target->getGroupName();
226  }
227 }
$user
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1476
ProxySpecialPage\listed
listed( $x=null)
Definition: ProxySpecialPage.php:115
ProxySpecialPage\$target
SpecialPage null $target
Target page to execute.
Definition: ProxySpecialPage.php:27
$context
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition: hooks.txt:2636
ProxySpecialPage\including
including( $x=null)
Definition: ProxySpecialPage.php:132
ProxySpecialPage\displayRestrictionError
displayRestrictionError()
Definition: ProxySpecialPage.php:157
ProxySpecialPage\execute
execute( $subPage)
Definition: ProxySpecialPage.php:190
ProxySpecialPage\userCanExecute
userCanExecute(User $user)
Definition: ProxySpecialPage.php:149
ProxySpecialPage\__call
__call( $method, $args)
Magic function that proxies function calls to the target object.
Definition: ProxySpecialPage.php:56
ProxySpecialPage\getName
getName()
Definition: ProxySpecialPage.php:64
ProxySpecialPage\getTargetPage
getTargetPage()
Instantiate a SpecialPage based on request parameters.
ProxySpecialPage
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
Definition: ProxySpecialPage.php:23
ProxySpecialPage\checkPermissions
checkPermissions()
Definition: ProxySpecialPage.php:166
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
ProxySpecialPage\setListed
setListed( $listed)
Definition: ProxySpecialPage.php:106
ProxySpecialPage\getRestriction
getRestriction()
Definition: ProxySpecialPage.php:89
ProxySpecialPage\isListed
isListed()
Definition: ProxySpecialPage.php:97
ProxySpecialPage\isIncludable
isIncludable()
Definition: ProxySpecialPage.php:123
ProxySpecialPage\getDescription
getDescription()
Definition: ProxySpecialPage.php:198
ProxySpecialPage\getPageTitle
getPageTitle( $subpage=false)
Definition: ProxySpecialPage.php:73
ProxySpecialPage\beforeExecute
beforeExecute( $subPage)
Definition: ProxySpecialPage.php:174
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:36
ProxySpecialPage\isRestricted
isRestricted()
Definition: ProxySpecialPage.php:140
ProxySpecialPage\getLocalName
getLocalName()
Definition: ProxySpecialPage.php:81
ProxySpecialPage\getRobotPolicy
getRobotPolicy()
Definition: ProxySpecialPage.php:215
$args
if( $line===false) $args
Definition: cdb.php:64
ProxySpecialPage\setContext
setContext( $context)
Definition: ProxySpecialPage.php:206
ProxySpecialPage\afterExecute
afterExecute( $subPage)
Definition: ProxySpecialPage.php:182
ProxySpecialPage\getGroupName
getGroupName()
Definition: ProxySpecialPage.php:223
ProxySpecialPage\init
init()
Helper function that initializes the target SpecialPage object.
Definition: ProxySpecialPage.php:42
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:48