MediaWiki  1.27.1
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 
146  // High use pages
147  'Mostlinkedcategories' => 'MostlinkedCategoriesPage',
148  'Mostimages' => 'MostimagesPage',
149  'Mostinterwikis' => 'MostinterwikisPage',
150  'Mostlinked' => 'MostlinkedPage',
151  'Mostlinkedtemplates' => 'MostlinkedTemplatesPage',
152  'Mostcategories' => 'MostcategoriesPage',
153  'Mostrevisions' => 'MostrevisionsPage',
154 
155  // Page tools
156  'ComparePages' => 'SpecialComparePages',
157  'Export' => 'SpecialExport',
158  'Import' => 'SpecialImport',
159  'Undelete' => 'SpecialUndelete',
160  'Whatlinkshere' => 'SpecialWhatLinksHere',
161  'MergeHistory' => 'SpecialMergeHistory',
162  'ExpandTemplates' => 'SpecialExpandTemplates',
163 
164  // Other
165  'Booksources' => 'SpecialBookSources',
166 
167  // Unlisted / redirects
168  'ApiHelp' => 'SpecialApiHelp',
169  'Blankpage' => 'SpecialBlankpage',
170  'Diff' => 'SpecialDiff',
171  'EditTags' => 'SpecialEditTags',
172  'Emailuser' => 'SpecialEmailUser',
173  'Movepage' => 'MovePageForm',
174  'Mycontributions' => 'SpecialMycontributions',
175  'MyLanguage' => 'SpecialMyLanguage',
176  'Mypage' => 'SpecialMypage',
177  'Mytalk' => 'SpecialMytalk',
178  'Myuploads' => 'SpecialMyuploads',
179  'AllMyUploads' => 'SpecialAllMyUploads',
180  'PermanentLink' => 'SpecialPermanentLink',
181  'Redirect' => 'SpecialRedirect',
182  'Revisiondelete' => 'SpecialRevisionDelete',
183  'RunJobs' => 'SpecialRunJobs',
184  'Specialpages' => 'SpecialSpecialpages',
185  ];
186 
187  private static $list;
188  private static $aliases;
189  private static $pageObjectCache = [];
190 
195  public static function resetList() {
196  self::$list = null;
197  self::$aliases = null;
198  self::$pageObjectCache = [];
199  }
200 
207  public static function getNames() {
208  return array_keys( self::getPageList() );
209  }
210 
217  public static function getList() {
218  wfDeprecated( __FUNCTION__, '1.24' );
219  return self::getPageList();
220  }
221 
227  private static function getPageList() {
228  global $wgSpecialPages;
229  global $wgDisableInternalSearch, $wgEmailAuthentication;
230  global $wgEnableEmail, $wgEnableJavaScriptTest;
231  global $wgPageLanguageUseDB, $wgContentHandlerUseDB;
232 
233  if ( !is_array( self::$list ) ) {
234 
235  self::$list = self::$coreList;
236 
237  if ( !$wgDisableInternalSearch ) {
238  self::$list['Search'] = 'SpecialSearch';
239  }
240 
241  if ( $wgEmailAuthentication ) {
242  self::$list['Confirmemail'] = 'EmailConfirmation';
243  self::$list['Invalidateemail'] = 'EmailInvalidation';
244  }
245 
246  if ( $wgEnableEmail ) {
247  self::$list['ChangeEmail'] = 'SpecialChangeEmail';
248  }
249 
250  if ( $wgEnableJavaScriptTest ) {
251  self::$list['JavaScriptTest'] = 'SpecialJavaScriptTest';
252  }
253 
254  if ( $wgPageLanguageUseDB ) {
255  self::$list['PageLanguage'] = 'SpecialPageLanguage';
256  }
257  if ( $wgContentHandlerUseDB ) {
258  self::$list['ChangeContentModel'] = 'SpecialChangeContentModel';
259  }
260 
261  self::$list['Activeusers'] = 'SpecialActiveUsers';
262 
263  // Add extension special pages
264  self::$list = array_merge( self::$list, $wgSpecialPages );
265 
266  // This hook can be used to disable unwanted core special pages
267  // or conditionally register special pages.
268  Hooks::run( 'SpecialPage_initList', [ &self::$list ] );
269 
270  }
271 
272  return self::$list;
273  }
274 
281  private static function getAliasList() {
282  if ( is_null( self::$aliases ) ) {
284  $aliases = $wgContLang->getSpecialPageAliases();
285  $pageList = self::getPageList();
286 
287  self::$aliases = [];
288  $keepAlias = [];
289 
290  // Force every canonical name to be an alias for itself.
291  foreach ( $pageList as $name => $stuff ) {
292  $caseFoldedAlias = $wgContLang->caseFold( $name );
293  self::$aliases[$caseFoldedAlias] = $name;
294  $keepAlias[$caseFoldedAlias] = 'canonical';
295  }
296 
297  // Check for $aliases being an array since Language::getSpecialPageAliases can return null
298  if ( is_array( $aliases ) ) {
299  foreach ( $aliases as $realName => $aliasList ) {
300  $aliasList = array_values( $aliasList );
301  foreach ( $aliasList as $i => $alias ) {
302  $caseFoldedAlias = $wgContLang->caseFold( $alias );
303 
304  if ( isset( self::$aliases[$caseFoldedAlias] ) &&
305  $realName === self::$aliases[$caseFoldedAlias]
306  ) {
307  // Ignore same-realName conflicts
308  continue;
309  }
310 
311  if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
312  self::$aliases[$caseFoldedAlias] = $realName;
313  if ( !$i ) {
314  $keepAlias[$caseFoldedAlias] = 'first';
315  }
316  } elseif ( !$i ) {
317  wfWarn( "First alias '$alias' for $realName conflicts with " .
318  "{$keepAlias[$caseFoldedAlias]} alias for " .
319  self::$aliases[$caseFoldedAlias]
320  );
321  }
322  }
323  }
324  }
325  }
326 
327  return self::$aliases;
328  }
329 
338  public static function resolveAlias( $alias ) {
340  $bits = explode( '/', $alias, 2 );
341 
342  $caseFoldedAlias = $wgContLang->caseFold( $bits[0] );
343  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
344  $aliases = self::getAliasList();
345  if ( isset( $aliases[$caseFoldedAlias] ) ) {
346  $name = $aliases[$caseFoldedAlias];
347  } else {
348  return [ null, null ];
349  }
350 
351  if ( !isset( $bits[1] ) ) { // bug 2087
352  $par = null;
353  } else {
354  $par = $bits[1];
355  }
356 
357  return [ $name, $par ];
358  }
359 
366  public static function exists( $name ) {
367  list( $title, /*...*/ ) = self::resolveAlias( $name );
368 
369  $specialPageList = self::getPageList();
370  return isset( $specialPageList[$title] );
371  }
372 
379  public static function getPage( $name ) {
380  list( $realName, /*...*/ ) = self::resolveAlias( $name );
381 
382  if ( isset( self::$pageObjectCache[$realName] ) ) {
383  return self::$pageObjectCache[$realName];
384  }
385 
386  $specialPageList = self::getPageList();
387 
388  if ( isset( $specialPageList[$realName] ) ) {
389  $rec = $specialPageList[$realName];
390 
391  if ( is_callable( $rec ) ) {
392  // Use callback to instantiate the special page
393  $page = call_user_func( $rec );
394  } elseif ( is_string( $rec ) ) {
395  $className = $rec;
396  $page = new $className;
397  } elseif ( is_array( $rec ) ) {
398  $className = array_shift( $rec );
399  // @deprecated, officially since 1.18, unofficially since forever
400  wfDeprecated( "Array syntax for \$wgSpecialPages is deprecated ($className), " .
401  "define a subclass of SpecialPage instead.", '1.18' );
403  'class' => $className,
404  'args' => $rec,
405  'closure_expansion' => false,
406  ] );
407  } elseif ( $rec instanceof SpecialPage ) {
408  $page = $rec; // XXX: we should deep clone here
409  } else {
410  $page = null;
411  }
412 
413  self::$pageObjectCache[$realName] = $page;
414  if ( $page instanceof SpecialPage ) {
415  return $page;
416  } else {
417  // It's not a classname, nor a callback, nor a legacy constructor array,
418  // nor a special page object. Give up.
419  wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
420  return null;
421  }
422 
423  } else {
424  return null;
425  }
426  }
427 
436  public static function getUsablePages( User $user = null ) {
437  $pages = [];
438  if ( $user === null ) {
439  global $wgUser;
440  $user = $wgUser;
441  }
442  foreach ( self::getPageList() as $name => $rec ) {
443  $page = self::getPage( $name );
444  if ( $page ) { // not null
445  $page->setContext( RequestContext::getMain() );
446  if ( $page->isListed()
447  && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
448  ) {
449  $pages[$name] = $page;
450  }
451  }
452  }
453 
454  return $pages;
455  }
456 
462  public static function getRegularPages() {
463  $pages = [];
464  foreach ( self::getPageList() as $name => $rec ) {
465  $page = self::getPage( $name );
466  if ( $page->isListed() && !$page->isRestricted() ) {
467  $pages[$name] = $page;
468  }
469  }
470 
471  return $pages;
472  }
473 
481  public static function getRestrictedPages( User $user = null ) {
482  $pages = [];
483  if ( $user === null ) {
484  global $wgUser;
485  $user = $wgUser;
486  }
487  foreach ( self::getPageList() as $name => $rec ) {
488  $page = self::getPage( $name );
489  if (
490  $page->isListed()
491  && $page->isRestricted()
492  && $page->userCanExecute( $user )
493  ) {
494  $pages[$name] = $page;
495  }
496  }
497 
498  return $pages;
499  }
500 
515  public static function executePath( Title &$title, IContextSource &$context, $including = false ) {
516  // @todo FIXME: Redirects broken due to this call
517  $bits = explode( '/', $title->getDBkey(), 2 );
518  $name = $bits[0];
519  if ( !isset( $bits[1] ) ) { // bug 2087
520  $par = null;
521  } else {
522  $par = $bits[1];
523  }
524 
525  $page = self::getPage( $name );
526  if ( !$page ) {
527  $context->getOutput()->setArticleRelated( false );
528  $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
529 
531  if ( $wgSend404Code ) {
532  $context->getOutput()->setStatusCode( 404 );
533  }
534 
535  $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
536 
537  return false;
538  }
539 
540  if ( !$including ) {
541  // Narrow DB query expectations for this HTTP request
542  $trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
543  $trxProfiler = Profiler::instance()->getTransactionProfiler();
544  if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
545  $trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
546  }
547  }
548 
549  // Page exists, set the context
550  $page->setContext( $context );
551 
552  if ( !$including ) {
553  // Redirect to canonical alias for GET commands
554  // Not for POST, we'd lose the post data, so it's best to just distribute
555  // the request. Such POST requests are possible for old extensions that
556  // generate self-links without being aware that their default name has
557  // changed.
558  if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
559  $query = $context->getRequest()->getQueryValues();
560  unset( $query['title'] );
561  $title = $page->getPageTitle( $par );
562  $url = $title->getFullURL( $query );
563  $context->getOutput()->redirect( $url );
564 
565  return $title;
566  } else {
567  $context->setTitle( $page->getPageTitle( $par ) );
568  }
569  } elseif ( !$page->isIncludable() ) {
570  return false;
571  }
572 
573  $page->including( $including );
574 
575  // Execute special page
576  $page->run( $par );
577 
578  return true;
579  }
580 
595  public static function capturePath( Title $title, IContextSource $context ) {
597  $main = RequestContext::getMain();
598 
599  // Save current globals and main context
600  $glob = [
601  'title' => $wgTitle,
602  'output' => $wgOut,
603  'request' => $wgRequest,
604  'user' => $wgUser,
605  'language' => $wgLang,
606  ];
607  $ctx = [
608  'title' => $main->getTitle(),
609  'output' => $main->getOutput(),
610  'request' => $main->getRequest(),
611  'user' => $main->getUser(),
612  'language' => $main->getLanguage(),
613  ];
614 
615  // Override
616  $wgTitle = $title;
617  $wgOut = $context->getOutput();
618  $wgRequest = $context->getRequest();
619  $wgUser = $context->getUser();
620  $wgLang = $context->getLanguage();
621  $main->setTitle( $title );
622  $main->setOutput( $context->getOutput() );
623  $main->setRequest( $context->getRequest() );
624  $main->setUser( $context->getUser() );
625  $main->setLanguage( $context->getLanguage() );
626 
627  // The useful part
628  $ret = self::executePath( $title, $context, true );
629 
630  // Restore old globals and context
631  $wgTitle = $glob['title'];
632  $wgOut = $glob['output'];
633  $wgRequest = $glob['request'];
634  $wgUser = $glob['user'];
635  $wgLang = $glob['language'];
636  $main->setTitle( $ctx['title'] );
637  $main->setOutput( $ctx['output'] );
638  $main->setRequest( $ctx['request'] );
639  $main->setUser( $ctx['user'] );
640  $main->setLanguage( $ctx['language'] );
641 
642  return $ret;
643  }
644 
652  public static function getLocalNameFor( $name, $subpage = false ) {
654  $aliases = $wgContLang->getSpecialPageAliases();
655  $aliasList = self::getAliasList();
656 
657  // Find the first alias that maps back to $name
658  if ( isset( $aliases[$name] ) ) {
659  $found = false;
660  foreach ( $aliases[$name] as $alias ) {
661  $caseFoldedAlias = $wgContLang->caseFold( $alias );
662  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
663  if ( isset( $aliasList[$caseFoldedAlias] ) &&
664  $aliasList[$caseFoldedAlias] === $name
665  ) {
666  $name = $alias;
667  $found = true;
668  break;
669  }
670  }
671  if ( !$found ) {
672  wfWarn( "Did not find a usable alias for special page '$name'. " .
673  "It seems all defined aliases conflict?" );
674  }
675  } else {
676  // Check if someone misspelled the correct casing
677  if ( is_array( $aliases ) ) {
678  foreach ( $aliases as $n => $values ) {
679  if ( strcasecmp( $name, $n ) === 0 ) {
680  wfWarn( "Found alias defined for $n when searching for " .
681  "special page aliases for $name. Case mismatch?" );
682  return self::getLocalNameFor( $n, $subpage );
683  }
684  }
685  }
686 
687  wfWarn( "Did not find alias for special page '$name'. " .
688  "Perhaps no aliases are defined for it?" );
689  }
690 
691  if ( $subpage !== false && !is_null( $subpage ) ) {
692  $name = "$name/$subpage";
693  }
694 
695  return $wgContLang->ucfirst( $name );
696  }
697 
704  public static function getTitleForAlias( $alias ) {
705  list( $name, $subpage ) = self::resolveAlias( $alias );
706  if ( $name != null ) {
707  return SpecialPage::getTitleFor( $name, $subpage );
708  } else {
709  return null;
710  }
711  }
712 }
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:1418
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:1798
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:912
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:242
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:2338
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:310