25 use Wikimedia\ObjectFactory;
202 self::$aliases =
null;
212 return array_keys( self::getPageList() );
226 if ( !is_array( self::$list ) ) {
258 Hooks::run(
'SpecialPage_initList', [ &self::$list ] );
272 if ( is_null( self::$aliases ) ) {
281 foreach ( $pageList
as $name => $stuff ) {
283 self::$aliases[$caseFoldedAlias] =
$name;
284 $keepAlias[$caseFoldedAlias] =
'canonical';
289 foreach (
$aliases as $realName => $aliasList ) {
290 $aliasList = array_values( $aliasList );
291 foreach ( $aliasList
as $i => $alias ) {
292 $caseFoldedAlias =
$wgContLang->caseFold( $alias );
294 if ( isset( self::$aliases[$caseFoldedAlias] ) &&
295 $realName === self::$aliases[$caseFoldedAlias]
301 if ( !isset( $keepAlias[$caseFoldedAlias] ) ) {
302 self::$aliases[$caseFoldedAlias] = $realName;
304 $keepAlias[$caseFoldedAlias] =
'first';
307 wfWarn(
"First alias '$alias' for $realName conflicts with " .
308 "{$keepAlias[$caseFoldedAlias]} alias for " .
309 self::$aliases[$caseFoldedAlias]
330 $bits = explode(
'/', $alias, 2 );
332 $caseFoldedAlias =
$wgContLang->caseFold( $bits[0] );
333 $caseFoldedAlias = str_replace(
' ',
'_', $caseFoldedAlias );
335 if ( isset(
$aliases[$caseFoldedAlias] ) ) {
338 return [
null, null ];
341 if ( !isset( $bits[1] ) ) {
347 return [
$name, $par ];
360 return isset( $specialPageList[
$title] );
374 if ( isset( $specialPageList[$realName] ) ) {
375 $rec = $specialPageList[$realName];
377 if ( is_callable( $rec ) ) {
379 $page = call_user_func( $rec );
380 } elseif ( is_string( $rec ) ) {
382 $page =
new $className;
383 } elseif ( is_array( $rec ) ) {
384 $className = array_shift( $rec );
386 wfDeprecated(
"Array syntax for \$wgSpecialPages is deprecated ($className), " .
387 "define a subclass of SpecialPage instead.",
'1.18' );
388 $page = ObjectFactory::getObjectFromSpec( [
389 'class' => $className,
391 'closure_expansion' =>
false,
404 wfLogWarning(
"Cannot instantiate special page $realName: bad spec!" );
423 if (
$user ===
null ) {
427 foreach ( self::getPageList()
as $name => $rec ) {
431 if ( $page->isListed()
432 && ( !$page->isRestricted() || $page->userCanExecute(
$user ) )
434 $pages[
$name] = $page;
449 foreach ( self::getPageList()
as $name => $rec ) {
451 if ( $page && $page->isListed() && !$page->isRestricted() ) {
452 $pages[
$name] = $page;
468 if (
$user ===
null ) {
472 foreach ( self::getPageList()
as $name => $rec ) {
476 && $page->isRestricted()
477 && $page->userCanExecute(
$user )
479 $pages[
$name] = $page;
505 $bits = explode(
'/',
$title->getDBkey(), 2 );
507 if ( !isset( $bits[1] ) ) {
515 $context->getOutput()->setArticleRelated(
false );
516 $context->getOutput()->setRobotPolicy(
'noindex,nofollow' );
520 $context->getOutput()->setStatusCode( 404 );
523 $context->getOutput()->showErrorPage(
'nosuchspecialpage',
'nospecialpagetext' );
530 $trxLimits =
$context->getConfig()->get(
'TrxProfilerLimits' );
532 if (
$context->getRequest()->wasPosted() && !$page->doesWrites() ) {
533 $trxProfiler->setExpectations( $trxLimits[
'POST-nonwrite'], __METHOD__ );
534 $context->getRequest()->markAsSafeRequest();
547 if (
$name != $page->getLocalName() && !
$context->getRequest()->wasPosted() ) {
550 $title = $page->getPageTitle( $par );
552 $context->getOutput()->redirect( $url );
556 $context->setTitle( $page->getPageTitle( $par ) );
558 } elseif ( !$page->isIncludable() ) {
562 $page->including( $including );
603 'title' => $main->getTitle(),
604 'output' => $main->getOutput(),
605 'request' => $main->getRequest(),
606 'user' => $main->getUser(),
607 'language' => $main->getLanguage(),
616 $main->setTitle(
$title );
617 $main->setOutput(
$context->getOutput() );
618 $main->setRequest(
$context->getRequest() );
619 $main->setUser(
$context->getUser() );
620 $main->setLanguage(
$context->getLanguage() );
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'] );
656 $caseFoldedAlias =
$wgContLang->caseFold( $alias );
657 $caseFoldedAlias = str_replace(
' ',
'_', $caseFoldedAlias );
658 if ( isset( $aliasList[$caseFoldedAlias] ) &&
659 $aliasList[$caseFoldedAlias] ===
$name
667 wfWarn(
"Did not find a usable alias for special page '$name'. " .
668 "It seems all defined aliases conflict?" );
674 if ( strcasecmp(
$name, $n ) === 0 ) {
675 wfWarn(
"Found alias defined for $n when searching for " .
676 "special page aliases for $name. Case mismatch?" );
682 wfWarn(
"Did not find alias for special page '$name'. " .
683 "Perhaps no aliases are defined for it?" );
686 if ( $subpage !==
false && !is_null( $subpage ) ) {
688 $subpage = str_replace(
' ',
'_', $subpage );
689 $name =
"$name/$subpage";
703 if (
$name !=
null ) {
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
$wgEnableJavaScriptTest
Allow running of javascript test suites via [[Special:JavaScriptTest]] (such as QUnit).
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
$wgDisableInternalSearch
Disable the internal MySQL-based search, to allow it to be implemented by an extension instead.
$wgEmailAuthentication
Require email authentication before sending mail to an email address.
$wgContentHandlerUseDB
Set to false to disable use of the database fields introduced by the ContentHandler facility.
$wgSpecialPages
Special page list.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
if(! $wgDBerrorLogTZ) $wgRequest
if(! $wgRequest->checkUrlExtension()) if(isset( $_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] !='') if(! $wgEnableAPI) $wgTitle
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
static instance()
Singleton.
static getMain()
Get the RequestContext object associated with the main request.
Factory for handling the special page list and generating SpecialPage objects.
static getRegularPages()
Return categorised listable special pages for all users.
static capturePath(Title $title, IContextSource $context, LinkRenderer $linkRenderer=null)
Just like executePath() but will override global variables and execute the page in "inclusion" mode.
static $coreList
List of special page names to the subclass of SpecialPage which handles them.
static getPageList()
Get the special page list as an array.
static getLocalNameFor( $name, $subpage=false)
Get the local name for a specified canonical name.
static exists( $name)
Check if a given name exist as a special page or as a special page alias.
static executePath(Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null)
Execute a special page path.
static getTitleForAlias( $alias)
Get a title for a given alias.
static getUsablePages(User $user=null)
Return categorised listable special pages which are available for the current user,...
static getPage( $name)
Find the object with a given name and return it (or NULL)
static resetList()
Reset the internal list of special pages.
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,...
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
Parent class for all special pages.
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,...
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
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
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 content language as $wgContLang
when a variable name is used in a it is silently declared as a new masking the global
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
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
namespace and then decline to actually register it file or subcat img or subcat $title
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
Allows to change the fields on the form that will be generated $name
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
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
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
The MIT 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
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
Interface for objects which can provide a MediaWiki context on request.
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