Go to the documentation of this file.
127 'envCheckModSecurity',
133 'envCheckShellLocale',
134 'envCheckUploadsDirectory',
136 'envCheckSuhosinMaxValueLength',
167 'wgEmailAuthentication',
171 'wgImageMagickConvertCommand',
176 'wgDeletedDirectory',
180 'wgUseInstantCommons',
195 '_Environment' =>
false,
196 '_RaiseMemory' =>
false,
197 '_UpgradeDone' =>
false,
198 '_InstallDone' =>
false,
200 '_InstallPassword' =>
'',
201 '_SameAccount' =>
true,
202 '_CreateDBAccount' =>
false,
203 '_NamespaceType' =>
'site-name',
205 '_AdminPassword' =>
'',
206 '_AdminPasswordConfirm' =>
'',
208 '_Subscribe' =>
false,
209 '_SkipOptional' =>
'continue',
210 '_RightsProfile' =>
'wiki',
211 '_LicenseCode' =>
'none',
215 '_MemCachedServers' =>
'',
216 '_UpgradeKeySupplied' =>
false,
217 '_ExistingDBSettings' =>
false,
221 'wgLogo' =>
'$wgResourceBasePath/resources/assets/wiki.png',
222 'wgAuthenticationTokenVersion' => 1,
245 'xcache' =>
'xcache_get',
246 'apc' =>
'apc_fetch',
247 'apcu' =>
'apcu_fetch',
248 'wincache' =>
'wincache_ucache_get'
259 '*' => [
'edit' =>
false ]
263 'createaccount' =>
false,
269 'createaccount' =>
false,
283 'url' =>
'https://creativecommons.org/licenses/by/4.0/',
284 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by.png',
287 'url' =>
'https://creativecommons.org/licenses/by-sa/4.0/',
288 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png',
291 'url' =>
'https://creativecommons.org/licenses/by-nc-sa/4.0/',
292 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-nc-sa.png',
295 'url' =>
'https://creativecommons.org/publicdomain/zero/1.0/',
296 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-0.png',
299 'url' =>
'https://www.gnu.org/copyleft/fdl.html',
300 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/gnu-fdl.png',
319 'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
325 'ca',
'cs',
'da',
'de',
'en',
'es',
'et',
'eu',
'fi',
'fr',
'hr',
'hu',
326 'it',
'ja',
'ko',
'lt',
'nl',
'no',
'pl',
'pt',
'pt-br',
'ro',
'ru',
327 'sl',
'sr',
'sv',
'tr',
'uk'
343 abstract public function showError( $msg );
366 $emptyCache = [
'class' =>
'EmptyBagOStuff' ];
373 ] + $baseConfig->get(
'ObjectCaches' );
378 $messageDirs = $baseConfig->get(
'MessagesDirs' );
379 $messageDirs[
'MediawikiInstaller'] = __DIR__ .
'/i18n';
381 $configOverrides->set(
'MessagesDirs', $messageDirs );
383 $installerConfig =
new MultiConfig( [ $configOverrides, $baseConfig ] );
386 $configRegistry = $baseConfig->get(
'ConfigRegistry' );
387 $configRegistry[
'main'] =
function()
use ( $installerConfig ) {
388 return $installerConfig;
391 $configOverrides->set(
'ConfigRegistry', $configRegistry );
393 return $installerConfig;
421 $wgObjectCaches = MediaWikiServices::getInstance()->getMainConfig()->get(
'ObjectCaches' );
430 foreach ( $this->defaultVarNames
as $var ) {
436 $this->compiledDBs = [];
437 foreach ( self::getDBTypes()
as $type ) {
440 if ( !$installer->isCompiled() ) {
443 $this->compiledDBs[] =
$type;
448 $this->parserOptions->setEditSection(
false );
479 $this->
showMessage(
'config-env-hhvm', HHVM_VERSION );
481 $this->
showMessage(
'config-env-php', PHP_VERSION );
486 list( $pcreVersion ) = explode(
' ', PCRE_VERSION, 2 );
487 if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION,
'<' ) ) {
488 $this->
showError(
'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
491 foreach ( $this->envChecks
as $check ) {
499 $this->
setVar(
'_Environment', $good );
505 foreach ( $this->envPreps
as $prep ) {
561 if ( !isset( $this->dbInstallers[
$type] ) ) {
562 $class = ucfirst(
$type ) .
'Installer';
563 $this->dbInstallers[
$type] =
new $class( $this );
566 return $this->dbInstallers[
$type];
591 MediaWiki\suppressWarnings();
592 $_lsExists = file_exists(
"$IP/LocalSettings.php" );
593 MediaWiki\restoreWarnings();
600 require
"$IP/includes/DefaultSettings.php";
601 require
"$IP/LocalSettings.php";
603 return get_defined_vars();
616 return str_repeat(
'*', strlen( $realPassword ) );
627 if ( !preg_match(
'/^\*+$/',
$value ) ) {
644 if ( !function_exists(
'posix_getegid' ) || !function_exists(
'posix_getpwuid' ) ) {
645 # I don't know this, this isn't UNIX.
649 # posix_getegid() *not* getmygid() because we want the group of the webserver,
650 # not whoever owns the current script.
651 $gid = posix_getegid();
652 $group = posix_getpwuid( $gid )[
'name'];
673 public function parse( $text, $lineStart =
false ) {
677 $out =
$wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
679 }
catch (
MediaWiki\Services\ServiceDisabledException
$e ) {
680 $html =
'<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
682 if ( !empty( $this->debug ) ) {
683 $html .=
"<!--\n" .
$e->getTraceAsString() .
"\n-->";
698 $this->parserOptions->setExternalLinkTarget(
false );
702 global $wgExternalLinkTarget;
703 $this->parserOptions->setExternalLinkTarget( $wgExternalLinkTarget );
723 'ss_total_edits' => 0,
724 'ss_good_articles' => 0,
725 'ss_total_pages' => 0,
727 'ss_active_users' => 0,
747 foreach ( self::getDBTypes()
as $name ) {
748 $allNames[] =
wfMessage(
"config-type-$name" )->text();
753 $databases = array_flip( $databases );
754 foreach ( array_keys( $databases )
as $db ) {
756 $status = $installer->checkPrerequisites();
761 unset( $databases[$db] );
764 $databases = array_flip( $databases );
766 $this->
showError(
'config-no-db', $wgLang->commaList( $allNames ),
count( $allNames ) );
782 $this->
showError(
'config-brokenlibxml' );
799 MediaWiki\suppressWarnings();
800 $regexd = preg_replace(
'/[\x{0430}-\x{04FF}]/iu',
'',
'-АБВГД-' );
805 $regexprop = preg_replace(
'/\p{Zs}/u',
'',
"-\xE3\x80\x80-" );
806 MediaWiki\restoreWarnings();
807 if ( $regexd !=
'--' || $regexprop !=
'--' ) {
808 $this->
showError(
'config-pcre-no-utf8' );
821 $limit = ini_get(
'memory_limit' );
829 if ( $n < $this->minMemorySize * 1024 * 1024 ) {
830 $newLimit =
"{$this->minMemorySize}M";
832 if ( ini_set(
"memory_limit", $newLimit ) ===
false ) {
836 $this->
setVar(
'_RaiseMemory',
true );
848 foreach ( $this->objectCaches
as $name => $function ) {
849 if ( function_exists( $function ) ) {
853 $caches[
$name] =
true;
858 $key =
'config-no-cache-apcu';
862 $this->
setVar(
'_Caches', $caches );
870 if ( self::apacheModulePresent(
'mod_security' )
871 || self::apacheModulePresent(
'mod_security2' ) ) {
883 $names = [
"gdiff3",
"diff3",
"diff3.exe" ];
884 $versionInfo = [
'$1 --version 2>&1',
'GNU diffutils' ];
889 $this->
setVar(
'wgDiff3', $diff3 );
891 $this->
setVar(
'wgDiff3',
false );
903 $names = [
wfIsWindows() ?
'convert.exe' :
'convert' ];
904 $versionInfo = [
'$1 -version',
'ImageMagick' ];
907 $this->
setVar(
'wgImageMagickConvertCommand',
'' );
909 $this->
setVar(
'wgImageMagickConvertCommand', $convert );
910 $this->
showMessage(
'config-imagemagick', $convert );
913 } elseif ( function_exists(
'imagejpeg' ) ) {
930 $versionInfo = [
'$1 --version',
'git version' ];
935 $this->
setVar(
'wgGitBin', $git );
938 $this->
setVar(
'wgGitBin',
false );
952 if ( $server !==
null ) {
953 $this->
showMessage(
'config-using-server', $server );
966 $this->
getVar(
'wgServer' ),
967 $this->
getVar(
'wgScriptPath' )
977 $os = php_uname(
's' );
978 $supported = [
'Linux',
'SunOS',
'HP-UX',
'Darwin' ]; # Tested these
980 if ( !in_array( $os, $supported ) ) {
984 # Get a list of available locales.
993 $candidatesByLocale = [];
994 $candidatesByLang = [];
997 if (
$line ===
'' ) {
1001 if ( !preg_match(
'/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i',
$line, $m ) ) {
1007 $candidatesByLocale[$m[0]] = $m;
1008 $candidatesByLang[
$lang][] = $m;
1011 # Try the current value of LANG.
1012 if ( isset( $candidatesByLocale[getenv(
'LANG' )] ) ) {
1013 $this->
setVar(
'wgShellLocale', getenv(
'LANG' ) );
1018 # Try the most common ones.
1019 $commonLocales = [
'en_US.UTF-8',
'en_US.utf8',
'de_DE.UTF-8',
'de_DE.utf8' ];
1020 foreach ( $commonLocales
as $commonLocale ) {
1021 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
1022 $this->
setVar(
'wgShellLocale', $commonLocale );
1028 # Is there an available locale in the Wiki's language?
1029 $wikiLang = $this->
getVar(
'wgLanguageCode' );
1031 if ( isset( $candidatesByLang[$wikiLang] ) ) {
1032 $m = reset( $candidatesByLang[$wikiLang] );
1033 $this->
setVar(
'wgShellLocale', $m[0] );
1038 # Are there any at all?
1039 if (
count( $candidatesByLocale ) ) {
1040 $m = reset( $candidatesByLocale );
1041 $this->
setVar(
'wgShellLocale', $m[0] );
1058 $url = $this->
getVar(
'wgServer' ) . $this->
getVar(
'wgScriptPath' ) .
'/images/';
1074 $maxValueLength = ini_get(
'suhosin.get.max_value_length' );
1075 if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1077 $this->
showMessage(
'config-suhosin-max-value-length', $maxValueLength );
1092 } elseif ( $c <= 0x7FF ) {
1093 return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
1094 } elseif ( $c <= 0xFFFF ) {
1095 return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F ) .
1096 chr( 0x80 | $c & 0x3F );
1097 } elseif ( $c <= 0x10FFFF ) {
1098 return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F ) .
1099 chr( 0x80 | $c >> 6 & 0x3F ) .
1100 chr( 0x80 | $c & 0x3F );
1120 $useNormalizer =
'php';
1121 $needsUpdate =
false;
1123 if ( function_exists(
'normalizer_normalize' ) ) {
1124 $useNormalizer =
'intl';
1125 $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1126 if ( $intl !== $normal_c ) {
1127 $needsUpdate =
true;
1132 if ( $useNormalizer ===
'php' ) {
1133 $this->
showMessage(
'config-unicode-pure-php-warning' );
1135 $this->
showMessage(
'config-unicode-using-' . $useNormalizer );
1136 if ( $needsUpdate ) {
1137 $this->
showMessage(
'config-unicode-update-warning' );
1147 if ( $server !==
null ) {
1148 $this->
setVar(
'wgServer', $server );
1163 $IP = dirname( dirname( __DIR__ ) );
1164 $this->
setVar(
'IP', $IP );
1176 [
'/usr/bin',
'/usr/local/bin',
'/opt/csw/bin',
1177 '/usr/gnu/bin',
'/usr/sfw/bin',
'/sw/bin',
'/opt/local/bin' ],
1178 explode( PATH_SEPARATOR, getenv(
'PATH' ) )
1200 if ( !is_array( $names ) ) {
1201 $names = [ $names ];
1207 MediaWiki\suppressWarnings();
1208 $file_exists = is_executable(
$command );
1209 MediaWiki\restoreWarnings();
1211 if ( $file_exists ) {
1212 if ( !$versionInfo ) {
1217 if ( strstr(
wfShellExec( $file ), $versionInfo[1] ) !==
false ) {
1239 foreach ( self::getPossibleBinPaths()
as $path ) {
1241 if ( $exe !==
false ) {
1260 "<?php echo 'ex' . 'ec';",
1261 "#!/var/env php5\n<?php echo 'ex' . 'ec';",
1267 MediaWiki\suppressWarnings();
1269 foreach ( $scriptTypes
as $ext => $contents ) {
1271 $file =
'exectest.' .
$ext;
1273 if ( !file_put_contents(
$dir . $file,
$source ) ) {
1278 $text =
Http::get( $url . $file, [
'timeout' => 3 ], __METHOD__ );
1279 }
catch ( Exception
$e ) {
1283 unlink(
$dir . $file );
1285 if ( $text ==
'exec' ) {
1286 MediaWiki\restoreWarnings();
1293 MediaWiki\restoreWarnings();
1305 if ( function_exists(
'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1310 phpinfo( INFO_MODULES );
1311 $info = ob_get_clean();
1313 return strpos( $info, $moduleName ) !==
false;
1322 $this->parserOptions->setTargetLanguage(
$lang );
1323 $this->parserOptions->setUserLang(
$lang );
1332 return "{$_SERVER['PHP_SELF']}?page=" . urlencode(
$page );
1345 if ( $this->
getVar(
'IP' ) ===
null ) {
1349 $extDir = $this->
getVar(
'IP' ) .
'/' . $directory;
1350 if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1355 $jsonFile = substr( $directory, 0, strlen( $directory ) -1 ) .
'.json';
1357 $dh = opendir( $extDir );
1359 while ( ( $file = readdir( $dh ) ) !==
false ) {
1360 if ( !is_dir(
"$extDir/$file" ) ) {
1363 if ( file_exists(
"$extDir/$file/$jsonFile" ) || file_exists(
"$extDir/$file/$file.php" ) ) {
1368 natcasesort( $exts );
1382 $defaultSkin =
$GLOBALS[
'wgDefaultSkin'];
1383 if ( !$skinNames || in_array( $defaultSkin, $skinNames ) ) {
1384 return $defaultSkin;
1386 return $skinNames[0];
1397 $exts = $this->
getVar(
'_Extensions' );
1398 $IP = $this->
getVar(
'IP' );
1409 $wgAutoloadClasses = [];
1412 require
"$IP/includes/DefaultSettings.php";
1414 foreach ( $exts
as $e ) {
1415 if ( file_exists(
"$IP/extensions/$e/extension.json" ) ) {
1416 $queue[
"$IP/extensions/$e/extension.json"] = 1;
1418 require_once
"$IP/extensions/$e/$e.php";
1423 $data = $registry->readFromQueue(
$queue );
1426 $hooksWeWant = isset(
$wgHooks[
'LoadExtensionSchemaUpdates'] ) ?
1428 $wgHooks[
'LoadExtensionSchemaUpdates'] : [];
1430 if ( isset( $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
1431 $hooksWeWant = array_merge_recursive(
1433 $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates']
1438 $GLOBALS[
'wgHooks'] = [
'LoadExtensionSchemaUpdates' => $hooksWeWant ];
1456 $coreInstallSteps = [
1457 [
'name' =>
'database',
'callback' => [ $installer,
'setupDatabase' ] ],
1458 [
'name' =>
'tables',
'callback' => [ $installer,
'createTables' ] ],
1459 [
'name' =>
'interwiki',
'callback' => [ $installer,
'populateInterwikiTable' ] ],
1460 [
'name' =>
'stats',
'callback' => [ $this,
'populateSiteStats' ] ],
1461 [
'name' =>
'keys',
'callback' => [ $this,
'generateKeys' ] ],
1462 [
'name' =>
'updates',
'callback' => [ $installer,
'insertUpdateKeys' ] ],
1463 [
'name' =>
'sysop',
'callback' => [ $this,
'createSysop' ] ],
1464 [
'name' =>
'mainpage',
'callback' => [ $this,
'createMainpage' ] ],
1469 foreach ( $coreInstallSteps
as $step ) {
1470 $this->installSteps[] = $step;
1471 if ( isset( $this->extraInstallSteps[$step[
'name']] ) ) {
1472 $this->installSteps = array_merge(
1473 $this->installSteps,
1474 $this->extraInstallSteps[$step[
'name']]
1480 if ( isset( $this->extraInstallSteps[
'BEGINNING'] ) ) {
1481 $this->installSteps = array_merge(
1482 $this->extraInstallSteps[
'BEGINNING'],
1489 array_unshift( $this->installSteps,
1490 [
'name' =>
'extensions',
'callback' => [ $this,
'includeExtensions' ] ]
1492 $this->installSteps[] = [
1493 'name' =>
'extension-tables',
1494 'callback' => [ $installer,
'createExtensionTables' ]
1510 $installResults = [];
1512 $installer->preInstall();
1514 foreach ( $steps
as $stepObj ) {
1515 $name = $stepObj[
'name'];
1516 call_user_func_array( $startCB, [
$name ] );
1519 $status = call_user_func( $stepObj[
'callback'], $installer );
1532 $this->
setVar(
'_InstallDone',
true );
1535 return $installResults;
1544 $keys = [
'wgSecretKey' => 64 ];
1545 if ( strval( $this->
getVar(
'wgUpgradeKey' ) ) ===
'' ) {
1546 $keys[
'wgUpgradeKey'] = 16;
1573 $names = array_keys(
$keys );
1574 $names = preg_replace(
'/^(.*)$/',
'\$$1', $names );
1576 $status->warning(
'config-insecure-keys',
$wgLang->listToText( $names ),
count( $names ) );
1596 if (
$user->idForName() == 0 ) {
1597 $user->addToDatabase();
1600 $user->setPassword( $this->
getVar(
'_AdminPassword' ) );
1605 $user->addGroup(
'sysop' );
1606 $user->addGroup(
'bureaucrat' );
1607 if ( $this->
getVar(
'_AdminEmail' ) ) {
1608 $user->setEmail( $this->
getVar(
'_AdminEmail' ) );
1610 $user->saveSettings();
1614 $ssUpdate->doUpdate();
1618 if ( $this->
getVar(
'_Subscribe' ) && $this->
getVar(
'_AdminEmail' ) ) {
1630 'email' => $this->
getVar(
'_AdminEmail' ),
1637 $myLang = $this->
getVar(
'_UserLang' );
1638 if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1639 $myLang = $myLang ==
'pt-br' ?
'pt_BR' : $myLang;
1640 $params[
'language'] = $myLang;
1645 [
'method' =>
'POST',
'postData' =>
$params ], __METHOD__ )->execute();
1646 if ( !
$res->isOK() ) {
1647 $s->warning(
'config-install-subscribe-fail',
$res->getMessage() );
1650 $s->warning(
'config-install-subscribe-notpossible' );
1663 if (
$title->exists() ) {
1664 $status->warning(
'config-install-mainpage-exists' );
1670 wfMessage(
'mainpagetext' )->inContentLanguage()->
text() .
"\n\n" .
1671 wfMessage(
'mainpagedocfooter' )->inContentLanguage()->
text()
1680 }
catch ( Exception
$e ) {
1682 $status->fatal(
'config-install-mainpage-failed',
$e->getMessage() );
1694 define(
'MW_NO_SESSION_HANDLER', 1 );
1697 $GLOBALS[
'wgUseDatabaseMessages'] =
false;
1701 $GLOBALS[
'wgShowExceptionDetails'] =
true;
1703 $GLOBALS[
'wgExternalLinkTarget'] =
'_blank';
1706 $GLOBALS[
'wgShowSQLErrors'] =
true;
1707 $GLOBALS[
'wgShowDBErrorBacktrace'] =
true;
1710 $GLOBALS[
'wgDisableOutputCompression'] =
true;
1713 $GLOBALS[
'wgCookiePrefix'] =
'mw_installer';
1722 'class' =>
'InstallerSessionProvider',
1741 $this->extraInstallSteps[$findStep][] = $callback;
1749 MediaWiki\suppressWarnings();
1750 set_time_limit( 0 );
1751 MediaWiki\restoreWarnings();
envCheckBrokenXML()
Some versions of libxml+PHP break < and > encoding horribly.
Set options of the Parser.
static factory( $url, $options=null, $caller=__METHOD__)
Generate a new request object.
__construct()
Constructor, always call this from child classes.
static newFromId( $id)
Static factory method for creation from a given user ID.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
processing should stop and the error should be shown to the user * false
static wasStrong()
Return a boolean indicating whether or not the source used for cryptographic random bytes generation ...
createMainpage(DatabaseInstaller $installer)
Insert Main Page with default content.
showMessage( $msg)
UI interface for displaying a short message The parameters are like parameters to wfMessage().
parse( $text, $lineStart=false)
Convert wikitext $text to HTML.
Provides a fallback sequence for Config objects.
global $wgAutoloadClasses
if(!isset( $args[0])) $lang
A Config instance which stores all settings as a member variable.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
showStatusMessage(Status $status)
Show a message to the installing user by using a Status object.
dirIsExecutable( $dir, $url)
Checks if scripts located in the given directory can be executed via the given URL.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
envCheckLibicu()
Check the libicu version.
static newMainPage()
Create a new Title for the Main Page.
populateSiteStats(DatabaseInstaller $installer)
Install step which adds a row to the site_stats table with appropriate initial values.
array $extraInstallSteps
Extra steps for installation, for things like DatabaseInstallers to modify.
getConnection()
Connect to the database using the administrative user/password currently defined in the session.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
array $rightsProfiles
User rights profiles.
envCheckShellLocale()
Environment check for preferred locale in shell.
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
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
envCheckUploadsDirectory()
Environment check for the permissions of the uploads directory.
static newFatal( $message)
Factory function for fatal errors.
envPrepServer()
Environment prep for the server hostname.
performInstallation( $startCB, $endCB)
Actually perform the installation.
$mediaWikiAnnounceLanguages
Supported language codes for Mailman.
Show an error when any operation involving passwords fails to run.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static generateHex( $chars, $forceStrong=false)
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format.
Allows to change the fields on the form that will be generated $name
array $dbInstallers
Cached DB installer instances, access using getDBInstaller().
setParserLanguage( $lang)
ParserOptions are constructed before we determined the language, so fix it.
addInstallStep( $callback, $findStep='BEGINNING')
Add an installation step following the given step.
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 my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
array $internalDefaults
Variables that are stored alongside globals, and are used for any configuration of the installation p...
setPassword( $name, $value)
Set a variable which stores a password, except if the new value is a fake password in which case leav...
envGetDefaultServer()
Helper function to be called from envPrepServer()
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
setVar( $name, $value)
Set a MW configuration variable, or internal installer configuration variable.
Title $parserTitle
Cached Title, used by parse().
array $objectCaches
Known object cache types and the functions used to test for their existence.
static locateExecutableInDefaultPaths( $names, $versionInfo=false)
Same as locateExecutable(), but checks in getPossibleBinPaths() by default.
int $minMemorySize
Minimum memory size in MB.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
static overrideConfig()
Override the necessary bits of the config to run an installation.
createSysop()
Create the first user account, grant it sysop and bureaucrat rights.
getFakePassword( $realPassword)
Get a fake password for sending back to the user in HTML.
envCheckSuhosinMaxValueLength()
Checks if suhosin.get.max_value_length is set, and if so generate a warning because it decreases Reso...
static getLocalisationCache()
Get the LocalisationCache instance.
showError( $msg)
Same as showMessage(), but for displaying errors.
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 & $html
static getPossibleBinPaths()
Get an array of likely places we can find executables.
namespace and then decline to actually register it file or subcat img or subcat $title
envPrepPath()
Environment prep for setting $IP and $wgScriptPath.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
envCheckDiff3()
Search for GNU diff3.
generateKeys()
Generate $wgSecretKey.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
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
envCheckMemory()
Environment check for available memory.
$wgObjectCaches
Advanced object cache configuration.
getCompiledDBs()
Get a list of DBs supported by current PHP setup.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers please use GetContentModels hook to make them known to core if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
static getInstance( $id)
Get a cached instance of the specified type of cache object.
envCheckCache()
Environment check for compiled object cache types.
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
envCheckPath()
Environment check to inform user which paths we've assumed.
doGenerateKeys( $keys)
Generate a secret value for variables using our CryptRand generator.
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
ParserOptions $parserOptions
Cached ParserOptions, used by parse().
Accesses configuration settings from $GLOBALS.
when a variable name is used in a it is silently declared as a new masking the global
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration settings
Class for handling updates to the site_stats table.
$GLOBALS['wgAutoloadClasses']['LocalisationUpdate']
static array $dbTypes
Known database types.
getVar( $name, $default=null)
Get an MW configuration variable, or internal installer configuration variable.
Content object for wiki text pages.
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
getDefaultSkin(array $skinNames)
Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings,...
findExtensions( $directory='extensions')
Finds extensions that follow the format /$directory/Name/Name.php, and returns an array containing th...
static get( $url, $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
static getInstallerConfig(Config $baseConfig)
Constructs a Config object that contains configuration settings that should be overwritten for the in...
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
array $envPreps
A list of environment preparation methods called by doEnvironmentPreps().
$wgExtensionDirectory
Filesystem extensions directory.
static newGood( $value=null)
Factory function for good results.
array $installSteps
The actual list of installation steps.
wfIsWindows()
Check if the operating system is Windows.
wfEscapeShellArg()
Version of escapeshellarg() that works better on Windows.
getDBInstaller( $type=false)
Get an instance of DatabaseInstaller for the specified DB type.
Base class for DBMS-specific installation helper classes.
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
envCheckDB()
Environment check for DB types.
getInstallSteps(DatabaseInstaller $installer)
Get an array of install steps.
static getMain()
Static methods.
array $compiledDBs
List of detected DBs, access using getCompiledDBs().
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
doEnvironmentChecks()
Do initial checks of the PHP environment.
envCheckGraphics()
Environment check for ImageMagick and GD.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
static apacheModulePresent( $moduleName)
Checks for presence of an Apache module.
Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
Represents a title within MediaWiki.
envCheckPCRE()
Environment check for the PCRE module.
$wgHooks['ArticleShow'][]
static canMakeRequests()
Simple function to test if we can make any sort of requests at all, using cURL or fopen()
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
array $licenses
License types.
disableTimeLimit()
Disable the time limit for execution.
envCheckServer()
Environment check to inform user which server we've assumed.
const MINIMUM_PCRE_VERSION
The oldest version of PCRE we can support.
static factory( $code)
Get a cached or new language object for a given language code.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
static getDBTypes()
Get a list of known DB types.
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 MediaWikiServices
$mediaWikiAnnounceUrl
URL to mediawiki-announce subscription.
wfIsHHVM()
Check if we are running under HHVM.
includeExtensions()
Installs the auto-detected extensions.
$wgStyleDirectory
Filesystem stylesheets directory.
envCheckGit()
Search for git.
getDocUrl( $page)
Overridden by WebInstaller to provide lastPage parameters.
subscribeToMediaWikiAnnounce(Status $s)
unicodeChar( $c)
Convert a hex string representing a Unicode code point to that code point.
the array() calling protocol came about after MediaWiki 1.4rc1.
static maybeGetWebserverPrimaryGroup()
On POSIX systems return the primary group of the webserver we're running under.
array $defaultVarNames
MediaWiki configuration globals that will eventually be passed through to LocalSettings....
wfShellExec( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
array $envChecks
A list of environment check methods called by doEnvironmentChecks().
envCheckModSecurity()
Scare user to death if they have mod_security or mod_security2.
static locateExecutable( $path, $names, $versionInfo=false)
Search a path for any of the given executable names.