MediaWiki  1.27.3
SpecialPageFactory.php
Go to the documentation of this file.
1 <?php
50  private static $coreList = [
51  // Maintenance Reports
52  'BrokenRedirects' => 'BrokenRedirectsPage',
53  'Deadendpages' => 'DeadendPagesPage',
54  'DoubleRedirects' => 'DoubleRedirectsPage',
55  'Longpages' => 'LongPagesPage',
56  'Ancientpages' => 'AncientPagesPage',
57  'Lonelypages' => 'LonelyPagesPage',
58  'Fewestrevisions' => 'FewestrevisionsPage',
59  'Withoutinterwiki' => 'WithoutInterwikiPage',
60  'Protectedpages' => 'SpecialProtectedpages',
61  'Protectedtitles' => 'SpecialProtectedtitles',
62  'Shortpages' => 'ShortPagesPage',
63  'Uncategorizedcategories' => 'UncategorizedCategoriesPage',
64  'Uncategorizedimages' => 'UncategorizedImagesPage',
65  'Uncategorizedpages' => 'UncategorizedPagesPage',
66  'Uncategorizedtemplates' => 'UncategorizedTemplatesPage',
67  'Unusedcategories' => 'UnusedCategoriesPage',
68  'Unusedimages' => 'UnusedimagesPage',
69  'Unusedtemplates' => 'UnusedtemplatesPage',
70  'Unwatchedpages' => 'UnwatchedpagesPage',
71  'Wantedcategories' => 'WantedCategoriesPage',
72  'Wantedfiles' => 'WantedFilesPage',
73  'Wantedpages' => 'WantedPagesPage',
74  'Wantedtemplates' => 'WantedTemplatesPage',
75 
76  // List of pages
77  'Allpages' => 'SpecialAllPages',
78  'Prefixindex' => 'SpecialPrefixindex',
79  'Categories' => 'SpecialCategories',
80  'Listredirects' => 'ListredirectsPage',
81  'PagesWithProp' => 'SpecialPagesWithProp',
82  'TrackingCategories' => 'SpecialTrackingCategories',
83 
84  // Authentication
85  'Userlogin' => 'SpecialUserLogin',
86  'Userlogout' => 'SpecialUserLogout',
87  'CreateAccount' => 'SpecialCreateAccount',
88  'LinkAccounts' => 'SpecialLinkAccounts',
89  'UnlinkAccounts' => 'SpecialUnlinkAccounts',
90  'ChangeCredentials' => 'SpecialChangeCredentials',
91  'RemoveCredentials' => 'SpecialRemoveCredentials',
92 
93  // Users and rights
94  'Block' => 'SpecialBlock',
95  'Unblock' => 'SpecialUnblock',
96  'BlockList' => 'SpecialBlockList',
97  'ChangePassword' => 'SpecialChangePassword',
98  'BotPasswords' => 'SpecialBotPasswords',
99  'PasswordReset' => 'SpecialPasswordReset',
100  'DeletedContributions' => 'DeletedContributionsPage',
101  'Preferences' => 'SpecialPreferences',
102  'ResetTokens' => 'SpecialResetTokens',
103  'Contributions' => 'SpecialContributions',
104  'Listgrouprights' => 'SpecialListGroupRights',
105  'Listgrants' => 'SpecialListGrants',
106  'Listusers' => 'SpecialListUsers',
107  'Listadmins' => 'SpecialListAdmins',
108  'Listbots' => 'SpecialListBots',
109  'Userrights' => 'UserrightsPage',
110  'EditWatchlist' => 'SpecialEditWatchlist',
111 
112  // Recent changes and logs
113  'Newimages' => 'SpecialNewFiles',
114  'Log' => 'SpecialLog',
115  'Watchlist' => 'SpecialWatchlist',
116  'Newpages' => 'SpecialNewpages',
117  'Recentchanges' => 'SpecialRecentChanges',
118  'Recentchangeslinked' => 'SpecialRecentChangesLinked',
119  'Tags' => 'SpecialTags',
120 
121  // Media reports and uploads
122  'Listfiles' => 'SpecialListFiles',
123  'Filepath' => 'SpecialFilepath',
124  'MediaStatistics' => 'MediaStatisticsPage',
125  'MIMEsearch' => 'MIMEsearchPage',
126  'FileDuplicateSearch' => 'FileDuplicateSearchPage',
127  'Upload' => 'SpecialUpload',
128  'UploadStash' => 'SpecialUploadStash',
129  'ListDuplicatedFiles' => 'ListDuplicatedFilesPage',
130 
131  // Data and tools
132  'ApiSandbox' => 'SpecialApiSandbox',
133  'Statistics' => 'SpecialStatistics',
134  'Allmessages' => 'SpecialAllMessages',
135  'Version' => 'SpecialVersion',
136  'Lockdb' => 'SpecialLockdb',
137  'Unlockdb' => 'SpecialUnlockdb',
138 
139  // Redirecting special pages
140  'LinkSearch' => 'LinkSearchPage',
141  'Randompage' => 'RandomPage',
142  'RandomInCategory' => 'SpecialRandomInCategory',
143  'Randomredirect' => 'SpecialRandomredirect',
144  'Randomrootpage' => 'SpecialRandomrootpage',
145  'GoToInterwiki' => 'SpecialGoToInterwiki',
146 
147  // High use pages
148  'Mostlinkedcategories' => 'MostlinkedCategoriesPage',
149  'Mostimages' => 'MostimagesPage',
150  'Mostinterwikis' => 'MostinterwikisPage',
151  'Mostlinked' => 'MostlinkedPage',
152  'Mostlinkedtemplates' => 'MostlinkedTemplatesPage',
153  'Mostcategories' => 'MostcategoriesPage',
154  'Mostrevisions' => 'MostrevisionsPage',
155 
156  // Page tools
157  'ComparePages' => 'SpecialComparePages',
158  'Export' => 'SpecialExport',
159  'Import' => 'SpecialImport',
160  'Undelete' => 'SpecialUndelete',
161  'Whatlinkshere' => 'SpecialWhatLinksHere',
162  'MergeHistory' => 'SpecialMergeHistory',
163  'ExpandTemplates' => 'SpecialExpandTemplates',
164 
165  // Other
166  'Booksources' => 'SpecialBookSources',
167 
168  // Unlisted / redirects
169  'ApiHelp' => 'SpecialApiHelp',
170  'Blankpage' => 'SpecialBlankpage',
171  'Diff' => 'SpecialDiff',
172  'EditTags' => 'SpecialEditTags',
173  'Emailuser' => 'SpecialEmailUser',
174  'Movepage' => 'MovePageForm',
175  'Mycontributions' => 'SpecialMycontributions',
176  'MyLanguage' => 'SpecialMyLanguage',
177  'Mypage' => 'SpecialMypage',
178  'Mytalk' => 'SpecialMytalk',
179  'Myuploads' => 'SpecialMyuploads',
180  'AllMyUploads' => 'SpecialAllMyUploads',
181  'PermanentLink' => 'SpecialPermanentLink',
182  'Redirect' => 'SpecialRedirect',
183  'Revisiondelete' => 'SpecialRevisionDelete',
184  'RunJobs' => 'SpecialRunJobs',
185  'Specialpages' => 'SpecialSpecialpages',
186  ];
187 
188  private static $list;
189  private static $aliases;
190  private static $pageObjectCache = [];
191 
196  public static function resetList() {
197  self::$list = null;
198  self::$aliases = null;
199  self::$pageObjectCache = [];
200  }
201 
208  public static function getNames() {
209  return array_keys( self::getPageList() );
210  }
211 
218  public static function getList() {
219  wfDeprecated( __FUNCTION__, '1.24' );
220  return self::getPageList();
221  }
222 
228  private static function getPageList() {
229  global $wgSpecialPages;
230  global $wgDisableInternalSearch, $wgEmailAuthentication;
231  global $wgEnableEmail, $wgEnableJavaScriptTest;
232  global $wgPageLanguageUseDB, $wgContentHandlerUseDB;
233 
234  if ( !is_array( self::$list ) ) {
235 
236  self::$list = self::$coreList;
237 
238  if ( !$wgDisableInternalSearch ) {
239  self::$list['Search'] = 'SpecialSearch';
240  }
241 
242  if ( $wgEmailAuthentication ) {
243  self::$list['Confirmemail'] = 'EmailConfirmation';
244  self::$list['Invalidateemail'] = 'EmailInvalidation';
245  }
246 
247  if ( $wgEnableEmail ) {
248  self::$list['ChangeEmail'] = 'SpecialChangeEmail';
249  }
250 
251  if ( $wgEnableJavaScriptTest ) {
252  self::$list['JavaScriptTest'] = 'SpecialJavaScriptTest';
253  }
254 
255  if ( $wgPageLanguageUseDB ) {
256  self::$list['PageLanguage'] = 'SpecialPageLanguage';
257  }
258  if ( $wgContentHandlerUseDB ) {
259  self::$list['ChangeContentModel'] = 'SpecialChangeContentModel';
260  }
261 
262  self::$list['Activeusers'] = 'SpecialActiveUsers';
263 
264  // Add extension special pages
265  self::$list = array_merge( self::$list, $wgSpecialPages );
266 
267  // This hook can be used to disable unwanted core special pages
268  // or conditionally register special pages.
269  Hooks::run( 'SpecialPage_initList', [ &self::$list ] );
270 
271  }
272 
273  return self::$list;
274  }
275 
282  private static function getAliasList() {
283  if ( is_null( self::$aliases ) ) {
285  $aliases = $wgContLang->getSpecialPageAliases();
286  $pageList = self::getPageList();
287 
288  self::$aliases = [];
289  $keepAlias = [];
290 
291  // Force every canonical name to be an alias for itself.
292  foreach ( $pageList as $name => $stuff ) {
293  $caseFoldedAlias = $wgContLang->caseFold( $name );
294  self::$aliases[$caseFoldedAlias] = $name;
295  $keepAlias[$caseFoldedAlias] = 'canonical';
296  }
297 
298  // Check for $aliases being an array since Language::getSpecialPageAliases can return null
299  if ( is_array( $aliases ) ) {
300  foreach ( $aliases as $realName => $aliasList ) {
301  $aliasList = array_values( $aliasList );
302  foreach ( $aliasList as $i => $alias ) {
303  $caseFoldedAlias = $wgContLang->caseFold( $alias );
304 
305  if ( isset( self::$aliases[$caseFoldedAlias] ) &&
306  $realName === self::$aliases[$caseFoldedAlias]
307  ) {
308  // Ignore same-realName conflicts
309  continue;
310  }
311 
312  if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
313  self::$aliases[$caseFoldedAlias] = $realName;
314  if ( !$i ) {
315  $keepAlias[$caseFoldedAlias] = 'first';
316  }
317  } elseif ( !$i ) {
318  wfWarn( "First alias '$alias' for $realName conflicts with " .
319  "{$keepAlias[$caseFoldedAlias]} alias for " .
320  self::$aliases[$caseFoldedAlias]
321  );
322  }
323  }
324  }
325  }
326  }
327 
328  return self::$aliases;
329  }
330 
339  public static function resolveAlias( $alias ) {
341  $bits = explode( '/', $alias, 2 );
342 
343  $caseFoldedAlias = $wgContLang->caseFold( $bits[0] );
344  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
345  $aliases = self::getAliasList();
346  if ( isset( $aliases[$caseFoldedAlias] ) ) {
347  $name = $aliases[$caseFoldedAlias];
348  } else {
349  return [ null, null ];
350  }
351 
352  if ( !isset( $bits[1] ) ) { // bug 2087
353  $par = null;
354  } else {
355  $par = $bits[1];
356  }
357 
358  return [ $name, $par ];
359  }
360 
367  public static function exists( $name ) {
368  list( $title, /*...*/ ) = self::resolveAlias( $name );
369 
370  $specialPageList = self::getPageList();
371  return isset( $specialPageList[$title] );
372  }
373 
380  public static function getPage( $name ) {
381  list( $realName, /*...*/ ) = self::resolveAlias( $name );
382 
383  if ( isset( self::$pageObjectCache[$realName] ) ) {
384  return self::$pageObjectCache[$realName];
385  }
386 
387  $specialPageList = self::getPageList();
388 
389  if ( isset( $specialPageList[$realName] ) ) {
390  $rec = $specialPageList[$realName];
391 
392  if ( is_callable( $rec ) ) {
393  // Use callback to instantiate the special page
394  $page = call_user_func( $rec );
395  } elseif ( is_string( $rec ) ) {
396  $className = $rec;
397  $page = new $className;
398  } elseif ( is_array( $rec ) ) {
399  $className = array_shift( $rec );
400  // @deprecated, officially since 1.18, unofficially since forever
401  wfDeprecated( "Array syntax for \$wgSpecialPages is deprecated ($className), " .
402  "define a subclass of SpecialPage instead.", '1.18' );
404  'class' => $className,
405  'args' => $rec,
406  'closure_expansion' => false,
407  ] );
408  } elseif ( $rec instanceof SpecialPage ) {
409  $page = $rec; // XXX: we should deep clone here
410  } else {
411  $page = null;
412  }
413 
414  self::$pageObjectCache[$realName] = $page;
415  if ( $page instanceof SpecialPage ) {
416  return $page;
417  } else {
418  // It's not a classname, nor a callback, nor a legacy constructor array,
419  // nor a special page object. Give up.
420  wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
421  return null;
422  }
423 
424  } else {
425  return null;
426  }
427  }
428 
437  public static function getUsablePages( User $user = null ) {
438  $pages = [];
439  if ( $user === null ) {
440  global $wgUser;
441  $user = $wgUser;
442  }
443  foreach ( self::getPageList() as $name => $rec ) {
444  $page = self::getPage( $name );
445  if ( $page ) { // not null
446  $page->setContext( RequestContext::getMain() );
447  if ( $page->isListed()
448  && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
449  ) {
450  $pages[$name] = $page;
451  }
452  }
453  }
454 
455  return $pages;
456  }
457 
463  public static function getRegularPages() {
464  $pages = [];
465  foreach ( self::getPageList() as $name => $rec ) {
466  $page = self::getPage( $name );
467  if ( $page->isListed() && !$page->isRestricted() ) {
468  $pages[$name] = $page;
469  }
470  }
471 
472  return $pages;
473  }
474 
482  public static function getRestrictedPages( User $user = null ) {
483  $pages = [];
484  if ( $user === null ) {
485  global $wgUser;
486  $user = $wgUser;
487  }
488  foreach ( self::getPageList() as $name => $rec ) {
489  $page = self::getPage( $name );
490  if (
491  $page->isListed()
492  && $page->isRestricted()
493  && $page->userCanExecute( $user )
494  ) {
495  $pages[$name] = $page;
496  }
497  }
498 
499  return $pages;
500  }
501 
516  public static function executePath( Title &$title, IContextSource &$context, $including = false ) {
517  // @todo FIXME: Redirects broken due to this call
518  $bits = explode( '/', $title->getDBkey(), 2 );
519  $name = $bits[0];
520  if ( !isset( $bits[1] ) ) { // bug 2087
521  $par = null;
522  } else {
523  $par = $bits[1];
524  }
525 
526  $page = self::getPage( $name );
527  if ( !$page ) {
528  $context->getOutput()->setArticleRelated( false );
529  $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
530 
532  if ( $wgSend404Code ) {
533  $context->getOutput()->setStatusCode( 404 );
534  }
535 
536  $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
537 
538  return false;
539  }
540 
541  if ( !$including ) {
542  // Narrow DB query expectations for this HTTP request
543  $trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
544  $trxProfiler = Profiler::instance()->getTransactionProfiler();
545  if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
546  $trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
547  }
548  }
549 
550  // Page exists, set the context
551  $page->setContext( $context );
552 
553  if ( !$including ) {
554  // Redirect to canonical alias for GET commands
555  // Not for POST, we'd lose the post data, so it's best to just distribute
556  // the request. Such POST requests are possible for old extensions that
557  // generate self-links without being aware that their default name has
558  // changed.
559  if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
560  $query = $context->getRequest()->getQueryValues();
561  unset( $query['title'] );
562  $title = $page->getPageTitle( $par );
563  $url = $title->getFullURL( $query );
564  $context->getOutput()->redirect( $url );
565 
566  return $title;
567  } else {
568  $context->setTitle( $page->getPageTitle( $par ) );
569  }
570  } elseif ( !$page->isIncludable() ) {
571  return false;
572  }
573 
574  $page->including( $including );
575 
576  // Execute special page
577  $page->run( $par );
578 
579  return true;
580  }
581 
596  public static function capturePath( Title $title, IContextSource $context ) {
598  $main = RequestContext::getMain();
599 
600  // Save current globals and main context
601  $glob = [
602  'title' => $wgTitle,
603  'output' => $wgOut,
604  'request' => $wgRequest,
605  'user' => $wgUser,
606  'language' => $wgLang,
607  ];
608  $ctx = [
609  'title' => $main->getTitle(),
610  'output' => $main->getOutput(),
611  'request' => $main->getRequest(),
612  'user' => $main->getUser(),
613  'language' => $main->getLanguage(),
614  ];
615 
616  // Override
617  $wgTitle = $title;
618  $wgOut = $context->getOutput();
619  $wgRequest = $context->getRequest();
620  $wgUser = $context->getUser();
621  $wgLang = $context->getLanguage();
622  $main->setTitle( $title );
623  $main->setOutput( $context->getOutput() );
624  $main->setRequest( $context->getRequest() );
625  $main->setUser( $context->getUser() );
626  $main->setLanguage( $context->getLanguage() );
627 
628  // The useful part
629  $ret = self::executePath( $title, $context, true );
630 
631  // Restore old globals and context
632  $wgTitle = $glob['title'];
633  $wgOut = $glob['output'];
634  $wgRequest = $glob['request'];
635  $wgUser = $glob['user'];
636  $wgLang = $glob['language'];
637  $main->setTitle( $ctx['title'] );
638  $main->setOutput( $ctx['output'] );
639  $main->setRequest( $ctx['request'] );
640  $main->setUser( $ctx['user'] );
641  $main->setLanguage( $ctx['language'] );
642 
643  return $ret;
644  }
645 
653  public static function getLocalNameFor( $name, $subpage = false ) {
655  $aliases = $wgContLang->getSpecialPageAliases();
656  $aliasList = self::getAliasList();
657 
658  // Find the first alias that maps back to $name
659  if ( isset( $aliases[$name] ) ) {
660  $found = false;
661  foreach ( $aliases[$name] as $alias ) {
662  $caseFoldedAlias = $wgContLang->caseFold( $alias );
663  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
664  if ( isset( $aliasList[$caseFoldedAlias] ) &&
665  $aliasList[$caseFoldedAlias] === $name
666  ) {
667  $name = $alias;
668  $found = true;
669  break;
670  }
671  }
672  if ( !$found ) {
673  wfWarn( "Did not find a usable alias for special page '$name'. " .
674  "It seems all defined aliases conflict?" );
675  }
676  } else {
677  // Check if someone misspelled the correct casing
678  if ( is_array( $aliases ) ) {
679  foreach ( $aliases as $n => $values ) {
680  if ( strcasecmp( $name, $n ) === 0 ) {
681  wfWarn( "Found alias defined for $n when searching for " .
682  "special page aliases for $name. Case mismatch?" );
683  return self::getLocalNameFor( $n, $subpage );
684  }
685  }
686  }
687 
688  wfWarn( "Did not find alias for special page '$name'. " .
689  "Perhaps no aliases are defined for it?" );
690  }
691 
692  if ( $subpage !== false && !is_null( $subpage ) ) {
693  $name = "$name/$subpage";
694  }
695 
696  return $wgContLang->ucfirst( $name );
697  }
698 
705  public static function getTitleForAlias( $alias ) {
706  list( $name, $subpage ) = self::resolveAlias( $alias );
707  if ( $name != null ) {
708  return SpecialPage::getTitleFor( $name, $subpage );
709  } else {
710  return null;
711  }
712  }
713 }
static getTitleForAlias($alias)
Get a title for a given alias.
Interface for objects which can provide a MediaWiki context on request.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
static getLocalNameFor($name, $subpage=false)
Get the local name for a specified canonical name.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1422
static getObjectFromSpec($spec)
Instantiate an object based on a specification array.
$context
Definition: load.php:44
static getRegularPages()
Return categorised listable special pages for all users.
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:75
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition: hooks.txt:1802
static instance()
Singleton.
Definition: Profiler.php:60
static $coreList
List of special page names to the subclass of SpecialPage which handles them.
static getList()
Get the special page list as an array.
Represents a title within MediaWiki.
Definition: Title.php:34
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
static executePath(Title &$title, IContextSource &$context, $including=false)
Execute a special page path.
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
Definition: design.txt:56
getUser()
Get the User object.
static getPage($name)
Find the object with a given name and return it (or NULL)
static capturePath(Title $title, IContextSource $context)
Just like executePath() but will override global variables and execute the page in "inclusion" mode...
Parent class for all special pages.
Definition: SpecialPage.php:36
getConfig()
Get the site configuration.
static getMain()
Static methods.
Factory for handling the special page list and generating SpecialPage objects.
getDBkey()
Get the main part with underscores.
Definition: Title.php:911
wfWarn($msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
static getAliasList()
Initialise and return the list of special page aliases.
static getNames()
Returns a list of canonical special page names.
static getRestrictedPages(User $user=null)
Return categorised listable special pages which are available for the current user, but not for everyone.
wfDeprecated($function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static resetList()
Reset the internal list of special pages.
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:916
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
getLanguage()
Get the Language object.
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 as
Definition: distributors.txt:9
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:246
static getUsablePages(User $user=null)
Return categorised listable special pages which are available for the current user, and everyone.
$wgEmailAuthentication
Require email authentication before sending mail to an email address.
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
static resolveAlias($alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
static exists($name)
Check if a given name exist as a special page or as a special page alias.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition: design.txt:56
getOutput()
Get the OutputPage object.
$wgOut
Definition: Setup.php:804
wfLogWarning($msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
if(!$wgRequest->checkUrlExtension()) if(!$wgEnableAPI) $wgTitle
Definition: api.php:57
static getPageList()
Get the special page list as an array.
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code, mangling or hiding MediaWiki's output.
getRequest()
Get the WebRequest object.
if(is_null($wgLocalTZoffset)) if(!$wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:657
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
Definition: hooks.txt:2342
getFullURL($query= '', $query2=false, $proto=PROTO_RELATIVE)
Get a real URL referring to this title, with interwiki link and fragment.
Definition: Title.php:1666
$wgUser
Definition: Setup.php:794
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:314