MediaWiki  master
SpecialPageFactory.php
Go to the documentation of this file.
1 <?php
25 
51  private static $coreList = [
52  // Maintenance Reports
53  'BrokenRedirects' => 'BrokenRedirectsPage',
54  'Deadendpages' => 'DeadendPagesPage',
55  'DoubleRedirects' => 'DoubleRedirectsPage',
56  'Longpages' => 'LongPagesPage',
57  'Ancientpages' => 'AncientPagesPage',
58  'Lonelypages' => 'LonelyPagesPage',
59  'Fewestrevisions' => 'FewestrevisionsPage',
60  'Withoutinterwiki' => 'WithoutInterwikiPage',
61  'Protectedpages' => 'SpecialProtectedpages',
62  'Protectedtitles' => 'SpecialProtectedtitles',
63  'Shortpages' => 'ShortPagesPage',
64  'Uncategorizedcategories' => 'UncategorizedCategoriesPage',
65  'Uncategorizedimages' => 'UncategorizedImagesPage',
66  'Uncategorizedpages' => 'UncategorizedPagesPage',
67  'Uncategorizedtemplates' => 'UncategorizedTemplatesPage',
68  'Unusedcategories' => 'UnusedCategoriesPage',
69  'Unusedimages' => 'UnusedimagesPage',
70  'Unusedtemplates' => 'UnusedtemplatesPage',
71  'Unwatchedpages' => 'UnwatchedpagesPage',
72  'Wantedcategories' => 'WantedCategoriesPage',
73  'Wantedfiles' => 'WantedFilesPage',
74  'Wantedpages' => 'WantedPagesPage',
75  'Wantedtemplates' => 'WantedTemplatesPage',
76 
77  // List of pages
78  'Allpages' => 'SpecialAllPages',
79  'Prefixindex' => 'SpecialPrefixindex',
80  'Categories' => 'SpecialCategories',
81  'Listredirects' => 'ListredirectsPage',
82  'PagesWithProp' => 'SpecialPagesWithProp',
83  'TrackingCategories' => 'SpecialTrackingCategories',
84 
85  // Authentication
86  'Userlogin' => 'SpecialUserLogin',
87  'Userlogout' => 'SpecialUserlogoutPreAuthManager',
88  'CreateAccount' => 'SpecialCreateAccountPreAuthManager',
89  'LinkAccounts' => 'SpecialLinkAccounts',
90  'UnlinkAccounts' => 'SpecialUnlinkAccounts',
91  'ChangeCredentials' => 'SpecialChangeCredentials',
92  'RemoveCredentials' => 'SpecialRemoveCredentials',
93 
94  // Users and rights
95  'Activeusers' => 'SpecialActiveUsers',
96  'Block' => 'SpecialBlock',
97  'Unblock' => 'SpecialUnblock',
98  'BlockList' => 'SpecialBlockList',
99  'ChangePassword' => 'SpecialChangePasswordPreAuthManager',
100  'BotPasswords' => 'SpecialBotPasswords',
101  'PasswordReset' => 'SpecialPasswordResetPreAuthManager',
102  'DeletedContributions' => 'DeletedContributionsPage',
103  'Preferences' => 'SpecialPreferences',
104  'ResetTokens' => 'SpecialResetTokens',
105  'Contributions' => 'SpecialContributions',
106  'Listgrouprights' => 'SpecialListGroupRights',
107  'Listgrants' => 'SpecialListGrants',
108  'Listusers' => 'SpecialListUsers',
109  'Listadmins' => 'SpecialListAdmins',
110  'Listbots' => 'SpecialListBots',
111  'Userrights' => 'UserrightsPage',
112  'EditWatchlist' => 'SpecialEditWatchlist',
113 
114  // Recent changes and logs
115  'Newimages' => 'SpecialNewFiles',
116  'Log' => 'SpecialLog',
117  'Watchlist' => 'SpecialWatchlist',
118  'Newpages' => 'SpecialNewpages',
119  'Recentchanges' => 'SpecialRecentChanges',
120  'Recentchangeslinked' => 'SpecialRecentChangesLinked',
121  'Tags' => 'SpecialTags',
122 
123  // Media reports and uploads
124  'Listfiles' => 'SpecialListFiles',
125  'Filepath' => 'SpecialFilepath',
126  'MediaStatistics' => 'MediaStatisticsPage',
127  'MIMEsearch' => 'MIMEsearchPage',
128  'FileDuplicateSearch' => 'FileDuplicateSearchPage',
129  'Upload' => 'SpecialUpload',
130  'UploadStash' => 'SpecialUploadStash',
131  'ListDuplicatedFiles' => 'ListDuplicatedFilesPage',
132 
133  // Data and tools
134  'ApiSandbox' => 'SpecialApiSandbox',
135  'Statistics' => 'SpecialStatistics',
136  'Allmessages' => 'SpecialAllMessages',
137  'Version' => 'SpecialVersion',
138  'Lockdb' => 'SpecialLockdb',
139  'Unlockdb' => 'SpecialUnlockdb',
140 
141  // Redirecting special pages
142  'LinkSearch' => 'LinkSearchPage',
143  'Randompage' => 'RandomPage',
144  'RandomInCategory' => 'SpecialRandomInCategory',
145  'Randomredirect' => 'SpecialRandomredirect',
146  'Randomrootpage' => 'SpecialRandomrootpage',
147 
148  // High use pages
149  'Mostlinkedcategories' => 'MostlinkedCategoriesPage',
150  'Mostimages' => 'MostimagesPage',
151  'Mostinterwikis' => 'MostinterwikisPage',
152  'Mostlinked' => 'MostlinkedPage',
153  'Mostlinkedtemplates' => 'MostlinkedTemplatesPage',
154  'Mostcategories' => 'MostcategoriesPage',
155  'Mostrevisions' => 'MostrevisionsPage',
156 
157  // Page tools
158  'ComparePages' => 'SpecialComparePages',
159  'Export' => 'SpecialExport',
160  'Import' => 'SpecialImport',
161  'Undelete' => 'SpecialUndelete',
162  'Whatlinkshere' => 'SpecialWhatLinksHere',
163  'MergeHistory' => 'SpecialMergeHistory',
164  'ExpandTemplates' => 'SpecialExpandTemplates',
165 
166  // Other
167  'Booksources' => 'SpecialBookSources',
168 
169  // Unlisted / redirects
170  'ApiHelp' => 'SpecialApiHelp',
171  'Blankpage' => 'SpecialBlankpage',
172  'Diff' => 'SpecialDiff',
173  'EditTags' => 'SpecialEditTags',
174  'Emailuser' => 'SpecialEmailUser',
175  'Movepage' => 'MovePageForm',
176  'Mycontributions' => 'SpecialMycontributions',
177  'MyLanguage' => 'SpecialMyLanguage',
178  'Mypage' => 'SpecialMypage',
179  'Mytalk' => 'SpecialMytalk',
180  'Myuploads' => 'SpecialMyuploads',
181  'AllMyUploads' => 'SpecialAllMyUploads',
182  'PermanentLink' => 'SpecialPermanentLink',
183  'Redirect' => 'SpecialRedirect',
184  'Revisiondelete' => 'SpecialRevisionDelete',
185  'RunJobs' => 'SpecialRunJobs',
186  'Specialpages' => 'SpecialSpecialpages',
187  ];
188 
189  private static $list;
190  private static $aliases;
191  private static $pageObjectCache = [];
192 
197  public static function resetList() {
198  self::$list = null;
199  self::$aliases = null;
200  self::$pageObjectCache = [];
201  }
202 
209  public static function getNames() {
210  return array_keys( self::getPageList() );
211  }
212 
219  public static function getList() {
220  wfDeprecated( __FUNCTION__, '1.24' );
221  return self::getPageList();
222  }
223 
229  private static function getPageList() {
235 
236  if ( !is_array( self::$list ) ) {
237 
238  self::$list = self::$coreList;
239 
240  if ( !$wgDisableInternalSearch ) {
241  self::$list['Search'] = 'SpecialSearch';
242  }
243 
244  if ( $wgEmailAuthentication ) {
245  self::$list['Confirmemail'] = 'EmailConfirmation';
246  self::$list['Invalidateemail'] = 'EmailInvalidation';
247  }
248 
249  if ( $wgEnableEmail ) {
250  self::$list['ChangeEmail'] = 'SpecialChangeEmailPreAuthManager';
251  }
252 
253  if ( $wgEnableJavaScriptTest ) {
254  self::$list['JavaScriptTest'] = 'SpecialJavaScriptTest';
255  }
256 
257  if ( $wgPageLanguageUseDB ) {
258  self::$list['PageLanguage'] = 'SpecialPageLanguage';
259  }
260  if ( $wgContentHandlerUseDB ) {
261  self::$list['ChangeContentModel'] = 'SpecialChangeContentModel';
262  }
263 
264  // horrible hack to allow selection between old and new classes via a feature flag - T110756
265  // will be removed once AuthManager is stable
266  if ( !$wgDisableAuthManager ) {
267  self::$list = array_map( function ( $class ) {
268  return preg_replace( '/PreAuthManager$/', '', $class );
269  }, self::$list );
270  self::$list['Userlogout'] = 'SpecialUserLogout'; // case matters
271  } else {
272  self::$list['Userlogin'] = 'LoginForm';
273  self::$list = array_diff_key( self::$list, array_fill_keys( [
274  'LinkAccounts', 'UnlinkAccounts', 'ChangeCredentials', 'RemoveCredentials',
275  ], true ) );
276  }
277 
278  // Add extension special pages
279  self::$list = array_merge( self::$list, $wgSpecialPages );
280 
281  // This hook can be used to disable unwanted core special pages
282  // or conditionally register special pages.
283  Hooks::run( 'SpecialPage_initList', [ &self::$list ] );
284 
285  }
286 
287  return self::$list;
288  }
289 
296  private static function getAliasList() {
297  if ( is_null( self::$aliases ) ) {
299  $aliases = $wgContLang->getSpecialPageAliases();
300  $pageList = self::getPageList();
301 
302  self::$aliases = [];
303  $keepAlias = [];
304 
305  // Force every canonical name to be an alias for itself.
306  foreach ( $pageList as $name => $stuff ) {
307  $caseFoldedAlias = $wgContLang->caseFold( $name );
308  self::$aliases[$caseFoldedAlias] = $name;
309  $keepAlias[$caseFoldedAlias] = 'canonical';
310  }
311 
312  // Check for $aliases being an array since Language::getSpecialPageAliases can return null
313  if ( is_array( $aliases ) ) {
314  foreach ( $aliases as $realName => $aliasList ) {
315  $aliasList = array_values( $aliasList );
316  foreach ( $aliasList as $i => $alias ) {
317  $caseFoldedAlias = $wgContLang->caseFold( $alias );
318 
319  if ( isset( self::$aliases[$caseFoldedAlias] ) &&
320  $realName === self::$aliases[$caseFoldedAlias]
321  ) {
322  // Ignore same-realName conflicts
323  continue;
324  }
325 
326  if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
327  self::$aliases[$caseFoldedAlias] = $realName;
328  if ( !$i ) {
329  $keepAlias[$caseFoldedAlias] = 'first';
330  }
331  } elseif ( !$i ) {
332  wfWarn( "First alias '$alias' for $realName conflicts with " .
333  "{$keepAlias[$caseFoldedAlias]} alias for " .
334  self::$aliases[$caseFoldedAlias]
335  );
336  }
337  }
338  }
339  }
340  }
341 
342  return self::$aliases;
343  }
344 
353  public static function resolveAlias( $alias ) {
355  $bits = explode( '/', $alias, 2 );
356 
357  $caseFoldedAlias = $wgContLang->caseFold( $bits[0] );
358  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
359  $aliases = self::getAliasList();
360  if ( isset( $aliases[$caseFoldedAlias] ) ) {
361  $name = $aliases[$caseFoldedAlias];
362  } else {
363  return [ null, null ];
364  }
365 
366  if ( !isset( $bits[1] ) ) { // bug 2087
367  $par = null;
368  } else {
369  $par = $bits[1];
370  }
371 
372  return [ $name, $par ];
373  }
374 
381  public static function exists( $name ) {
382  list( $title, /*...*/ ) = self::resolveAlias( $name );
383 
384  $specialPageList = self::getPageList();
385  return isset( $specialPageList[$title] );
386  }
387 
394  public static function getPage( $name ) {
395  list( $realName, /*...*/ ) = self::resolveAlias( $name );
396 
397  if ( isset( self::$pageObjectCache[$realName] ) ) {
398  return self::$pageObjectCache[$realName];
399  }
400 
401  $specialPageList = self::getPageList();
402 
403  if ( isset( $specialPageList[$realName] ) ) {
404  $rec = $specialPageList[$realName];
405 
406  if ( is_callable( $rec ) ) {
407  // Use callback to instantiate the special page
408  $page = call_user_func( $rec );
409  } elseif ( is_string( $rec ) ) {
410  $className = $rec;
411  $page = new $className;
412  } elseif ( is_array( $rec ) ) {
413  $className = array_shift( $rec );
414  // @deprecated, officially since 1.18, unofficially since forever
415  wfDeprecated( "Array syntax for \$wgSpecialPages is deprecated ($className), " .
416  "define a subclass of SpecialPage instead.", '1.18' );
418  'class' => $className,
419  'args' => $rec,
420  'closure_expansion' => false,
421  ] );
422  } elseif ( $rec instanceof SpecialPage ) {
423  $page = $rec; // XXX: we should deep clone here
424  } else {
425  $page = null;
426  }
427 
428  self::$pageObjectCache[$realName] = $page;
429  if ( $page instanceof SpecialPage ) {
430  return $page;
431  } else {
432  // It's not a classname, nor a callback, nor a legacy constructor array,
433  // nor a special page object. Give up.
434  wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
435  return null;
436  }
437 
438  } else {
439  return null;
440  }
441  }
442 
451  public static function getUsablePages( User $user = null ) {
452  $pages = [];
453  if ( $user === null ) {
454  global $wgUser;
455  $user = $wgUser;
456  }
457  foreach ( self::getPageList() as $name => $rec ) {
458  $page = self::getPage( $name );
459  if ( $page ) { // not null
460  $page->setContext( RequestContext::getMain() );
461  if ( $page->isListed()
462  && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
463  ) {
464  $pages[$name] = $page;
465  }
466  }
467  }
468 
469  return $pages;
470  }
471 
477  public static function getRegularPages() {
478  $pages = [];
479  foreach ( self::getPageList() as $name => $rec ) {
480  $page = self::getPage( $name );
481  if ( $page->isListed() && !$page->isRestricted() ) {
482  $pages[$name] = $page;
483  }
484  }
485 
486  return $pages;
487  }
488 
496  public static function getRestrictedPages( User $user = null ) {
497  $pages = [];
498  if ( $user === null ) {
499  global $wgUser;
500  $user = $wgUser;
501  }
502  foreach ( self::getPageList() as $name => $rec ) {
503  $page = self::getPage( $name );
504  if (
505  $page->isListed()
506  && $page->isRestricted()
507  && $page->userCanExecute( $user )
508  ) {
509  $pages[$name] = $page;
510  }
511  }
512 
513  return $pages;
514  }
515 
531  public static function executePath( Title &$title, IContextSource &$context, $including = false,
533  ) {
534  // @todo FIXME: Redirects broken due to this call
535  $bits = explode( '/', $title->getDBkey(), 2 );
536  $name = $bits[0];
537  if ( !isset( $bits[1] ) ) { // bug 2087
538  $par = null;
539  } else {
540  $par = $bits[1];
541  }
542 
543  $page = self::getPage( $name );
544  if ( !$page ) {
545  $context->getOutput()->setArticleRelated( false );
546  $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
547 
549  if ( $wgSend404Code ) {
550  $context->getOutput()->setStatusCode( 404 );
551  }
552 
553  $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
554 
555  return false;
556  }
557 
558  if ( !$including ) {
559  // Narrow DB query expectations for this HTTP request
560  $trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
561  $trxProfiler = Profiler::instance()->getTransactionProfiler();
562  if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
563  $trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
564  $context->getRequest()->markAsSafeRequest();
565  }
566  }
567 
568  // Page exists, set the context
569  $page->setContext( $context );
570 
571  if ( !$including ) {
572  // Redirect to canonical alias for GET commands
573  // Not for POST, we'd lose the post data, so it's best to just distribute
574  // the request. Such POST requests are possible for old extensions that
575  // generate self-links without being aware that their default name has
576  // changed.
577  if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
578  $query = $context->getRequest()->getQueryValues();
579  unset( $query['title'] );
580  $title = $page->getPageTitle( $par );
581  $url = $title->getFullURL( $query );
582  $context->getOutput()->redirect( $url );
583 
584  return $title;
585  } else {
586  $context->setTitle( $page->getPageTitle( $par ) );
587  }
588  } elseif ( !$page->isIncludable() ) {
589  return false;
590  }
591 
592  $page->including( $including );
593  if ( $linkRenderer ) {
594  $page->setLinkRenderer( $linkRenderer );
595  }
596 
597  // Execute special page
598  $page->run( $par );
599 
600  return true;
601  }
602 
618  public static function capturePath(
620  ) {
622  $main = RequestContext::getMain();
623 
624  // Save current globals and main context
625  $glob = [
626  'title' => $wgTitle,
627  'output' => $wgOut,
628  'request' => $wgRequest,
629  'user' => $wgUser,
630  'language' => $wgLang,
631  ];
632  $ctx = [
633  'title' => $main->getTitle(),
634  'output' => $main->getOutput(),
635  'request' => $main->getRequest(),
636  'user' => $main->getUser(),
637  'language' => $main->getLanguage(),
638  ];
639 
640  // Override
641  $wgTitle = $title;
642  $wgOut = $context->getOutput();
643  $wgRequest = $context->getRequest();
644  $wgUser = $context->getUser();
645  $wgLang = $context->getLanguage();
646  $main->setTitle( $title );
647  $main->setOutput( $context->getOutput() );
648  $main->setRequest( $context->getRequest() );
649  $main->setUser( $context->getUser() );
650  $main->setLanguage( $context->getLanguage() );
651 
652  // The useful part
653  $ret = self::executePath( $title, $context, true, $linkRenderer );
654 
655  // Restore old globals and context
656  $wgTitle = $glob['title'];
657  $wgOut = $glob['output'];
658  $wgRequest = $glob['request'];
659  $wgUser = $glob['user'];
660  $wgLang = $glob['language'];
661  $main->setTitle( $ctx['title'] );
662  $main->setOutput( $ctx['output'] );
663  $main->setRequest( $ctx['request'] );
664  $main->setUser( $ctx['user'] );
665  $main->setLanguage( $ctx['language'] );
666 
667  return $ret;
668  }
669 
677  public static function getLocalNameFor( $name, $subpage = false ) {
679  $aliases = $wgContLang->getSpecialPageAliases();
680  $aliasList = self::getAliasList();
681 
682  // Find the first alias that maps back to $name
683  if ( isset( $aliases[$name] ) ) {
684  $found = false;
685  foreach ( $aliases[$name] as $alias ) {
686  $caseFoldedAlias = $wgContLang->caseFold( $alias );
687  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
688  if ( isset( $aliasList[$caseFoldedAlias] ) &&
689  $aliasList[$caseFoldedAlias] === $name
690  ) {
691  $name = $alias;
692  $found = true;
693  break;
694  }
695  }
696  if ( !$found ) {
697  wfWarn( "Did not find a usable alias for special page '$name'. " .
698  "It seems all defined aliases conflict?" );
699  }
700  } else {
701  // Check if someone misspelled the correct casing
702  if ( is_array( $aliases ) ) {
703  foreach ( $aliases as $n => $values ) {
704  if ( strcasecmp( $name, $n ) === 0 ) {
705  wfWarn( "Found alias defined for $n when searching for " .
706  "special page aliases for $name. Case mismatch?" );
707  return self::getLocalNameFor( $n, $subpage );
708  }
709  }
710  }
711 
712  wfWarn( "Did not find alias for special page '$name'. " .
713  "Perhaps no aliases are defined for it?" );
714  }
715 
716  if ( $subpage !== false && !is_null( $subpage ) ) {
717  $name = "$name/$subpage";
718  }
719 
720  return $wgContLang->ucfirst( $name );
721  }
722 
729  public static function getTitleForAlias( $alias ) {
730  list( $name, $subpage ) = self::resolveAlias( $alias );
731  if ( $name != null ) {
732  return SpecialPage::getTitleFor( $name, $subpage );
733  } else {
734  return null;
735  }
736  }
737 }
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:1435
static getObjectFromSpec($spec)
Instantiate an object based on a specification array.
$context
Definition: load.php:43
static getRegularPages()
Return categorised listable special pages for all users.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:80
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 just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition: hooks.txt:1816
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:36
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
$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
The User object encapsulates all of the user-specific settings (user_id, name, rights, email address, options, last login time).
Definition: User.php:47
$wgContentHandlerUseDB
Set to false to disable use of the database fields introduced by the ContentHandler facility...
getUser()
Get the User object.
static getPage($name)
Find the object with a given name and return it (or NULL)
$wgEnableJavaScriptTest
Allow running of javascript test suites via [[Special:JavaScriptTest]] (such as QUnit).
Parent class for all special pages.
Definition: SpecialPage.php:36
getConfig()
Get the site configuration.
Class that generates HTML links for pages.
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:890
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.
static capturePath(Title $title, IContextSource $context, LinkRenderer $linkRenderer=null)
Just like executePath() but will override global variables and execute the page in "inclusion" mode...
$wgSpecialPages
Special page list.
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
Definition: hooks.txt:312
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.
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:1816
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.
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
$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.
$wgDisableAuthManager
Disable AuthManager.
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
static executePath(Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null)
Execute a special page path.
$wgDisableInternalSearch
Disable the internal MySQL-based search, to allow it to be implemented by an extension instead...
getOutput()
Get the OutputPage object.
$wgOut
Definition: Setup.php:811
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:663
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:2376
getFullURL($query= '', $query2=false, $proto=PROTO_RELATIVE)
Get a real URL referring to this title, with interwiki link and fragment.
Definition: Title.php:1647
$wgUser
Definition: Setup.php:801
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310