128 'envCheckModSecurity',
134 'envCheckShellLocale',
135 'envCheckUploadsDirectory',
137 'envCheckSuhosinMaxValueLength',
169 'wgEmailAuthentication',
173 'wgImageMagickConvertCommand',
178 'wgDeletedDirectory',
182 'wgUseInstantCommons',
197 '_Environment' =>
false,
198 '_RaiseMemory' =>
false,
199 '_UpgradeDone' =>
false,
200 '_InstallDone' =>
false,
202 '_InstallPassword' =>
'',
203 '_SameAccount' =>
true,
204 '_CreateDBAccount' =>
false,
205 '_NamespaceType' =>
'site-name',
207 '_AdminPassword' =>
'',
208 '_AdminPasswordConfirm' =>
'',
210 '_Subscribe' =>
false,
211 '_SkipOptional' =>
'continue',
212 '_RightsProfile' =>
'wiki',
213 '_LicenseCode' =>
'none',
217 '_MemCachedServers' =>
'',
218 '_UpgradeKeySupplied' =>
false,
219 '_ExistingDBSettings' =>
false,
223 'wgLogo' =>
'$wgResourceBasePath/resources/assets/wiki.png',
224 'wgAuthenticationTokenVersion' => 1,
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'
369 $emptyCache = [
'class' => EmptyBagOStuff::class ];
376 ] + $baseConfig->
get(
'ObjectCaches' );
381 $messageDirs = $baseConfig->
get(
'MessagesDirs' );
382 $messageDirs[
'MediawikiInstaller'] = __DIR__ .
'/i18n';
384 $configOverrides->set(
'MessagesDirs', $messageDirs );
386 $installerConfig =
new MultiConfig( [ $configOverrides, $baseConfig ] );
389 $configRegistry = $baseConfig->
get(
'ConfigRegistry' );
390 $configRegistry[
'main'] =
function () use ( $installerConfig ) {
391 return $installerConfig;
394 $configOverrides->set(
'ConfigRegistry', $configRegistry );
396 return $installerConfig;
409 MediaWikiServices::resetGlobalInstance( $installerConfig );
413 RequestContext::getMain()->setLanguage(
'en' );
416 MediaWikiServices::disableStorageBackend();
418 $mwServices = MediaWikiServices::getInstance();
421 $mwServices->getLocalisationCache()->disableBackend();
424 Language::clearCaches();
432 $mwServices->redefineService(
'InterwikiLookup',
function () {
437 $wgUser = User::newFromId( 0 );
438 RequestContext::getMain()->setUser( $wgUser );
442 foreach ( $this->defaultVarNames as $var ) {
443 $this->settings[$var] =
$GLOBALS[$var];
448 $this->compiledDBs = [];
449 foreach ( self::getDBTypes() as
$type ) {
452 if ( !$installer->isCompiled() ) {
455 $this->compiledDBs[] =
$type;
458 $this->parserTitle = Title::newFromText(
'Installer' );
460 $this->parserOptions->setTidy(
true );
491 $this->
showMessage(
'config-env-hhvm', HHVM_VERSION );
493 $this->
showMessage(
'config-env-php', PHP_VERSION );
498 $pcreVersion = explode(
' ', PCRE_VERSION, 2 )[0];
499 if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION,
'<' ) ) {
500 $this->
showError(
'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
503 foreach ( $this->envChecks as $check ) {
504 $status = $this->$check();
505 if ( $status ===
false ) {
511 $this->
setVar(
'_Environment', $good );
513 return $good ? Status::newGood() : Status::newFatal(
'config-env-bad' );
517 foreach ( $this->envPreps as $prep ) {
528 public function setVar( $name, $value ) {
529 $this->settings[$name] = $value;
542 public function getVar( $name, $default =
null ) {
543 return $this->settings[$name] ?? $default;
563 return ucfirst(
$type ) .
'Installer';
580 if ( !isset( $this->dbInstallers[
$type] ) ) {
582 $this->dbInstallers[
$type] =
new $class( $this );
585 return $this->dbInstallers[
$type];
609 Wikimedia\suppressWarnings();
610 $_lsExists = file_exists(
"$IP/LocalSettings.php" );
611 Wikimedia\restoreWarnings();
618 require
"$IP/includes/DefaultSettings.php";
619 require
"$IP/LocalSettings.php";
621 return get_defined_vars();
634 return str_repeat(
'*', strlen( $realPassword ) );
645 if ( !preg_match(
'/^\*+$/', $value ) ) {
646 $this->
setVar( $name, $value );
662 if ( !function_exists(
'posix_getegid' ) || !function_exists(
'posix_getpwuid' ) ) {
663 # I don't know this, this isn't UNIX.
667 # posix_getegid() *not* getmygid() because we want the group of the webserver,
668 # not whoever owns the current script.
669 $gid = posix_getegid();
670 $group = posix_getpwuid( $gid )[
'name'];
691 public function parse( $text, $lineStart =
false ) {
692 $parser = MediaWikiServices::getInstance()->getParser();
695 $out = $parser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
696 $html = $out->getText( [
697 'enableSectionEditLinks' =>
false,
700 $html = Parser::stripOuterParagraph( $html );
701 }
catch (
Wikimedia\Services\ServiceDisabledException $e ) {
702 $html =
'<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
716 $this->parserOptions->setExternalLinkTarget(
false );
734 if ( !$status->isOK() ) {
738 $status->value->insert(
742 'ss_total_edits' => 0,
743 'ss_good_articles' => 0,
744 'ss_total_pages' => 0,
746 'ss_active_users' => 0,
752 return Status::newGood();
762 $dbType = $this->
getVar(
'wgDBtype' );
767 foreach ( self::getDBTypes() as $name ) {
768 $allNames[] =
wfMessage(
"config-type-$name" )->text();
773 $databases = array_flip( $databases );
775 foreach ( array_keys( $databases ) as $db ) {
777 $status = $installer->checkPrerequisites();
778 if ( !$status->isGood() ) {
779 if ( !$this instanceof
WebInstaller && $db === $dbType ) {
786 unset( $databases[$db] );
789 $databases = array_flip( $databases );
791 $this->
showError(
'config-no-db', $wgLang->commaList( $allNames ), count( $allNames ) );
804 $this->
showError(
'config-brokenlibxml' );
821 Wikimedia\suppressWarnings();
822 $regexd = preg_replace(
'/[\x{0430}-\x{04FF}]/iu',
'',
'-АБВГД-' );
827 $regexprop = preg_replace(
'/\p{Zs}/u',
'',
"-\u{3000}-" );
828 Wikimedia\restoreWarnings();
829 if ( $regexd !=
'--' || $regexprop !=
'--' ) {
830 $this->
showError(
'config-pcre-no-utf8' );
843 $limit = ini_get(
'memory_limit' );
845 if ( !$limit || $limit == -1 ) {
851 if ( $n < $this->minMemorySize * 1024 * 1024 ) {
852 $newLimit =
"{$this->minMemorySize}M";
854 if ( ini_set(
"memory_limit", $newLimit ) ===
false ) {
857 $this->
showMessage(
'config-memory-raised', $limit, $newLimit );
858 $this->
setVar(
'_RaiseMemory',
true );
870 foreach ( $this->objectCaches as $name => $function ) {
871 if ( function_exists( $function ) ) {
872 $caches[$name] =
true;
880 $this->
setVar(
'_Caches', $caches );
888 if ( self::apacheModulePresent(
'mod_security' )
889 || self::apacheModulePresent(
'mod_security2' ) ) {
901 $names = [
"gdiff3",
"diff3" ];
903 $names[] =
'diff3.exe';
905 $versionInfo = [
'--version',
'GNU diffutils' ];
907 $diff3 = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
910 $this->
setVar(
'wgDiff3', $diff3 );
912 $this->
setVar(
'wgDiff3',
false );
924 $names =
wfIsWindows() ?
'convert.exe' :
'convert';
925 $versionInfo = [
'-version',
'ImageMagick' ];
926 $convert = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
928 $this->
setVar(
'wgImageMagickConvertCommand',
'' );
930 $this->
setVar(
'wgImageMagickConvertCommand', $convert );
931 $this->
showMessage(
'config-imagemagick', $convert );
934 } elseif ( function_exists(
'imagejpeg' ) ) {
951 $versionInfo = [
'--version',
'git version' ];
953 $git = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
956 $this->
setVar(
'wgGitBin', $git );
959 $this->
setVar(
'wgGitBin',
false );
973 if ( $server !==
null ) {
974 $this->
showMessage(
'config-using-server', $server );
987 $this->
getVar(
'wgServer' ),
988 $this->
getVar(
'wgScriptPath' )
998 $os = php_uname(
's' );
999 $supported = [
'Linux',
'SunOS',
'HP-UX',
'Darwin' ]; # Tested these
1001 if ( !in_array( $os, $supported ) ) {
1005 if ( Shell::isDisabled() ) {
1009 # Get a list of available locales.
1010 $result = Shell::command(
'/usr/bin/locale',
'-a' )
1013 if ( $result->getExitCode() != 0 ) {
1017 $lines = $result->getStdout();
1019 $candidatesByLocale = [];
1020 $candidatesByLang = [];
1022 if (
$line ===
'' ) {
1026 if ( !preg_match(
'/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i',
$line, $m ) ) {
1030 list( ,
$lang, , , ) = $m;
1032 $candidatesByLocale[$m[0]] = $m;
1033 $candidatesByLang[
$lang][] = $m;
1036 # Try the current value of LANG.
1037 if ( isset( $candidatesByLocale[getenv(
'LANG' )] ) ) {
1038 $this->
setVar(
'wgShellLocale', getenv(
'LANG' ) );
1043 # Try the most common ones.
1044 $commonLocales = [
'C.UTF-8',
'en_US.UTF-8',
'en_US.utf8',
'de_DE.UTF-8',
'de_DE.utf8' ];
1045 foreach ( $commonLocales as $commonLocale ) {
1046 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
1047 $this->
setVar(
'wgShellLocale', $commonLocale );
1053 # Is there an available locale in the Wiki's language?
1054 $wikiLang = $this->
getVar(
'wgLanguageCode' );
1056 if ( isset( $candidatesByLang[$wikiLang] ) ) {
1057 $m = reset( $candidatesByLang[$wikiLang] );
1058 $this->
setVar(
'wgShellLocale', $m[0] );
1063 # Are there any at all?
1064 if ( count( $candidatesByLocale ) ) {
1065 $m = reset( $candidatesByLocale );
1066 $this->
setVar(
'wgShellLocale', $m[0] );
1082 $dir =
$IP .
'/images/';
1083 $url = $this->
getVar(
'wgServer' ) . $this->
getVar(
'wgScriptPath' ) .
'/images/';
1087 $this->
showMessage(
'config-uploads-not-safe', $dir );
1099 $currentValue = ini_get(
'suhosin.get.max_value_length' );
1100 $minRequired = 2000;
1101 $recommended = 5000;
1102 if ( $currentValue > 0 && $currentValue < $minRequired ) {
1103 $this->
showError(
'config-suhosin-max-value-length', $currentValue, $minRequired, $recommended );
1117 if ( PHP_INT_SIZE == 4 ) {
1135 $not_normal_c =
"\u{FA6C}";
1136 $normal_c =
"\u{242EE}";
1138 $useNormalizer =
'php';
1139 $needsUpdate =
false;
1141 if ( function_exists(
'normalizer_normalize' ) ) {
1142 $useNormalizer =
'intl';
1143 $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1144 if ( $intl !== $normal_c ) {
1145 $needsUpdate =
true;
1150 if ( $useNormalizer ===
'php' ) {
1151 $this->
showMessage(
'config-unicode-pure-php-warning' );
1153 $this->
showMessage(
'config-unicode-using-' . $useNormalizer );
1154 if ( $needsUpdate ) {
1155 $this->
showMessage(
'config-unicode-update-warning' );
1165 if ( $server !==
null ) {
1166 $this->
setVar(
'wgServer', $server );
1181 $IP = dirname( dirname( __DIR__ ) );
1182 $this->
setVar(
'IP', $IP );
1196 "<?php echo 'exec';",
1197 "#!/var/env php\n<?php echo 'exec';",
1203 Wikimedia\suppressWarnings();
1205 foreach ( $scriptTypes as
$ext => $contents ) {
1206 foreach ( $contents as
$source ) {
1214 $text = MediaWikiServices::getInstance()->getHttpRequestFactory()->
1215 get( $url .
$file, [
'timeout' => 3 ], __METHOD__ );
1216 }
catch ( Exception $e ) {
1221 unlink( $dir .
$file );
1223 if ( $text ==
'exec' ) {
1224 Wikimedia\restoreWarnings();
1231 Wikimedia\restoreWarnings();
1243 if ( function_exists(
'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1248 phpinfo( INFO_MODULES );
1249 $info = ob_get_clean();
1251 return strpos( $info, $moduleName ) !==
false;
1260 $this->parserOptions->setTargetLanguage(
$lang );
1261 $this->parserOptions->setUserLang(
$lang );
1270 return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
1283 switch ( $directory ) {
1289 throw new InvalidArgumentException(
"Invalid extension type" );
1303 if ( $this->
getVar(
'IP' ) ===
null ) {
1304 return Status::newGood( [] );
1307 $extDir = $this->
getVar(
'IP' ) .
'/' . $directory;
1308 if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1309 return Status::newGood( [] );
1312 $dh = opendir( $extDir );
1315 while ( (
$file = readdir( $dh ) ) !==
false ) {
1317 if ( !is_dir(
"$extDir/$file" ) ||
$file[0] ===
'.' ) {
1321 if ( $extStatus->isOK() ) {
1322 $exts[
$file] = $extStatus->value;
1323 } elseif ( $extStatus->hasMessage(
'config-extension-not-found' ) ) {
1325 $status->warning(
'config-extension-not-found',
$file );
1327 $status->merge( $extStatus );
1331 uksort( $exts,
'strnatcasecmp' );
1333 $status->value = $exts;
1346 if ( $this->
getVar(
'IP' ) ===
null ) {
1347 throw new Exception(
'Cannot find extensions since the IP variable is not yet set' );
1349 if (
$type !==
'extension' &&
$type !==
'skin' ) {
1350 throw new InvalidArgumentException(
"Invalid extension type" );
1352 $absDir = $this->
getVar(
'IP' ) .
"/$parentRelPath/$name";
1353 $relDir =
"../$parentRelPath/$name";
1354 if ( !is_dir( $absDir ) ) {
1355 return Status::newFatal(
'config-extension-not-found', $name );
1357 $jsonFile =
$type .
'.json';
1358 $fullJsonFile =
"$absDir/$jsonFile";
1359 $isJson = file_exists( $fullJsonFile );
1363 $fullPhpFile =
"$absDir/$name.php";
1364 $isPhp = file_exists( $fullPhpFile );
1366 if ( !$isJson && !$isPhp ) {
1367 return Status::newFatal(
'config-extension-not-found', $name );
1372 if ( is_dir(
"$absDir/screenshots" ) ) {
1373 $paths = glob(
"$absDir/screenshots/*.png" );
1374 foreach ( $paths as
$path ) {
1375 $info[
'screenshots'][] = str_replace( $absDir, $relDir,
$path );
1381 if ( !$jsonStatus->isOK() ) {
1384 $info += $jsonStatus->value;
1387 return Status::newGood( $info );
1398 private function readExtension( $fullJsonFile, $extDeps = [], $skinDeps = [] ) {
1403 $extDir = $this->
getVar(
'IP' ) .
'/extensions';
1404 foreach ( $extDeps as $dep ) {
1405 $fname =
"$extDir/$dep/extension.json";
1406 if ( !file_exists( $fname ) ) {
1407 return Status::newFatal(
'config-extension-not-found', $dep );
1413 $skinDir = $this->
getVar(
'IP' ) .
'/skins';
1414 foreach ( $skinDeps as $dep ) {
1415 $fname =
"$skinDir/$dep/skin.json";
1416 if ( !file_exists( $fname ) ) {
1417 return Status::newFatal(
'config-extension-not-found', $dep );
1424 $info = $registry->readFromQueue( $load );
1426 if ( $e->incompatibleCore || $e->incompatibleSkins
1427 || $e->incompatibleExtensions
1431 return Status::newFatal(
'config-extension-dependency',
1432 basename( dirname( $fullJsonFile ) ), $e->getMessage() );
1433 } elseif ( $e->missingExtensions || $e->missingSkins ) {
1438 array_merge( $extDeps, $e->missingExtensions ),
1439 array_merge( $skinDeps, $e->missingSkins )
1441 if ( !$status->isOK() && !$status->hasMessage(
'config-extension-dependency' ) ) {
1442 $status = Status::newFatal(
'config-extension-dependency',
1443 basename( dirname( $fullJsonFile ) ), $status->getMessage() );
1448 return Status::newFatal(
'config-extension-dependency',
1449 basename( dirname( $fullJsonFile ) ), $e->getMessage() );
1456 foreach ( $info[
'credits'] as $name => $credit ) {
1462 $type = basename( $credit[
'path'] ) ===
'skin.json' ?
'skins' :
'extensions';
1463 $ret[
'requires'][
$type][] = $credit[
'name'];
1465 $credits = array_values( $info[
'credits'] )[0];
1466 if ( isset( $credits[
'url'] ) ) {
1467 $ret[
'url'] = $credits[
'url'];
1469 $ret[
'type'] = $credits[
'type'];
1471 return Status::newGood( $ret );
1483 $defaultSkin =
$GLOBALS[
'wgDefaultSkin'];
1484 if ( !$skinNames || in_array( $defaultSkin, $skinNames ) ) {
1485 return $defaultSkin;
1487 return $skinNames[0];
1499 $exts = $this->
getVar(
'_Extensions' );
1500 $IP = $this->
getVar(
'IP' );
1504 define(
'MW_EXTENSIONS_LOADED',
true );
1518 require
"$IP/includes/DefaultSettings.php";
1520 foreach ( $exts as $e ) {
1521 if ( file_exists(
"$IP/extensions/$e/extension.json" ) ) {
1522 $queue[
"$IP/extensions/$e/extension.json"] = 1;
1524 require_once
"$IP/extensions/$e/$e.php";
1529 $data = $registry->readFromQueue(
$queue );
1533 $hooksWeWant =
$wgHooks[
'LoadExtensionSchemaUpdates'] ?? [];
1535 if ( isset( $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
1536 $hooksWeWant = array_merge_recursive(
1538 $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates']
1543 $GLOBALS[
'wgHooks'] = [
'LoadExtensionSchemaUpdates' => $hooksWeWant ];
1545 return Status::newGood();
1561 $coreInstallSteps = [
1562 [
'name' =>
'database',
'callback' => [ $installer,
'setupDatabase' ] ],
1563 [
'name' =>
'tables',
'callback' => [ $installer,
'createTables' ] ],
1564 [
'name' =>
'interwiki',
'callback' => [ $installer,
'populateInterwikiTable' ] ],
1565 [
'name' =>
'stats',
'callback' => [ $this,
'populateSiteStats' ] ],
1566 [
'name' =>
'keys',
'callback' => [ $this,
'generateKeys' ] ],
1567 [
'name' =>
'updates',
'callback' => [ $installer,
'insertUpdateKeys' ] ],
1568 [
'name' =>
'sysop',
'callback' => [ $this,
'createSysop' ] ],
1569 [
'name' =>
'mainpage',
'callback' => [ $this,
'createMainpage' ] ],
1574 foreach ( $coreInstallSteps as $step ) {
1575 $this->installSteps[] = $step;
1576 if ( isset( $this->extraInstallSteps[$step[
'name']] ) ) {
1577 $this->installSteps = array_merge(
1578 $this->installSteps,
1579 $this->extraInstallSteps[$step[
'name']]
1585 if ( isset( $this->extraInstallSteps[
'BEGINNING'] ) ) {
1586 $this->installSteps = array_merge(
1587 $this->extraInstallSteps[
'BEGINNING'],
1593 if ( count( $this->
getVar(
'_Extensions' ) ) ) {
1594 array_unshift( $this->installSteps,
1595 [
'name' =>
'extensions',
'callback' => [ $this,
'includeExtensions' ] ]
1597 $this->installSteps[] = [
1598 'name' =>
'extension-tables',
1599 'callback' => [ $installer,
'createExtensionTables' ]
1615 $installResults = [];
1617 $installer->preInstall();
1619 foreach ( $steps as $stepObj ) {
1620 $name = $stepObj[
'name'];
1621 call_user_func_array( $startCB, [ $name ] );
1624 $status = call_user_func( $stepObj[
'callback'], $installer );
1627 call_user_func( $endCB, $name, $status );
1628 $installResults[$name] = $status;
1632 if ( !$status->isOK() ) {
1636 if ( $status->isOK() ) {
1638 'config-install-db-success'
1640 $this->
setVar(
'_InstallDone',
true );
1643 return $installResults;
1652 $keys = [
'wgSecretKey' => 64 ];
1653 if ( strval( $this->
getVar(
'wgUpgradeKey' ) ) ===
'' ) {
1654 $keys[
'wgUpgradeKey'] = 16;
1667 $status = Status::newGood();
1669 foreach (
$keys as $name => $length ) {
1671 $this->
setVar( $name, $secretKey );
1683 $name = $this->
getVar(
'_AdminName' );
1684 $user = User::newFromName( $name );
1688 return Status::newFatal(
'config-admin-error-user', $name );
1691 if ( $user->idForName() == 0 ) {
1692 $user->addToDatabase();
1695 $user->setPassword( $this->
getVar(
'_AdminPassword' ) );
1697 return Status::newFatal(
'config-admin-error-password', $name, $pwe->getMessage() );
1700 $user->addGroup(
'sysop' );
1701 $user->addGroup(
'bureaucrat' );
1702 $user->addGroup(
'interface-admin' );
1703 if ( $this->
getVar(
'_AdminEmail' ) ) {
1704 $user->setEmail( $this->
getVar(
'_AdminEmail' ) );
1706 $user->saveSettings();
1709 $ssUpdate = SiteStatsUpdate::factory( [
'users' => 1 ] );
1710 $ssUpdate->doUpdate();
1712 $status = Status::newGood();
1714 if ( $this->
getVar(
'_Subscribe' ) && $this->
getVar(
'_AdminEmail' ) ) {
1726 'email' => $this->
getVar(
'_AdminEmail' ),
1733 $myLang = $this->
getVar(
'_UserLang' );
1734 if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1735 $myLang = $myLang ==
'pt-br' ?
'pt_BR' : $myLang;
1736 $params[
'language'] = $myLang;
1739 if ( MWHttpRequest::canMakeRequests() ) {
1740 $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
1741 [
'method' =>
'POST',
'postData' => $params ], __METHOD__ )->execute();
1742 if ( !
$res->isOK() ) {
1743 $s->warning(
'config-install-subscribe-fail',
$res->getMessage() );
1746 $s->warning(
'config-install-subscribe-notpossible' );
1757 $status = Status::newGood();
1758 $title = Title::newMainPage();
1759 if (
$title->exists() ) {
1760 $status->warning(
'config-install-mainpage-exists' );
1764 $page = WikiPage::factory(
$title );
1766 wfMessage(
'mainpagetext' )->inContentLanguage()->text() .
"\n\n" .
1767 wfMessage(
'mainpagedocfooter' )->inContentLanguage()->text()
1770 $status = $page->doEditContent(
$content,
1774 User::newSystemUser(
'MediaWiki default' )
1776 }
catch ( Exception $e ) {
1778 $status->fatal(
'config-install-mainpage-failed', $e->getMessage() );
1790 if ( !defined(
'MW_NO_SESSION_HANDLER' ) ) {
1791 define(
'MW_NO_SESSION_HANDLER', 1 );
1795 $GLOBALS[
'wgUseDatabaseMessages'] =
false;
1799 $GLOBALS[
'wgShowExceptionDetails'] =
true;
1800 $GLOBALS[
'wgShowHostnames'] =
true;
1802 $GLOBALS[
'wgExternalLinkTarget'] =
'_blank';
1805 $GLOBALS[
'wgDisableOutputCompression'] =
true;
1808 $GLOBALS[
'wgCookiePrefix'] =
'mw_installer';
1817 'class' => InstallerSessionProvider::class,
1829 $GLOBALS[
'wgServer'] =
'https://🌻.invalid';
1840 $this->extraInstallSteps[$findStep][] = $callback;
1848 Wikimedia\suppressWarnings();
1849 set_time_limit( 0 );
1850 Wikimedia\restoreWarnings();
$wgObjectCaches
Advanced object cache configuration.
$wgStyleDirectory
Filesystem stylesheets directory.
$wgExtensionDirectory
Filesystem extensions directory.
$wgExternalLinkTarget
Set a default target for external links, e.g.
wfIsWindows()
Check if the operating system is Windows.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfIsHHVM()
Check if we are running under HHVM.
$wgAutoloadClasses['ReplaceTextHooks']
Base class for DBMS-specific installation helper classes.
getConnection()
Connect to the database using the administrative user/password currently defined in the session.
Copyright (C) 2018 Kunal Mehta legoktm@member.fsf.org
Accesses configuration settings from $GLOBALS.
A Config instance which stores all settings as a member variable.
envPrepServer()
Environment prep for the server hostname.
parse( $text, $lineStart=false)
Convert wikitext $text to HTML.
array $compiledDBs
List of detected DBs, access using getCompiledDBs().
getExtensionInfo( $type, $parentRelPath, $name)
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 is incompatibl...
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().
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....
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
static getInstallerConfig(Config $baseConfig)
Constructs a Config object that contains configuration settings that should be overwritten for the in...
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.
findExtensionsByType( $type='extension', $directory='extensions')
Find extensions or skins, and return an array containing the value for 'Name' for each found extensio...
doGenerateKeys( $keys)
Generate a secret value for variables using a secure generator.
showStatusMessage(Status $status)
Show a message to the installing user by using a Status object.
readExtension( $fullJsonFile, $extDeps=[], $skinDeps=[])
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, bureaucrat and interface-admin 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.
showMessage( $msg,... $params)
UI interface for displaying a short message The parameters are like parameters to wfMessage().
showError( $msg,... $params)
Same as showMessage(), but for displaying errors.
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')
Find extensions or skins in a subdirectory of $IP.
static generateHex( $chars)
Generate a run of 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.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Represents a title within MediaWiki.
Class for the core installer web interface.
Content object for wiki text pages.
Interface for configuration instances.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!is_readable( $file)) $ext
if(!isset( $args[0])) $lang