MediaWiki  1.32.0
SpecialPageFactory.php
Go to the documentation of this file.
1 <?php
26 
27 use Config;
28 use Hooks;
35 use Title;
36 use User;
37 
69  private static $coreList = [
70  // Maintenance Reports
71  'BrokenRedirects' => \BrokenRedirectsPage::class,
72  'Deadendpages' => \DeadendPagesPage::class,
73  'DoubleRedirects' => \DoubleRedirectsPage::class,
74  'Longpages' => \LongPagesPage::class,
75  'Ancientpages' => \AncientPagesPage::class,
76  'Lonelypages' => \LonelyPagesPage::class,
77  'Fewestrevisions' => \FewestrevisionsPage::class,
78  'Withoutinterwiki' => \WithoutInterwikiPage::class,
79  'Protectedpages' => \SpecialProtectedpages::class,
80  'Protectedtitles' => \SpecialProtectedtitles::class,
81  'Shortpages' => \ShortPagesPage::class,
82  'Uncategorizedcategories' => \UncategorizedCategoriesPage::class,
83  'Uncategorizedimages' => \UncategorizedImagesPage::class,
84  'Uncategorizedpages' => \UncategorizedPagesPage::class,
85  'Uncategorizedtemplates' => \UncategorizedTemplatesPage::class,
86  'Unusedcategories' => \UnusedCategoriesPage::class,
87  'Unusedimages' => \UnusedimagesPage::class,
88  'Unusedtemplates' => \UnusedtemplatesPage::class,
89  'Unwatchedpages' => \UnwatchedpagesPage::class,
90  'Wantedcategories' => \WantedCategoriesPage::class,
91  'Wantedfiles' => \WantedFilesPage::class,
92  'Wantedpages' => \WantedPagesPage::class,
93  'Wantedtemplates' => \WantedTemplatesPage::class,
94 
95  // List of pages
96  'Allpages' => \SpecialAllPages::class,
97  'Prefixindex' => \SpecialPrefixindex::class,
98  'Categories' => \SpecialCategories::class,
99  'Listredirects' => \ListredirectsPage::class,
100  'PagesWithProp' => \SpecialPagesWithProp::class,
101  'TrackingCategories' => \SpecialTrackingCategories::class,
102 
103  // Authentication
104  'Userlogin' => \SpecialUserLogin::class,
105  'Userlogout' => \SpecialUserLogout::class,
106  'CreateAccount' => \SpecialCreateAccount::class,
107  'LinkAccounts' => \SpecialLinkAccounts::class,
108  'UnlinkAccounts' => \SpecialUnlinkAccounts::class,
109  'ChangeCredentials' => \SpecialChangeCredentials::class,
110  'RemoveCredentials' => \SpecialRemoveCredentials::class,
111 
112  // Users and rights
113  'Activeusers' => \SpecialActiveUsers::class,
114  'Block' => \SpecialBlock::class,
115  'Unblock' => \SpecialUnblock::class,
116  'BlockList' => \SpecialBlockList::class,
117  'AutoblockList' => \SpecialAutoblockList::class,
118  'ChangePassword' => \SpecialChangePassword::class,
119  'BotPasswords' => \SpecialBotPasswords::class,
120  'PasswordReset' => \SpecialPasswordReset::class,
121  'DeletedContributions' => \DeletedContributionsPage::class,
122  'Preferences' => \SpecialPreferences::class,
123  'ResetTokens' => \SpecialResetTokens::class,
124  'Contributions' => \SpecialContributions::class,
125  'Listgrouprights' => \SpecialListGroupRights::class,
126  'Listgrants' => \SpecialListGrants::class,
127  'Listusers' => \SpecialListUsers::class,
128  'Listadmins' => \SpecialListAdmins::class,
129  'Listbots' => \SpecialListBots::class,
130  'Userrights' => \UserrightsPage::class,
131  'EditWatchlist' => \SpecialEditWatchlist::class,
132  'PasswordPolicies' => \SpecialPasswordPolicies::class,
133 
134  // Recent changes and logs
135  'Newimages' => \SpecialNewFiles::class,
136  'Log' => \SpecialLog::class,
137  'Watchlist' => \SpecialWatchlist::class,
138  'Newpages' => \SpecialNewpages::class,
139  'Recentchanges' => \SpecialRecentChanges::class,
140  'Recentchangeslinked' => \SpecialRecentChangesLinked::class,
141  'Tags' => \SpecialTags::class,
142 
143  // Media reports and uploads
144  'Listfiles' => \SpecialListFiles::class,
145  'Filepath' => \SpecialFilepath::class,
146  'MediaStatistics' => \MediaStatisticsPage::class,
147  'MIMEsearch' => \MIMEsearchPage::class,
148  'FileDuplicateSearch' => \FileDuplicateSearchPage::class,
149  'Upload' => \SpecialUpload::class,
150  'UploadStash' => \SpecialUploadStash::class,
151  'ListDuplicatedFiles' => \ListDuplicatedFilesPage::class,
152 
153  // Data and tools
154  'ApiSandbox' => \SpecialApiSandbox::class,
155  'Statistics' => \SpecialStatistics::class,
156  'Allmessages' => \SpecialAllMessages::class,
157  'Version' => \SpecialVersion::class,
158  'Lockdb' => \SpecialLockdb::class,
159  'Unlockdb' => \SpecialUnlockdb::class,
160 
161  // Redirecting special pages
162  'LinkSearch' => \LinkSearchPage::class,
163  'Randompage' => \RandomPage::class,
164  'RandomInCategory' => \SpecialRandomInCategory::class,
165  'Randomredirect' => \SpecialRandomredirect::class,
166  'Randomrootpage' => \SpecialRandomrootpage::class,
167  'GoToInterwiki' => \SpecialGoToInterwiki::class,
168 
169  // High use pages
170  'Mostlinkedcategories' => \MostlinkedCategoriesPage::class,
171  'Mostimages' => \MostimagesPage::class,
172  'Mostinterwikis' => \MostinterwikisPage::class,
173  'Mostlinked' => \MostlinkedPage::class,
174  'Mostlinkedtemplates' => \MostlinkedTemplatesPage::class,
175  'Mostcategories' => \MostcategoriesPage::class,
176  'Mostrevisions' => \MostrevisionsPage::class,
177 
178  // Page tools
179  'ComparePages' => \SpecialComparePages::class,
180  'Export' => \SpecialExport::class,
181  'Import' => \SpecialImport::class,
182  'Undelete' => \SpecialUndelete::class,
183  'Whatlinkshere' => \SpecialWhatLinksHere::class,
184  'MergeHistory' => \SpecialMergeHistory::class,
185  'ExpandTemplates' => \SpecialExpandTemplates::class,
186 
187  // Other
188  'Booksources' => \SpecialBookSources::class,
189 
190  // Unlisted / redirects
191  'ApiHelp' => \SpecialApiHelp::class,
192  'Blankpage' => \SpecialBlankpage::class,
193  'Diff' => \SpecialDiff::class,
194  'EditTags' => \SpecialEditTags::class,
195  'Emailuser' => \SpecialEmailUser::class,
196  'Movepage' => \MovePageForm::class,
197  'Mycontributions' => \SpecialMycontributions::class,
198  'MyLanguage' => \SpecialMyLanguage::class,
199  'Mypage' => \SpecialMypage::class,
200  'Mytalk' => \SpecialMytalk::class,
201  'Myuploads' => \SpecialMyuploads::class,
202  'AllMyUploads' => \SpecialAllMyUploads::class,
203  'PermanentLink' => \SpecialPermanentLink::class,
204  'Redirect' => \SpecialRedirect::class,
205  'Revisiondelete' => \SpecialRevisionDelete::class,
206  'RunJobs' => \SpecialRunJobs::class,
207  'Specialpages' => \SpecialSpecialpages::class,
208  'PageData' => \SpecialPageData::class,
209  ];
210 
212  private $list;
213 
215  private $aliases;
216 
218  private $config;
219 
221  private $contLang;
222 
228  $this->config = $config;
229  $this->contLang = $contLang;
230  }
231 
238  public function getNames() : array {
239  return array_keys( $this->getPageList() );
240  }
241 
247  private function getPageList() : array {
248  if ( !is_array( $this->list ) ) {
249  $this->list = self::$coreList;
250 
251  if ( !$this->config->get( 'DisableInternalSearch' ) ) {
252  $this->list['Search'] = \SpecialSearch::class;
253  }
254 
255  if ( $this->config->get( 'EmailAuthentication' ) ) {
256  $this->list['Confirmemail'] = \EmailConfirmation::class;
257  $this->list['Invalidateemail'] = \EmailInvalidation::class;
258  }
259 
260  if ( $this->config->get( 'EnableEmail' ) ) {
261  $this->list['ChangeEmail'] = \SpecialChangeEmail::class;
262  }
263 
264  if ( $this->config->get( 'EnableJavaScriptTest' ) ) {
265  $this->list['JavaScriptTest'] = \SpecialJavaScriptTest::class;
266  }
267 
268  if ( $this->config->get( 'PageLanguageUseDB' ) ) {
269  $this->list['PageLanguage'] = \SpecialPageLanguage::class;
270  }
271  if ( $this->config->get( 'ContentHandlerUseDB' ) ) {
272  $this->list['ChangeContentModel'] = \SpecialChangeContentModel::class;
273  }
274 
275  // Add extension special pages
276  $this->list = array_merge( $this->list, $this->config->get( 'SpecialPages' ) );
277 
278  // This hook can be used to disable unwanted core special pages
279  // or conditionally register special pages.
280  Hooks::run( 'SpecialPage_initList', [ &$this->list ] );
281 
282  }
283 
284  return $this->list;
285  }
286 
293  private function getAliasList() : array {
294  if ( is_null( $this->aliases ) ) {
295  $aliases = $this->contLang->getSpecialPageAliases();
296  $pageList = $this->getPageList();
297 
298  $this->aliases = [];
299  $keepAlias = [];
300 
301  // Force every canonical name to be an alias for itself.
302  foreach ( $pageList as $name => $stuff ) {
303  $caseFoldedAlias = $this->contLang->caseFold( $name );
304  $this->aliases[$caseFoldedAlias] = $name;
305  $keepAlias[$caseFoldedAlias] = 'canonical';
306  }
307 
308  // Check for $aliases being an array since Language::getSpecialPageAliases can return null
309  if ( is_array( $aliases ) ) {
310  foreach ( $aliases as $realName => $aliasList ) {
311  $aliasList = array_values( $aliasList );
312  foreach ( $aliasList as $i => $alias ) {
313  $caseFoldedAlias = $this->contLang->caseFold( $alias );
314 
315  if ( isset( $this->aliases[$caseFoldedAlias] ) &&
316  $realName === $this->aliases[$caseFoldedAlias]
317  ) {
318  // Ignore same-realName conflicts
319  continue;
320  }
321 
322  if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
323  $this->aliases[$caseFoldedAlias] = $realName;
324  if ( !$i ) {
325  $keepAlias[$caseFoldedAlias] = 'first';
326  }
327  } elseif ( !$i ) {
328  wfWarn( "First alias '$alias' for $realName conflicts with " .
329  "{$keepAlias[$caseFoldedAlias]} alias for " .
330  $this->aliases[$caseFoldedAlias]
331  );
332  }
333  }
334  }
335  }
336  }
337 
338  return $this->aliases;
339  }
340 
349  public function resolveAlias( $alias ) {
350  $bits = explode( '/', $alias, 2 );
351 
352  $caseFoldedAlias = $this->contLang->caseFold( $bits[0] );
353  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
354  $aliases = $this->getAliasList();
355  if ( isset( $aliases[$caseFoldedAlias] ) ) {
356  $name = $aliases[$caseFoldedAlias];
357  } else {
358  return [ null, null ];
359  }
360 
361  if ( !isset( $bits[1] ) ) { // T4087
362  $par = null;
363  } else {
364  $par = $bits[1];
365  }
366 
367  return [ $name, $par ];
368  }
369 
376  public function exists( $name ) {
377  list( $title, /*...*/ ) = $this->resolveAlias( $name );
378 
379  $specialPageList = $this->getPageList();
380  return isset( $specialPageList[$title] );
381  }
382 
389  public function getPage( $name ) {
390  list( $realName, /*...*/ ) = $this->resolveAlias( $name );
391 
392  $specialPageList = $this->getPageList();
393 
394  if ( isset( $specialPageList[$realName] ) ) {
395  $rec = $specialPageList[$realName];
396 
397  if ( is_callable( $rec ) ) {
398  // Use callback to instantiate the special page
399  $page = $rec();
400  } elseif ( is_string( $rec ) ) {
401  $className = $rec;
402  $page = new $className;
403  } elseif ( $rec instanceof SpecialPage ) {
404  $page = $rec; // XXX: we should deep clone here
405  } else {
406  $page = null;
407  }
408 
409  if ( $page instanceof SpecialPage ) {
410  return $page;
411  }
412 
413  // It's not a classname, nor a callback, nor a legacy constructor array,
414  // nor a special page object. Give up.
415  wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
416  }
417 
418  return null;
419  }
420 
429  public function getUsablePages( User $user ) : array {
430  $pages = [];
431  foreach ( $this->getPageList() as $name => $rec ) {
432  $page = $this->getPage( $name );
433  if ( $page ) { // not null
434  $page->setContext( RequestContext::getMain() );
435  if ( $page->isListed()
436  && ( !$page->isRestricted() || $page->userCanExecute( $user ) )
437  ) {
438  $pages[$name] = $page;
439  }
440  }
441  }
442 
443  return $pages;
444  }
445 
451  public function getRegularPages() : array {
452  $pages = [];
453  foreach ( $this->getPageList() as $name => $rec ) {
454  $page = $this->getPage( $name );
455  if ( $page && $page->isListed() && !$page->isRestricted() ) {
456  $pages[$name] = $page;
457  }
458  }
459 
460  return $pages;
461  }
462 
470  public function getRestrictedPages( User $user ) : array {
471  $pages = [];
472  foreach ( $this->getPageList() as $name => $rec ) {
473  $page = $this->getPage( $name );
474  if ( $page
475  && $page->isListed()
476  && $page->isRestricted()
477  && $page->userCanExecute( $user )
478  ) {
479  $pages[$name] = $page;
480  }
481  }
482 
483  return $pages;
484  }
485 
501  public function executePath( Title &$title, IContextSource &$context, $including = false,
503  ) {
504  // @todo FIXME: Redirects broken due to this call
505  $bits = explode( '/', $title->getDBkey(), 2 );
506  $name = $bits[0];
507  if ( !isset( $bits[1] ) ) { // T4087
508  $par = null;
509  } else {
510  $par = $bits[1];
511  }
512 
513  $page = $this->getPage( $name );
514  if ( !$page ) {
515  $context->getOutput()->setArticleRelated( false );
516  $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
517 
518  global $wgSend404Code;
519  if ( $wgSend404Code ) {
520  $context->getOutput()->setStatusCode( 404 );
521  }
522 
523  $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
524 
525  return false;
526  }
527 
528  if ( !$including ) {
529  // Narrow DB query expectations for this HTTP request
530  $trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
531  $trxProfiler = Profiler::instance()->getTransactionProfiler();
532  if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
533  $trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
534  $context->getRequest()->markAsSafeRequest();
535  }
536  }
537 
538  // Page exists, set the context
539  $page->setContext( $context );
540 
541  if ( !$including ) {
542  // Redirect to canonical alias for GET commands
543  // Not for POST, we'd lose the post data, so it's best to just distribute
544  // the request. Such POST requests are possible for old extensions that
545  // generate self-links without being aware that their default name has
546  // changed.
547  if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
548  $query = $context->getRequest()->getQueryValues();
549  unset( $query['title'] );
550  $title = $page->getPageTitle( $par );
551  $url = $title->getFullURL( $query );
552  $context->getOutput()->redirect( $url );
553 
554  return $title;
555  }
556 
557  $context->setTitle( $page->getPageTitle( $par ) );
558  } elseif ( !$page->isIncludable() ) {
559  return false;
560  }
561 
562  $page->including( $including );
563  if ( $linkRenderer ) {
564  $page->setLinkRenderer( $linkRenderer );
565  }
566 
567  // Execute special page
568  $page->run( $par );
569 
570  return true;
571  }
572 
588  public function capturePath(
590  ) {
591  global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
592  $main = RequestContext::getMain();
593 
594  // Save current globals and main context
595  $glob = [
596  'title' => $wgTitle,
597  'output' => $wgOut,
598  'request' => $wgRequest,
599  'user' => $wgUser,
600  'language' => $wgLang,
601  ];
602  $ctx = [
603  'title' => $main->getTitle(),
604  'output' => $main->getOutput(),
605  'request' => $main->getRequest(),
606  'user' => $main->getUser(),
607  'language' => $main->getLanguage(),
608  ];
609 
610  // Override
611  $wgTitle = $title;
614  $wgUser = $context->getUser();
616  $main->setTitle( $title );
617  $main->setOutput( $context->getOutput() );
618  $main->setRequest( $context->getRequest() );
619  $main->setUser( $context->getUser() );
620  $main->setLanguage( $context->getLanguage() );
621 
622  // The useful part
623  $ret = $this->executePath( $title, $context, true, $linkRenderer );
624 
625  // Restore old globals and context
626  $wgTitle = $glob['title'];
627  $wgOut = $glob['output'];
628  $wgRequest = $glob['request'];
629  $wgUser = $glob['user'];
630  $wgLang = $glob['language'];
631  $main->setTitle( $ctx['title'] );
632  $main->setOutput( $ctx['output'] );
633  $main->setRequest( $ctx['request'] );
634  $main->setUser( $ctx['user'] );
635  $main->setLanguage( $ctx['language'] );
636 
637  return $ret;
638  }
639 
647  public function getLocalNameFor( $name, $subpage = false ) {
648  $aliases = $this->contLang->getSpecialPageAliases();
649  $aliasList = $this->getAliasList();
650 
651  // Find the first alias that maps back to $name
652  if ( isset( $aliases[$name] ) ) {
653  $found = false;
654  foreach ( $aliases[$name] as $alias ) {
655  $caseFoldedAlias = $this->contLang->caseFold( $alias );
656  $caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
657  if ( isset( $aliasList[$caseFoldedAlias] ) &&
658  $aliasList[$caseFoldedAlias] === $name
659  ) {
660  $name = $alias;
661  $found = true;
662  break;
663  }
664  }
665  if ( !$found ) {
666  wfWarn( "Did not find a usable alias for special page '$name'. " .
667  "It seems all defined aliases conflict?" );
668  }
669  } else {
670  // Check if someone misspelled the correct casing
671  if ( is_array( $aliases ) ) {
672  foreach ( $aliases as $n => $values ) {
673  if ( strcasecmp( $name, $n ) === 0 ) {
674  wfWarn( "Found alias defined for $n when searching for " .
675  "special page aliases for $name. Case mismatch?" );
676  return $this->getLocalNameFor( $n, $subpage );
677  }
678  }
679  }
680 
681  wfWarn( "Did not find alias for special page '$name'. " .
682  "Perhaps no aliases are defined for it?" );
683  }
684 
685  if ( $subpage !== false && !is_null( $subpage ) ) {
686  // Make sure it's in dbkey form
687  $subpage = str_replace( ' ', '_', $subpage );
688  $name = "$name/$subpage";
689  }
690 
691  return $this->contLang->ucfirst( $name );
692  }
693 
700  public function getTitleForAlias( $alias ) {
701  list( $name, $subpage ) = $this->resolveAlias( $alias );
702  if ( $name != null ) {
703  return SpecialPage::getTitleFor( $name, $subpage );
704  }
705 
706  return null;
707  }
708 }
$wgSend404Code
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
Definition: DefaultSettings.php:3534
$user
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 account $user
Definition: hooks.txt:244
MediaWiki\Special\SpecialPageFactory\getAliasList
getAliasList()
Initialise and return the list of special page aliases.
Definition: SpecialPageFactory.php:293
MediaWiki\Special\SpecialPageFactory\__construct
__construct(Config $config, Language $contLang)
Definition: SpecialPageFactory.php:227
MediaWiki\Special
Definition: SpecialPageFactory.php:25
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:62
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:41
MediaWiki\Special\SpecialPageFactory\getRegularPages
getRegularPages()
Return categorised listable special pages for all users.
Definition: SpecialPageFactory.php:451
MediaWiki\Special\SpecialPageFactory\getNames
getNames()
Returns a list of canonical special page names.
Definition: SpecialPageFactory.php:238
MediaWiki\Special\SpecialPageFactory\$config
Config $config
Definition: SpecialPageFactory.php:218
$linkRenderer
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:2036
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:82
MediaWiki\Special\SpecialPageFactory\getPageList
getPageList()
Get the special page list as an array.
Definition: SpecialPageFactory.php:247
wfLogWarning
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
Definition: GlobalFunctions.php:1145
$wgTitle
if(! $wgRequest->checkUrlExtension()) if(isset( $_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] !='') $wgTitle
Definition: api.php:57
MediaWiki\Special\SpecialPageFactory\getUsablePages
getUsablePages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:429
User
User
Definition: All_system_messages.txt:425
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
$query
null for the 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:1627
Config
Interface for configuration instances.
Definition: Config.php:28
MediaWiki\Special\SpecialPageFactory\getTitleForAlias
getTitleForAlias( $alias)
Get a title for a given alias.
Definition: SpecialPageFactory.php:700
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:964
MediaWiki\Special\SpecialPageFactory\$list
array $list
Special page name => class name.
Definition: SpecialPageFactory.php:212
Profiler
Profiler base class that defines the interface and some trivial functionality.
Definition: Profiler.php:33
$wgLang
$wgLang
Definition: Setup.php:902
MediaWiki\Special\SpecialPageFactory\executePath
executePath(Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null)
Execute a special page path.
Definition: SpecialPageFactory.php:501
MediaWiki\Special\SpecialPageFactory\getLocalNameFor
getLocalNameFor( $name, $subpage=false)
Get the local name for a specified canonical name.
Definition: SpecialPageFactory.php:647
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
RequestContext
Group all the pieces relevant to the context of a request into one instance.
Definition: RequestContext.php:32
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))
list
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
MediaWiki\Special\SpecialPageFactory\$contLang
Language $contLang
Definition: SpecialPageFactory.php:221
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
MediaWiki\Special\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:63
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:36
MediaWiki\Special\SpecialPageFactory\getRestrictedPages
getRestrictedPages(User $user)
Return categorised listable special pages which are available for the current user,...
Definition: SpecialPageFactory.php:470
$ret
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:2036
IContextSource\getUser
getUser()
MediaWiki\Special\SpecialPageFactory\getPage
getPage( $name)
Find the object with a given name and return it (or NULL)
Definition: SpecialPageFactory.php:389
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:432
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:53
Title
Represents a title within MediaWiki.
Definition: Title.php:39
MediaWiki\Special\SpecialPageFactory\resolveAlias
resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
Definition: SpecialPageFactory.php:349
IContextSource\getConfig
getConfig()
Get the site configuration.
as
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
MediaWiki\Special\SpecialPageFactory\capturePath
capturePath(Title $title, IContextSource $context, LinkRenderer $linkRenderer=null)
Just like executePath() but will override global variables and execute the page in "inclusion" mode.
Definition: SpecialPageFactory.php:588
IContextSource\getRequest
getRequest()
wfWarn
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Definition: GlobalFunctions.php:1132
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:747
MediaWiki\$context
IContextSource $context
Definition: MediaWiki.php:38
$wgOut
$wgOut
Definition: Setup.php:907
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:47
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
IContextSource\getOutput
getOutput()
MediaWiki\Special\SpecialPageFactory\$coreList
static $coreList
List of special page names to the subclass of SpecialPage which handles them.
Definition: SpecialPageFactory.php:69
MediaWiki\Special\SpecialPageFactory\$aliases
array $aliases
Definition: SpecialPageFactory.php:215
Language
Internationalisation code.
Definition: Language.php:35
MediaWiki\Special\SpecialPageFactory\exists
exists( $name)
Check if a given name exist as a special page or as a special page alias.
Definition: SpecialPageFactory.php:376
Hooks
Hooks class.
Definition: Hooks.php:34
IContextSource\getLanguage
getLanguage()