130 'envCheckModSecurity',
136 'envCheckShellLocale',
137 'envCheckUploadsDirectory',
139 'envCheckSuhosinMaxValueLength',
171 'wgEmailAuthentication',
175 'wgImageMagickConvertCommand',
180 'wgDeletedDirectory',
184 'wgUseInstantCommons',
199 '_Environment' =>
false,
200 '_RaiseMemory' =>
false,
201 '_UpgradeDone' =>
false,
202 '_InstallDone' =>
false,
204 '_InstallPassword' =>
'',
205 '_SameAccount' =>
true,
206 '_CreateDBAccount' =>
false,
207 '_NamespaceType' =>
'site-name',
209 '_AdminPassword' =>
'',
210 '_AdminPasswordConfirm' =>
'',
212 '_Subscribe' =>
false,
213 '_SkipOptional' =>
'continue',
214 '_RightsProfile' =>
'wiki',
215 '_LicenseCode' =>
'none',
219 '_MemCachedServers' =>
'',
220 '_UpgradeKeySupplied' =>
false,
221 '_ExistingDBSettings' =>
false,
225 'wgLogo' =>
'$wgResourceBasePath/resources/assets/wiki.png',
226 'wgAuthenticationTokenVersion' => 1,
249 'apc' =>
'apc_fetch',
250 'apcu' =>
'apcu_fetch',
251 'wincache' =>
'wincache_ucache_get'
262 '*' => [
'edit' =>
false ]
266 'createaccount' =>
false,
272 'createaccount' =>
false,
286 'url' =>
'https://creativecommons.org/licenses/by/4.0/',
287 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by.png',
290 'url' =>
'https://creativecommons.org/licenses/by-sa/4.0/',
291 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png',
294 'url' =>
'https://creativecommons.org/licenses/by-nc-sa/4.0/',
295 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-nc-sa.png',
298 'url' =>
'https://creativecommons.org/publicdomain/zero/1.0/',
299 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-0.png',
302 'url' =>
'https://www.gnu.org/copyleft/fdl.html',
303 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/gnu-fdl.png',
322 'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
328 'ca',
'cs',
'da',
'de',
'en',
'es',
'et',
'eu',
'fi',
'fr',
'hr',
'hu',
329 'it',
'ja',
'ko',
'lt',
'nl',
'no',
'pl',
'pt',
'pt-br',
'ro',
'ru',
330 '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 ) {
394 $configOverrides->set(
'ConfigRegistry', $configRegistry );
409 MediaWikiServices::resetGlobalInstance( $installerConfig );
413 RequestContext::getMain()->setLanguage(
'en' );
417 Language::getLocalisationCache()->disableBackend();
420 MediaWikiServices::disableStorageBackend();
422 $mwServices = MediaWikiServices::getInstance();
429 $mwServices->redefineService(
'InterwikiLookup',
function () {
435 RequestContext::getMain()->setUser( $wgUser );
439 foreach ( $this->defaultVarNames as $var ) {
445 $this->compiledDBs = [];
446 foreach ( self::getDBTypes() as
$type ) {
449 if ( !$installer->isCompiled() ) {
452 $this->compiledDBs[] =
$type;
455 $this->parserTitle = Title::newFromText(
'Installer' );
457 $this->parserOptions->setTidy(
true );
488 $this->
showMessage(
'config-env-hhvm', HHVM_VERSION );
490 $this->
showMessage(
'config-env-php', PHP_VERSION );
495 list( $pcreVersion ) = explode(
' ', PCRE_VERSION, 2 );
496 if (
version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION,
'<' ) ) {
497 $this->
showError(
'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
500 foreach ( $this->envChecks as $check ) {
508 $this->
setVar(
'_Environment', $good );
510 return $good ? Status::newGood() : Status::newFatal(
'config-env-bad' );
514 foreach ( $this->envPreps as $prep ) {
539 public function getVar( $name, $default =
null ) {
560 return ucfirst(
$type ) .
'Installer';
579 $this->dbInstallers[
$type] =
new $class( $this );
582 return $this->dbInstallers[
$type];
607 $_lsExists =
file_exists(
"$IP/LocalSettings.php" );
615 require
"$IP/includes/DefaultSettings.php";
616 require
"$IP/LocalSettings.php";
660 # I don't know this, this isn't UNIX.
664 # posix_getegid() *not* getmygid() because we want the group of the webserver,
665 # not whoever owns the current script.
688 public function parse( $text, $lineStart =
false ) {
689 $parser = MediaWikiServices::getInstance()->getParser();
692 $out =
$parser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
694 'enableSectionEditLinks' =>
false,
698 }
catch (
Wikimedia\Services\ServiceDisabledException
$e ) {
713 $this->parserOptions->setExternalLinkTarget(
false );
730 $status = $installer->getConnection();
738 'ss_total_edits' => 0,
739 'ss_good_articles' => 0,
740 'ss_total_pages' => 0,
742 'ss_active_users' => 0,
748 return Status::newGood();
762 foreach ( self::getDBTypes() as $name ) {
763 $allNames[] =
wfMessage(
"config-type-$name" )->text();
771 $status = $installer->checkPrerequisites();
776 unset( $databases[$db] );
781 $this->
showError(
'config-no-db', $wgLang->commaList( $allNames ), count( $allNames ) );
797 $this->
showError(
'config-brokenlibxml' );
815 $regexd =
preg_replace(
'/[\x{0430}-\x{04FF}]/iu',
'',
'-АБВГД-' );
820 $regexprop =
preg_replace(
'/\p{Zs}/u',
'',
"-\u{3000}-" );
822 if ( $regexd !=
'--' || $regexprop !=
'--' ) {
823 $this->
showError(
'config-pcre-no-utf8' );
836 $limit =
ini_get(
'memory_limit' );
838 if ( !$limit || $limit == -1 ) {
844 if ( $n < $this->minMemorySize * 1024 * 1024 ) {
845 $newLimit =
"{$this->minMemorySize}M";
847 if (
ini_set(
"memory_limit", $newLimit ) ===
false ) {
850 $this->
showMessage(
'config-memory-raised', $limit, $newLimit );
851 $this->
setVar(
'_RaiseMemory',
true );
863 foreach ( $this->objectCaches as $name => $function ) {
865 $caches[
$name] =
true;
873 $this->
setVar(
'_Caches', $caches );
881 if ( self::apacheModulePresent(
'mod_security' )
882 || self::apacheModulePresent(
'mod_security2' ) ) {
894 $names = [
"gdiff3",
"diff3" ];
896 $names[] =
'diff3.exe';
898 $versionInfo = [
'--version',
'GNU diffutils' ];
900 $diff3 = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
903 $this->
setVar(
'wgDiff3', $diff3 );
905 $this->
setVar(
'wgDiff3',
false );
917 $names =
wfIsWindows() ?
'convert.exe' :
'convert';
918 $versionInfo = [
'-version',
'ImageMagick' ];
919 $convert = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
921 $this->
setVar(
'wgImageMagickConvertCommand',
'' );
923 $this->
setVar(
'wgImageMagickConvertCommand', $convert );
924 $this->
showMessage(
'config-imagemagick', $convert );
944 $versionInfo = [
'--version',
'git version' ];
946 $git = ExecutableFinder::findInDefaultPaths( $names, $versionInfo );
949 $this->
setVar(
'wgGitBin', $git );
952 $this->
setVar(
'wgGitBin',
false );
966 if ( $server !==
null ) {
967 $this->
showMessage(
'config-using-server', $server );
980 $this->
getVar(
'wgServer' ),
981 $this->
getVar(
'wgScriptPath' )
992 $supported = [
'Linux',
'SunOS',
'HP-UX',
'Darwin' ]; # Tested these
994 if ( !
in_array( $os, $supported ) ) {
998 if ( Shell::isDisabled() ) {
1002 # Get a list of available locales.
1003 $result = Shell::command(
'/usr/bin/locale',
'-a' )
1006 if ( $result->getExitCode() != 0 ) {
1010 $lines = $result->getStdout();
1012 $candidatesByLocale = [];
1013 $candidatesByLang = [];
1015 if (
$line ===
'' ) {
1019 if ( !
preg_match(
'/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i',
$line, $m ) ) {
1025 $candidatesByLocale[$m[0]] = $m;
1026 $candidatesByLang[
$lang][] = $m;
1029 # Try the current value of LANG.
1030 if (
isset( $candidatesByLocale[
getenv(
'LANG' )] ) ) {
1036 # Try the most common ones.
1037 $commonLocales = [
'C.UTF-8',
'en_US.UTF-8',
'en_US.utf8',
'de_DE.UTF-8',
'de_DE.utf8' ];
1038 foreach ( $commonLocales as $commonLocale ) {
1039 if (
isset( $candidatesByLocale[$commonLocale] ) ) {
1040 $this->
setVar(
'wgShellLocale', $commonLocale );
1046 # Is there an available locale in the Wiki's language?
1047 $wikiLang = $this->
getVar(
'wgLanguageCode' );
1049 if (
isset( $candidatesByLang[$wikiLang] ) ) {
1050 $m = reset( $candidatesByLang[$wikiLang] );
1051 $this->
setVar(
'wgShellLocale', $m[0] );
1056 # Are there any at all?
1057 if ( count( $candidatesByLocale ) ) {
1058 $m = reset( $candidatesByLocale );
1059 $this->
setVar(
'wgShellLocale', $m[0] );
1075 $dir =
$IP .
'/images/';
1076 $url = $this->
getVar(
'wgServer' ) . $this->
getVar(
'wgScriptPath' ) .
'/images/';
1080 $this->
showMessage(
'config-uploads-not-safe', $dir );
1092 $maxValueLength =
ini_get(
'suhosin.get.max_value_length' );
1093 if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1095 $this->
showMessage(
'config-suhosin-max-value-length', $maxValueLength );
1108 if ( PHP_INT_SIZE == 4 ) {
1126 $not_normal_c =
"\u{FA6C}";
1127 $normal_c =
"\u{242EE}";
1129 $useNormalizer =
'php';
1130 $needsUpdate =
false;
1133 $useNormalizer =
'intl';
1135 if ( $intl !== $normal_c ) {
1136 $needsUpdate =
true;
1141 if ( $useNormalizer ===
'php' ) {
1142 $this->
showMessage(
'config-unicode-pure-php-warning' );
1144 $this->
showMessage(
'config-unicode-using-' . $useNormalizer );
1145 if ( $needsUpdate ) {
1146 $this->
showMessage(
'config-unicode-update-warning' );
1156 if ( $server !==
null ) {
1157 $this->
setVar(
'wgServer', $server );
1173 $this->
setVar(
'IP', $IP );
1187 "<?php echo 'exec';",
1188 "#!/var/env php\n<?php echo 'exec';",
1196 foreach ( $scriptTypes as
$ext => $contents ) {
1197 foreach ( $contents as
$source ) {
1198 $file =
'exectest.' .
$ext;
1205 $text =
Http::get( $url . $file, [
'timeout' => 3 ], __METHOD__ );
1206 }
catch ( Exception
$e ) {
1212 if ( $text ==
'exec' ) {
1240 return strpos( $info, $moduleName ) !==
false;
1249 $this->parserOptions->setTargetLanguage(
$lang );
1250 $this->parserOptions->setUserLang(
$lang );
1259 return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
1271 switch ( $directory ) {
1277 throw new InvalidArgumentException(
"Invalid extension type" );
1290 if ( $this->
getVar(
'IP' ) ===
null ) {
1294 $extDir = $this->
getVar(
'IP' ) .
'/' . $directory;
1301 while ( ( $file =
readdir( $dh ) ) !==
false ) {
1302 if ( !
is_dir(
"$extDir/$file" ) ) {
1311 uksort( $exts,
'strnatcasecmp' );
1324 if ( $this->
getVar(
'IP' ) ===
null ) {
1325 throw new Exception(
'Cannot find extensions since the IP variable is not yet set' );
1327 if (
$type !==
'extension' &&
$type !==
'skin' ) {
1328 throw new InvalidArgumentException(
"Invalid extension type" );
1330 $absDir = $this->
getVar(
'IP' ) .
"/$parentRelPath/$name";
1331 $relDir =
"../$parentRelPath/$name";
1332 if ( !
is_dir( $absDir ) ) {
1333 return Status::newFatal(
'config-extension-not-found', $name );
1335 $jsonFile =
$type .
'.json';
1336 $fullJsonFile =
"$absDir/$jsonFile";
1341 $fullPhpFile =
"$absDir/$name.php";
1344 if ( !$isJson && !$isPhp ) {
1345 return Status::newFatal(
'config-extension-not-found', $name );
1350 if (
is_dir(
"$absDir/screenshots" ) ) {
1351 $paths =
glob(
"$absDir/screenshots/*.png" );
1352 foreach ( $paths as $path ) {
1353 $info[
'screenshots'][] =
str_replace( $absDir, $relDir, $path );
1359 if ( !$jsonStatus->isOK() ) {
1362 $info += $jsonStatus->value;
1365 return Status::newGood( $info );
1376 private function readExtension( $fullJsonFile, $extDeps = [], $skinDeps = [] ) {
1381 $extDir = $this->
getVar(
'IP' ) .
'/extensions';
1382 foreach ( $extDeps as $dep ) {
1383 $fname =
"$extDir/$dep/extension.json";
1385 return Status::newFatal(
'config-extension-not-found', $dep );
1391 $skinDir = $this->
getVar(
'IP' ) .
'/skins';
1392 foreach ( $skinDeps as $dep ) {
1393 $fname =
"$skinDir/$dep/skin.json";
1395 return Status::newFatal(
'config-extension-not-found', $dep );
1402 $info = $registry->readFromQueue( $load );
1404 if (
$e->incompatibleCore ||
$e->incompatibleSkins
1405 ||
$e->incompatibleExtensions
1409 return Status::newFatal(
'config-extension-dependency',
1411 }
elseif (
$e->missingExtensions ||
$e->missingSkins ) {
1417 array_merge( $skinDeps,
$e->missingSkins )
1421 return Status::newFatal(
'config-extension-dependency',
1429 foreach ( $info[
'credits'] as $name => $credit ) {
1435 $type =
basename( $credit[
'path'] ) ===
'skin.json' ?
'skins' :
'extensions';
1436 $ret[
'requires'][
$type][] = $credit[
'name'];
1439 if (
isset( $credits[
'url'] ) ) {
1440 $ret[
'url'] = $credits[
'url'];
1442 $ret[
'type'] = $credits[
'type'];
1444 return Status::newGood(
$ret );
1456 $defaultSkin =
$GLOBALS[
'wgDefaultSkin'];
1457 if ( !$skinNames ||
in_array( $defaultSkin, $skinNames ) ) {
1460 return $skinNames[0];
1472 $exts = $this->
getVar(
'_Extensions' );
1473 $IP = $this->
getVar(
'IP' );
1477 define(
'MW_EXTENSIONS_LOADED',
true );
1491 require
"$IP/includes/DefaultSettings.php";
1493 foreach ( $exts as
$e ) {
1494 if (
file_exists(
"$IP/extensions/$e/extension.json" ) ) {
1495 $queue[
"$IP/extensions/$e/extension.json"] = 1;
1497 require_once
"$IP/extensions/$e/$e.php";
1506 $hooksWeWant =
$wgHooks[
'LoadExtensionSchemaUpdates'] ?? [];
1508 if (
isset(
$data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
1511 $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates']
1518 return Status::newGood();
1534 $coreInstallSteps = [
1535 [
'name' =>
'database',
'callback' => [
$installer,
'setupDatabase' ] ],
1536 [
'name' =>
'tables',
'callback' => [
$installer,
'createTables' ] ],
1537 [
'name' =>
'interwiki',
'callback' => [
$installer,
'populateInterwikiTable' ] ],
1538 [
'name' =>
'stats',
'callback' => [
$this,
'populateSiteStats' ] ],
1539 [
'name' =>
'keys',
'callback' => [
$this,
'generateKeys' ] ],
1540 [
'name' =>
'updates',
'callback' => [
$installer,
'insertUpdateKeys' ] ],
1541 [
'name' =>
'sysop',
'callback' => [
$this,
'createSysop' ] ],
1542 [
'name' =>
'mainpage',
'callback' => [
$this,
'createMainpage' ] ],
1547 foreach ( $coreInstallSteps as $step ) {
1548 $this->installSteps[] =
$step;
1549 if (
isset( $this->extraInstallSteps[$step[
'name']] ) ) {
1551 $this->installSteps,
1552 $this->extraInstallSteps[$step[
'name']]
1558 if (
isset( $this->extraInstallSteps[
'BEGINNING'] ) ) {
1560 $this->extraInstallSteps[
'BEGINNING'],
1566 if ( count( $this->
getVar(
'_Extensions' ) ) ) {
1568 [
'name' =>
'extensions',
'callback' => [ $this,
'includeExtensions' ] ]
1570 $this->installSteps[] = [
1571 'name' =>
'extension-tables',
1572 'callback' => [
$installer,
'createExtensionTables' ]
1588 $installResults = [];
1590 $installer->preInstall();
1592 foreach ( $steps as $stepObj ) {
1593 $name = $stepObj[
'name'];
1611 'config-install-db-success'
1613 $this->
setVar(
'_InstallDone',
true );
1625 $keys = [
'wgSecretKey' => 64 ];
1626 if (
strval( $this->
getVar(
'wgUpgradeKey' ) ) ===
'' ) {
1627 $keys[
'wgUpgradeKey'] = 16;
1642 foreach (
$keys as $name => $length ) {
1644 $this->
setVar( $name, $secretKey );
1656 $name = $this->
getVar(
'_AdminName' );
1661 return Status::newFatal(
'config-admin-error-user', $name );
1664 if ( $user->idForName() == 0 ) {
1665 $user->addToDatabase();
1668 $user->setPassword( $this->
getVar(
'_AdminPassword' ) );
1670 return Status::newFatal(
'config-admin-error-password', $name, $pwe->getMessage() );
1673 $user->addGroup(
'sysop' );
1674 $user->addGroup(
'bureaucrat' );
1675 $user->addGroup(
'interface-admin' );
1676 if ( $this->
getVar(
'_AdminEmail' ) ) {
1677 $user->setEmail( $this->
getVar(
'_AdminEmail' ) );
1679 $user->saveSettings();
1682 $ssUpdate = SiteStatsUpdate::factory( [
'users' => 1 ] );
1683 $ssUpdate->doUpdate();
1687 if ( $this->
getVar(
'_Subscribe' ) && $this->
getVar(
'_AdminEmail' ) ) {
1699 'email' => $this->
getVar(
'_AdminEmail' ),
1706 $myLang = $this->
getVar(
'_UserLang' );
1707 if (
in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1708 $myLang = $myLang ==
'pt-br' ?
'pt_BR' :
$myLang;
1712 if ( MWHttpRequest::canMakeRequests() ) {
1713 $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
1714 [
'method' =>
'POST',
'postData' =>
$params ], __METHOD__ )->execute();
1715 if ( !
$res->isOK() ) {
1716 $s->warning(
'config-install-subscribe-fail',
$res->getMessage() );
1719 $s->warning(
'config-install-subscribe-notpossible' );
1731 $title = Title::newMainPage();
1732 if ( $title->exists() ) {
1733 $status->warning(
'config-install-mainpage-exists' );
1737 $page = WikiPage::factory( $title );
1739 wfMessage(
'mainpagetext' )->inContentLanguage()->
text() .
"\n\n" .
1740 wfMessage(
'mainpagedocfooter' )->inContentLanguage()->
text()
1749 }
catch ( Exception
$e ) {
1751 $status->fatal(
'config-install-mainpage-failed',
$e->getMessage() );
1763 define(
'MW_NO_SESSION_HANDLER', 1 );
1766 $GLOBALS[
'wgUseDatabaseMessages'] =
false;
1770 $GLOBALS[
'wgShowExceptionDetails'] =
true;
1771 $GLOBALS[
'wgShowHostnames'] =
true;
1773 $GLOBALS[
'wgExternalLinkTarget'] =
'_blank';
1776 $GLOBALS[
'wgDisableOutputCompression'] =
true;
1779 $GLOBALS[
'wgCookiePrefix'] =
'mw_installer';
1788 'class' => InstallerSessionProvider::class,
1807 $this->extraInstallSteps[
$findStep][] = $callback;
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$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.
wfIsHHVM()
Check if we are running under HHVM.
$wgAutoloadClasses['ReplaceTextHooks']
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Base class for DBMS-specific installation helper classes.
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.
static get( $url, array $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
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 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().
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...
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.
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.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static newFromId( $id)
Static factory method for creation from a given user ID.
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
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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 & $ret
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 use $formDescriptor instead 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 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. 'ContentSecurityPolicyDefaultSource':Modify the allowed CSP load sources. This affects all directives except for the script directive. If you want to add a script source, see ContentSecurityPolicyScriptSource hook. & $defaultSrc:Array of Content-Security-Policy allowed sources $policyConfig:Current configuration for the Content-Security-Policy header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyDirectives':Modify the content security policy directives. Use this only if ContentSecurityPolicyDefaultSource and ContentSecurityPolicyScriptSource do not meet your needs. & $directives:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyScriptSource':Modify the allowed CSP script sources. Note that you also have to use ContentSecurityPolicyDefaultSource if you want non-script sources to be loaded from whatever you add. & $scriptSrc:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header '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). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. '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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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 $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
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
Interface for configuration instances.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!is_readable( $file)) $ext
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
if(!isset( $args[0])) $lang