127 'envCheckModSecurity',
133 'envCheckShellLocale',
134 'envCheckUploadsDirectory',
136 'envCheckSuhosinMaxValueLength',
168 'wgEmailAuthentication',
172 'wgImageMagickConvertCommand',
177 'wgDeletedDirectory',
181 'wgUseInstantCommons',
196 '_Environment' =>
false,
197 '_RaiseMemory' =>
false,
198 '_UpgradeDone' =>
false,
199 '_InstallDone' =>
false,
201 '_InstallPassword' =>
'',
202 '_SameAccount' =>
true,
203 '_CreateDBAccount' =>
false,
204 '_NamespaceType' =>
'site-name',
206 '_AdminPassword' =>
'',
207 '_AdminPasswordConfirm' =>
'',
209 '_Subscribe' =>
false,
210 '_SkipOptional' =>
'continue',
211 '_RightsProfile' =>
'wiki',
212 '_LicenseCode' =>
'none',
216 '_MemCachedServers' =>
'',
217 '_UpgradeKeySupplied' =>
false,
218 '_ExistingDBSettings' =>
false,
222 'wgLogo' =>
'$wgResourceBasePath/resources/assets/wiki.png',
223 'wgAuthenticationTokenVersion' => 1,
246 'xcache' =>
'xcache_get',
247 'apc' =>
'apc_fetch',
248 'apcu' =>
'apcu_fetch',
249 'wincache' =>
'wincache_ucache_get'
260 '*' => [
'edit' =>
false ]
264 'createaccount' =>
false,
270 'createaccount' =>
false,
284 'url' =>
'https://creativecommons.org/licenses/by/4.0/',
285 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by.png',
288 'url' =>
'https://creativecommons.org/licenses/by-sa/4.0/',
289 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png',
292 'url' =>
'https://creativecommons.org/licenses/by-nc-sa/4.0/',
293 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-nc-sa.png',
296 'url' =>
'https://creativecommons.org/publicdomain/zero/1.0/',
297 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-0.png',
300 'url' =>
'https://www.gnu.org/copyleft/fdl.html',
301 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/gnu-fdl.png',
320 'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
326 'ca',
'cs',
'da',
'de',
'en',
'es',
'et',
'eu',
'fi',
'fr',
'hr',
'hu',
327 'it',
'ja',
'ko',
'lt',
'nl',
'no',
'pl',
'pt',
'pt-br',
'ro',
'ru',
328 'sl',
'sr',
'sv',
'tr',
'uk'
367 $emptyCache = [
'class' =>
'EmptyBagOStuff' ];
374 ] + $baseConfig->get(
'ObjectCaches' );
379 $messageDirs = $baseConfig->get(
'MessagesDirs' );
380 $messageDirs[
'MediawikiInstaller'] = __DIR__ .
'/i18n';
382 $configOverrides->set(
'MessagesDirs', $messageDirs );
384 $installerConfig =
new MultiConfig( [ $configOverrides, $baseConfig ] );
387 $configRegistry = $baseConfig->get(
'ConfigRegistry' );
388 $configRegistry[
'main'] =
function () use ( $installerConfig ) {
389 return $installerConfig;
392 $configOverrides->set(
'ConfigRegistry', $configRegistry );
394 return $installerConfig;
407 MediaWiki\MediaWikiServices::resetGlobalInstance( $installerConfig );
415 Language::getLocalisationCache()->disableBackend();
418 MediaWiki\MediaWikiServices::disableStorageBackend();
422 $wgObjectCaches = MediaWikiServices::getInstance()->getMainConfig()->get(
'ObjectCaches' );
426 $wgUser = User::newFromId( 0 );
431 foreach ( $this->defaultVarNames as $var ) {
437 $this->compiledDBs = [];
438 foreach ( self::getDBTypes() as
$type ) {
441 if ( !$installer->isCompiled() ) {
444 $this->compiledDBs[] =
$type;
447 $this->parserTitle = Title::newFromText(
'Installer' );
449 $this->parserOptions->setEditSection(
false );
450 $this->parserOptions->setWrapOutputClass(
false );
481 $this->
showMessage(
'config-env-hhvm', HHVM_VERSION );
483 $this->
showMessage(
'config-env-php', PHP_VERSION );
488 list( $pcreVersion ) = explode(
' ', PCRE_VERSION, 2 );
489 if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION,
'<' ) ) {
490 $this->
showError(
'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
493 foreach ( $this->envChecks as $check ) {
501 $this->
setVar(
'_Environment', $good );
503 return $good ? Status::newGood() : Status::newFatal(
'config-env-bad' );
507 foreach ( $this->envPreps as $prep ) {
532 public function getVar( $name, $default =
null ) {
533 if ( !isset( $this->
settings[$name] ) ) {
557 return ucfirst(
$type ) .
'Installer';
574 if ( !isset( $this->dbInstallers[
$type] ) ) {
576 $this->dbInstallers[
$type] =
new $class( $this );
579 return $this->dbInstallers[
$type];
604 MediaWiki\suppressWarnings();
605 $_lsExists = file_exists(
"$IP/LocalSettings.php" );
606 MediaWiki\restoreWarnings();
613 require
"$IP/includes/DefaultSettings.php";
614 require
"$IP/LocalSettings.php";
616 return get_defined_vars();
629 return str_repeat(
'*', strlen( $realPassword ) );
640 if ( !preg_match(
'/^\*+$/',
$value ) ) {
657 if ( !function_exists(
'posix_getegid' ) || !function_exists(
'posix_getpwuid' ) ) {
658 # I don't know this, this isn't UNIX.
662 # posix_getegid() *not* getmygid() because we want the group of the webserver,
663 # not whoever owns the current script.
664 $gid = posix_getegid();
665 $group = posix_getpwuid( $gid )[
'name'];
686 public function parse( $text, $lineStart =
false ) {
690 $out =
$wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
692 }
catch (
MediaWiki\Services\ServiceDisabledException
$e ) {
693 $html =
'<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
695 if ( !empty( $this->debug ) ) {
696 $html .=
"<!--\n" .
$e->getTraceAsString() .
"\n-->";
711 $this->parserOptions->setExternalLinkTarget(
false );
728 $status = $installer->getConnection();
736 'ss_total_edits' => 0,
737 'ss_good_articles' => 0,
738 'ss_total_pages' => 0,
740 'ss_active_users' => 0,
746 return Status::newGood();
760 foreach ( self::getDBTypes() as $name ) {
761 $allNames[] =
wfMessage(
"config-type-$name" )->text();
766 $databases = array_flip( $databases );
767 foreach ( array_keys( $databases ) as $db ) {
769 $status = $installer->checkPrerequisites();
774 unset( $databases[$db] );
777 $databases = array_flip( $databases );
779 $this->
showError(
'config-no-db', $wgLang->commaList( $allNames ), count( $allNames ) );
795 $this->
showError(
'config-brokenlibxml' );
812 MediaWiki\suppressWarnings();
813 $regexd = preg_replace(
'/[\x{0430}-\x{04FF}]/iu',
'',
'-АБВГД-' );
818 $regexprop = preg_replace(
'/\p{Zs}/u',
'',
"-\xE3\x80\x80-" );
819 MediaWiki\restoreWarnings();
820 if ( $regexd !=
'--' || $regexprop !=
'--' ) {
821 $this->
showError(
'config-pcre-no-utf8' );
834 $limit = ini_get(
'memory_limit' );
836 if ( !$limit || $limit == -1 ) {
842 if ( $n < $this->minMemorySize * 1024 * 1024 ) {
843 $newLimit =
"{$this->minMemorySize}M";
845 if ( ini_set(
"memory_limit", $newLimit ) ===
false ) {
848 $this->
showMessage(
'config-memory-raised', $limit, $newLimit );
849 $this->
setVar(
'_RaiseMemory',
true );
861 foreach ( $this->objectCaches as $name => $function ) {
862 if ( function_exists( $function ) ) {
863 if ( $name ==
'xcache' && !
wfIniGetBool(
'xcache.var_size' ) ) {
866 $caches[
$name] =
true;
871 $key =
'config-no-cache-apcu';
875 $this->
setVar(
'_Caches', $caches );
883 if ( self::apacheModulePresent(
'mod_security' )
884 || self::apacheModulePresent(
'mod_security2' ) ) {
896 $names = [
"gdiff3",
"diff3",
"diff3.exe" ];
897 $versionInfo = [
'$1 --version 2>&1',
'GNU diffutils' ];
902 $this->
setVar(
'wgDiff3', $diff3 );
904 $this->
setVar(
'wgDiff3',
false );
916 $names = [
wfIsWindows() ?
'convert.exe' :
'convert' ];
917 $versionInfo = [
'$1 -version',
'ImageMagick' ];
920 $this->
setVar(
'wgImageMagickConvertCommand',
'' );
922 $this->
setVar(
'wgImageMagickConvertCommand', $convert );
923 $this->
showMessage(
'config-imagemagick', $convert );
926 } elseif ( function_exists(
'imagejpeg' ) ) {
943 $versionInfo = [
'$1 --version',
'git version' ];
948 $this->
setVar(
'wgGitBin', $git );
951 $this->
setVar(
'wgGitBin',
false );
965 if ( $server !==
null ) {
966 $this->
showMessage(
'config-using-server', $server );
979 $this->
getVar(
'wgServer' ),
980 $this->
getVar(
'wgScriptPath' )
990 $os = php_uname(
's' );
991 $supported = [
'Linux',
'SunOS',
'HP-UX',
'Darwin' ]; # Tested these
993 if ( !in_array( $os, $supported ) ) {
997 # Get a list of available locales.
1006 $candidatesByLocale = [];
1007 $candidatesByLang = [];
1010 if (
$line ===
'' ) {
1014 if ( !preg_match(
'/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i',
$line, $m ) ) {
1020 $candidatesByLocale[$m[0]] = $m;
1021 $candidatesByLang[
$lang][] = $m;
1024 # Try the current value of LANG.
1025 if ( isset( $candidatesByLocale[getenv(
'LANG' )] ) ) {
1026 $this->
setVar(
'wgShellLocale', getenv(
'LANG' ) );
1031 # Try the most common ones.
1032 $commonLocales = [
'C.UTF-8',
'en_US.UTF-8',
'en_US.utf8',
'de_DE.UTF-8',
'de_DE.utf8' ];
1033 foreach ( $commonLocales as $commonLocale ) {
1034 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
1035 $this->
setVar(
'wgShellLocale', $commonLocale );
1041 # Is there an available locale in the Wiki's language?
1042 $wikiLang = $this->
getVar(
'wgLanguageCode' );
1044 if ( isset( $candidatesByLang[$wikiLang] ) ) {
1045 $m = reset( $candidatesByLang[$wikiLang] );
1046 $this->
setVar(
'wgShellLocale', $m[0] );
1051 # Are there any at all?
1052 if ( count( $candidatesByLocale ) ) {
1053 $m = reset( $candidatesByLocale );
1054 $this->
setVar(
'wgShellLocale', $m[0] );
1071 $url = $this->
getVar(
'wgServer' ) . $this->
getVar(
'wgScriptPath' ) .
'/images/';
1087 $maxValueLength = ini_get(
'suhosin.get.max_value_length' );
1088 if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1090 $this->
showMessage(
'config-suhosin-max-value-length', $maxValueLength );
1103 if ( PHP_INT_SIZE == 4 ) {
1119 } elseif ( $c <= 0x7FF ) {
1120 return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
1121 } elseif ( $c <= 0xFFFF ) {
1122 return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F ) .
1123 chr( 0x80 | $c & 0x3F );
1124 } elseif ( $c <= 0x10FFFF ) {
1125 return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F ) .
1126 chr( 0x80 | $c >> 6 & 0x3F ) .
1127 chr( 0x80 | $c & 0x3F );
1147 $useNormalizer =
'php';
1148 $needsUpdate =
false;
1150 if ( function_exists(
'normalizer_normalize' ) ) {
1151 $useNormalizer =
'intl';
1152 $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1153 if ( $intl !== $normal_c ) {
1154 $needsUpdate =
true;
1159 if ( $useNormalizer ===
'php' ) {
1160 $this->
showMessage(
'config-unicode-pure-php-warning' );
1162 $this->
showMessage(
'config-unicode-using-' . $useNormalizer );
1163 if ( $needsUpdate ) {
1164 $this->
showMessage(
'config-unicode-update-warning' );
1174 if ( $server !==
null ) {
1175 $this->
setVar(
'wgServer', $server );
1190 $IP = dirname( dirname( __DIR__ ) );
1191 $this->
setVar(
'IP', $IP );
1203 [
'/usr/bin',
'/usr/local/bin',
'/opt/csw/bin',
1204 '/usr/gnu/bin',
'/usr/sfw/bin',
'/sw/bin',
'/opt/local/bin' ],
1205 explode( PATH_SEPARATOR, getenv(
'PATH' ) )
1227 if ( !is_array( $names ) ) {
1228 $names = [ $names ];
1231 foreach ( $names as $name ) {
1234 MediaWiki\suppressWarnings();
1235 $file_exists = is_executable(
$command );
1236 MediaWiki\restoreWarnings();
1238 if ( $file_exists ) {
1239 if ( !$versionInfo ) {
1244 if ( strstr(
wfShellExec( $file ), $versionInfo[1] ) !==
false ) {
1266 foreach ( self::getPossibleBinPaths() as $path ) {
1268 if ( $exe !==
false ) {
1287 "<?php echo 'ex' . 'ec';",
1288 "#!/var/env php5\n<?php echo 'ex' . 'ec';",
1294 MediaWiki\suppressWarnings();
1296 foreach ( $scriptTypes as
$ext => $contents ) {
1297 foreach ( $contents as
$source ) {
1298 $file =
'exectest.' .
$ext;
1300 if ( !file_put_contents(
$dir . $file,
$source ) ) {
1305 $text = Http::get( $url . $file, [
'timeout' => 3 ], __METHOD__ );
1306 }
catch ( Exception
$e ) {
1310 unlink(
$dir . $file );
1312 if ( $text ==
'exec' ) {
1313 MediaWiki\restoreWarnings();
1320 MediaWiki\restoreWarnings();
1332 if ( function_exists(
'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1337 phpinfo( INFO_MODULES );
1338 $info = ob_get_clean();
1340 return strpos( $info, $moduleName ) !==
false;
1349 $this->parserOptions->setTargetLanguage(
$lang );
1350 $this->parserOptions->setUserLang(
$lang );
1359 return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
1372 if ( $this->
getVar(
'IP' ) ===
null ) {
1376 $extDir = $this->
getVar(
'IP' ) .
'/' . $directory;
1377 if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1382 $jsonFile = substr( $directory, 0, strlen( $directory ) - 1 ) .
'.json';
1384 $dh = opendir( $extDir );
1386 while ( ( $file = readdir( $dh ) ) !==
false ) {
1387 if ( !is_dir(
"$extDir/$file" ) ) {
1390 if ( file_exists(
"$extDir/$file/$jsonFile" ) || file_exists(
"$extDir/$file/$file.php" ) ) {
1393 if ( is_dir(
"$extDir/$file/screenshots" ) ) {
1394 $paths = glob(
"$extDir/$file/screenshots/*.png" );
1395 foreach ( $paths as $path ) {
1396 $exts[$file][
'screenshots'][] = str_replace( $extDir,
"../$directory", $path );
1403 uksort( $exts,
'strnatcasecmp' );
1417 $defaultSkin =
$GLOBALS[
'wgDefaultSkin'];
1418 if ( !$skinNames || in_array( $defaultSkin, $skinNames ) ) {
1419 return $defaultSkin;
1421 return $skinNames[0];
1432 $exts = $this->
getVar(
'_Extensions' );
1433 $IP = $this->
getVar(
'IP' );
1447 require
"$IP/includes/DefaultSettings.php";
1449 foreach ( $exts as
$e ) {
1450 if ( file_exists(
"$IP/extensions/$e/extension.json" ) ) {
1451 $queue[
"$IP/extensions/$e/extension.json"] = 1;
1453 require_once
"$IP/extensions/$e/$e.php";
1458 $data = $registry->readFromQueue(
$queue );
1461 $hooksWeWant = isset(
$wgHooks[
'LoadExtensionSchemaUpdates'] ) ?
1463 $wgHooks[
'LoadExtensionSchemaUpdates'] : [];
1465 if ( isset( $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
1466 $hooksWeWant = array_merge_recursive(
1468 $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates']
1473 $GLOBALS[
'wgHooks'] = [
'LoadExtensionSchemaUpdates' => $hooksWeWant ];
1475 return Status::newGood();
1491 $coreInstallSteps = [
1492 [
'name' =>
'database',
'callback' => [ $installer,
'setupDatabase' ] ],
1493 [
'name' =>
'tables',
'callback' => [ $installer,
'createTables' ] ],
1494 [
'name' =>
'interwiki',
'callback' => [ $installer,
'populateInterwikiTable' ] ],
1495 [
'name' =>
'stats',
'callback' => [ $this,
'populateSiteStats' ] ],
1496 [
'name' =>
'keys',
'callback' => [ $this,
'generateKeys' ] ],
1497 [
'name' =>
'updates',
'callback' => [ $installer,
'insertUpdateKeys' ] ],
1498 [
'name' =>
'sysop',
'callback' => [ $this,
'createSysop' ] ],
1499 [
'name' =>
'mainpage',
'callback' => [ $this,
'createMainpage' ] ],
1504 foreach ( $coreInstallSteps as $step ) {
1505 $this->installSteps[] = $step;
1506 if ( isset( $this->extraInstallSteps[$step[
'name']] ) ) {
1507 $this->installSteps = array_merge(
1508 $this->installSteps,
1509 $this->extraInstallSteps[$step[
'name']]
1515 if ( isset( $this->extraInstallSteps[
'BEGINNING'] ) ) {
1516 $this->installSteps = array_merge(
1517 $this->extraInstallSteps[
'BEGINNING'],
1523 if ( count( $this->
getVar(
'_Extensions' ) ) ) {
1524 array_unshift( $this->installSteps,
1525 [
'name' =>
'extensions',
'callback' => [ $this,
'includeExtensions' ] ]
1527 $this->installSteps[] = [
1528 'name' =>
'extension-tables',
1529 'callback' => [ $installer,
'createExtensionTables' ]
1545 $installResults = [];
1547 $installer->preInstall();
1549 foreach ( $steps as $stepObj ) {
1550 $name = $stepObj[
'name'];
1551 call_user_func_array( $startCB, [ $name ] );
1554 $status = call_user_func( $stepObj[
'callback'], $installer );
1557 call_user_func( $endCB, $name,
$status );
1567 $this->
setVar(
'_InstallDone',
true );
1570 return $installResults;
1579 $keys = [
'wgSecretKey' => 64 ];
1580 if ( strval( $this->
getVar(
'wgUpgradeKey' ) ) ===
'' ) {
1581 $keys[
'wgUpgradeKey'] = 16;
1598 foreach (
$keys as $name => $length ) {
1604 $this->
setVar( $name, $secretKey );
1608 $names = array_keys(
$keys );
1609 $names = preg_replace(
'/^(.*)$/',
'\$$1', $names );
1611 $status->warning(
'config-insecure-keys',
$wgLang->listToText( $names ), count( $names ) );
1623 $name = $this->
getVar(
'_AdminName' );
1624 $user = User::newFromName( $name );
1628 return Status::newFatal(
'config-admin-error-user', $name );
1631 if ( $user->idForName() == 0 ) {
1632 $user->addToDatabase();
1635 $user->setPassword( $this->
getVar(
'_AdminPassword' ) );
1637 return Status::newFatal(
'config-admin-error-password', $name, $pwe->getMessage() );
1640 $user->addGroup(
'sysop' );
1641 $user->addGroup(
'bureaucrat' );
1642 if ( $this->
getVar(
'_AdminEmail' ) ) {
1643 $user->setEmail( $this->
getVar(
'_AdminEmail' ) );
1645 $user->saveSettings();
1649 $ssUpdate->doUpdate();
1653 if ( $this->
getVar(
'_Subscribe' ) && $this->
getVar(
'_AdminEmail' ) ) {
1665 'email' => $this->
getVar(
'_AdminEmail' ),
1672 $myLang = $this->
getVar(
'_UserLang' );
1673 if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1674 $myLang = $myLang ==
'pt-br' ?
'pt_BR' : $myLang;
1675 $params[
'language'] = $myLang;
1678 if ( MWHttpRequest::canMakeRequests() ) {
1679 $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
1680 [
'method' =>
'POST',
'postData' =>
$params ], __METHOD__ )->execute();
1681 if ( !
$res->isOK() ) {
1682 $s->warning(
'config-install-subscribe-fail',
$res->getMessage() );
1685 $s->warning(
'config-install-subscribe-notpossible' );
1697 $title = Title::newMainPage();
1698 if ( $title->exists() ) {
1699 $status->warning(
'config-install-mainpage-exists' );
1705 wfMessage(
'mainpagetext' )->inContentLanguage()->
text() .
"\n\n" .
1706 wfMessage(
'mainpagedocfooter' )->inContentLanguage()->
text()
1709 $status = $page->doEditContent( $content,
1713 User::newFromName(
'MediaWiki default' )
1715 }
catch ( Exception
$e ) {
1717 $status->fatal(
'config-install-mainpage-failed',
$e->getMessage() );
1729 define(
'MW_NO_SESSION_HANDLER', 1 );
1732 $GLOBALS[
'wgUseDatabaseMessages'] =
false;
1736 $GLOBALS[
'wgShowExceptionDetails'] =
true;
1738 $GLOBALS[
'wgExternalLinkTarget'] =
'_blank';
1741 $GLOBALS[
'wgShowSQLErrors'] =
true;
1742 $GLOBALS[
'wgShowDBErrorBacktrace'] =
true;
1745 $GLOBALS[
'wgDisableOutputCompression'] =
true;
1748 $GLOBALS[
'wgCookiePrefix'] =
'mw_installer';
1757 'class' =>
'InstallerSessionProvider',
1776 $this->extraInstallSteps[$findStep][] = $callback;
1784 MediaWiki\suppressWarnings();
1785 set_time_limit( 0 );
1786 MediaWiki\restoreWarnings();
$GLOBALS['wgAutoloadClasses']['LocalisationUpdate']
$wgObjectCaches
Advanced object cache configuration.
$wgStyleDirectory
Filesystem stylesheets directory.
$wgAutoloadClasses
Array mapping class names to filenames, for autoloading.
$wgExtensionDirectory
Filesystem extensions directory.
$wgExternalLinkTarget
Set a default target for external links, e.g.
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
wfShellExec( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
wfEscapeShellArg()
Version of escapeshellarg() that works better on Windows.
wfIsWindows()
Check if the operating system is Windows.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
wfIsHHVM()
Check if we are running under HHVM.
Base class for DBMS-specific installation helper classes.
Accesses configuration settings from $GLOBALS.
A Config instance which stores all settings as a member variable.
envPrepServer()
Environment prep for the server hostname.
static locateExecutable( $path, $names, $versionInfo=false)
Search a path for any of the given executable names.
parse( $text, $lineStart=false)
Convert wikitext $text to HTML.
array $compiledDBs
List of detected DBs, access using getCompiledDBs().
Title $parserTitle
Cached Title, used by parse().
includeExtensions()
Installs the auto-detected extensions.
createMainpage(DatabaseInstaller $installer)
Insert Main Page with default content.
const MINIMUM_PCRE_VERSION
The oldest version of PCRE we can support.
getDefaultSkin(array $skinNames)
Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings,...
envCheckLibicu()
Check the libicu version.
getDBInstaller( $type=false)
Get an instance of DatabaseInstaller for the specified DB type.
envCheckDB()
Environment check for DB types.
envCheckSuhosinMaxValueLength()
Checks if suhosin.get.max_value_length is set, and if so generate a warning because it decreases Reso...
setVar( $name, $value)
Set a MW configuration variable, or internal installer configuration variable.
array $internalDefaults
Variables that are stored alongside globals, and are used for any configuration of the installation p...
envCheckModSecurity()
Scare user to death if they have mod_security or mod_security2.
getFakePassword( $realPassword)
Get a fake password for sending back to the user in HTML.
envCheckServer()
Environment check to inform user which server we've assumed.
disableTimeLimit()
Disable the time limit for execution.
$mediaWikiAnnounceUrl
URL to mediawiki-announce subscription.
static apacheModulePresent( $moduleName)
Checks for presence of an Apache module.
array $rightsProfiles
User rights profiles.
addInstallStep( $callback, $findStep='BEGINNING')
Add an installation step following the given step.
getCompiledDBs()
Get a list of DBs supported by current PHP setup.
envCheckBrokenXML()
Some versions of libxml+PHP break < and > encoding horribly.
array $installSteps
The actual list of installation steps.
ParserOptions $parserOptions
Cached ParserOptions, used by parse().
static locateExecutableInDefaultPaths( $names, $versionInfo=false)
Same as locateExecutable(), but checks in getPossibleBinPaths() by default.
dirIsExecutable( $dir, $url)
Checks if scripts located in the given directory can be executed via the given URL.
envCheckGit()
Search for git.
getDocUrl( $page)
Overridden by WebInstaller to provide lastPage parameters.
array $defaultVarNames
MediaWiki configuration globals that will eventually be passed through to LocalSettings....
showMessage( $msg)
UI interface for displaying a short message The parameters are like parameters to wfMessage().
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
showError( $msg)
Same as showMessage(), but for displaying errors.
static getInstallerConfig(Config $baseConfig)
Constructs a Config object that contains configuration settings that should be overwritten for the in...
static getPossibleBinPaths()
Get an array of likely places we can find executables.
envCheckMemory()
Environment check for available memory.
array $objectCaches
Known object cache types and the functions used to test for their existence.
array $licenses
License types.
static maybeGetWebserverPrimaryGroup()
On POSIX systems return the primary group of the webserver we're running under.
doEnvironmentChecks()
Do initial checks of the PHP environment.
performInstallation( $startCB, $endCB)
Actually perform the installation.
envCheck64Bit()
Checks if we're running on 64 bit or not.
generateKeys()
Generate $wgSecretKey.
populateSiteStats(DatabaseInstaller $installer)
Install step which adds a row to the site_stats table with appropriate initial values.
subscribeToMediaWikiAnnounce(Status $s)
envCheckCache()
Environment check for compiled object cache types.
__construct()
Constructor, always call this from child classes.
int $minMemorySize
Minimum memory size in MB.
doGenerateKeys( $keys)
Generate a secret value for variables using our CryptRand generator.
showStatusMessage(Status $status)
Show a message to the installing user by using a Status object.
envCheckPath()
Environment check to inform user which paths we've assumed.
array $envPreps
A list of environment preparation methods called by doEnvironmentPreps().
$mediaWikiAnnounceLanguages
Supported language codes for Mailman.
setPassword( $name, $value)
Set a variable which stores a password, except if the new value is a fake password in which case leav...
envPrepPath()
Environment prep for setting $IP and $wgScriptPath.
static getDBTypes()
Get a list of known DB types.
createSysop()
Create the first user account, grant it sysop and bureaucrat rights.
envCheckPCRE()
Environment check for the PCRE module.
getVar( $name, $default=null)
Get an MW configuration variable, or internal installer configuration variable.
static getDBInstallerClass( $type)
Get the DatabaseInstaller class name for this type.
static overrideConfig()
Override the necessary bits of the config to run an installation.
array $extraInstallSteps
Extra steps for installation, for things like DatabaseInstallers to modify.
static array $dbTypes
Known database types.
envCheckDiff3()
Search for GNU diff3.
envCheckShellLocale()
Environment check for preferred locale in shell.
envGetDefaultServer()
Helper function to be called from envPrepServer()
getInstallSteps(DatabaseInstaller $installer)
Get an array of install steps.
array $dbInstallers
Cached DB installer instances, access using getDBInstaller().
array $envChecks
A list of environment check methods called by doEnvironmentChecks().
envCheckGraphics()
Environment check for ImageMagick and GD.
unicodeChar( $c)
Convert a hex string representing a Unicode code point to that code point.
envCheckUploadsDirectory()
Environment check for the permissions of the uploads directory.
setParserLanguage( $lang)
ParserOptions are constructed before we determined the language, so fix it.
findExtensions( $directory='extensions')
Finds extensions that follow the format /$directory/Name/Name.php, and returns an array containing th...
static wasStrong()
Return a boolean indicating whether or not the source used for cryptographic random bytes generation ...
static generateHex( $chars, $forceStrong=false)
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format.
Provides a fallback sequence for Config objects.
Set options of the Parser.
Show an error when any operation involving passwords fails to run.
Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
static getMain()
Static methods.
Class for handling updates to the site_stats table.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Represents a title within MediaWiki.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
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
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
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
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 "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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
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
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
$wgHooks['ArticleShow'][]
Allows to change the fields on the form that will be generated $name
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action or null $user:User who performed the tagging when the tagging is subsequent to the action or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, 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. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy: boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
processing should stop and the error should be shown to the user * false
returning false will NOT prevent logging $e
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
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
if(!isset( $args[0])) $lang