126 'envCheckModSecurity',
132 'envCheckShellLocale',
133 'envCheckUploadsDirectory',
135 'envCheckSuhosinMaxValueLength',
166 'wgEmailAuthentication',
170 'wgImageMagickConvertCommand',
175 'wgDeletedDirectory',
179 'wgUseInstantCommons',
193 '_Environment' =>
false,
194 '_RaiseMemory' =>
false,
195 '_UpgradeDone' =>
false,
196 '_InstallDone' =>
false,
198 '_InstallPassword' =>
'',
199 '_SameAccount' =>
true,
200 '_CreateDBAccount' =>
false,
201 '_NamespaceType' =>
'site-name',
203 '_AdminPassword' =>
'',
204 '_AdminPasswordConfirm' =>
'',
206 '_Subscribe' =>
false,
207 '_SkipOptional' =>
'continue',
208 '_RightsProfile' =>
'wiki',
209 '_LicenseCode' =>
'none',
213 '_MemCachedServers' =>
'',
214 '_UpgradeKeySupplied' =>
false,
215 '_ExistingDBSettings' =>
false,
219 'wgLogo' =>
'$wgResourceBasePath/resources/assets/wiki.png',
220 'wgAuthenticationTokenVersion' => 1,
243 'xcache' =>
'xcache_get',
244 'apc' =>
'apc_fetch',
245 'apcu' =>
'apcu_fetch',
246 'wincache' =>
'wincache_ucache_get'
257 '*' => [
'edit' =>
false ]
261 'createaccount' =>
false,
267 'createaccount' =>
false,
281 'url' =>
'https://creativecommons.org/licenses/by/4.0/',
282 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by.png',
285 'url' =>
'https://creativecommons.org/licenses/by-sa/4.0/',
286 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png',
289 'url' =>
'https://creativecommons.org/licenses/by-nc-sa/4.0/',
290 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-by-nc-sa.png',
293 'url' =>
'https://creativecommons.org/publicdomain/zero/1.0/',
294 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/cc-0.png',
298 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/public-domain.png',
301 'url' =>
'https://www.gnu.org/copyleft/fdl.html',
302 'icon' =>
'$wgResourceBasePath/resources/assets/licenses/gnu-fdl.png',
321 'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
327 'ca',
'cs',
'da',
'de',
'en',
'es',
'et',
'eu',
'fi',
'fr',
'hr',
'hu',
328 'it',
'ja',
'ko',
'lt',
'nl',
'no',
'pl',
'pt',
'pt-br',
'ro',
'ru',
329 'sl',
'sr',
'sv',
'tr',
'uk'
345 abstract public function showError( $msg );
372 $emptyCache = [
'class' =>
'EmptyBagOStuff' ];
383 $wgMessagesDirs[
'MediawikiInstaller'] = __DIR__ .
'/i18n';
391 foreach ( $this->defaultVarNames
as $var ) {
392 $this->
settings[$var] = $GLOBALS[$var];
397 $this->compiledDBs = [];
398 foreach ( self::getDBTypes()
as $type ) {
401 if ( !$installer->isCompiled() ) {
404 $this->compiledDBs[] =
$type;
409 $this->parserOptions->setEditSection(
false );
418 return self::$dbTypes;
438 $this->
showMessage(
'config-env-hhvm', HHVM_VERSION );
440 $this->
showMessage(
'config-env-php', PHP_VERSION );
445 list( $pcreVersion ) = explode(
' ', PCRE_VERSION, 2 );
446 if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION,
'<' ) ) {
447 $this->
showError(
'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
450 foreach ( $this->envChecks
as $check ) {
458 $this->
setVar(
'_Environment', $good );
464 foreach ( $this->envPreps
as $prep ) {
520 if ( !isset( $this->dbInstallers[
$type] ) ) {
521 $class = ucfirst( $type ) .
'Installer';
522 $this->dbInstallers[
$type] =
new $class( $this );
525 return $this->dbInstallers[
$type];
542 $wgAutoloadClasses = [];
550 MediaWiki\suppressWarnings();
551 $_lsExists = file_exists(
"$IP/LocalSettings.php" );
552 MediaWiki\restoreWarnings();
559 require
"$IP/includes/DefaultSettings.php";
560 require
"$IP/LocalSettings.php";
562 return get_defined_vars();
575 return str_repeat(
'*', strlen( $realPassword ) );
586 if ( !preg_match(
'/^\*+$/',
$value ) ) {
603 if ( !function_exists(
'posix_getegid' ) || !function_exists(
'posix_getpwuid' ) ) {
604 # I don't know this, this isn't UNIX.
608 # posix_getegid() *not* getmygid() because we want the group of the webserver,
609 # not whoever owns the current script.
610 $gid = posix_getegid();
611 $group = posix_getpwuid( $gid )[
'name'];
632 public function parse( $text, $lineStart =
false ) {
636 $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart );
639 $html =
'<!--DB access attempted during parse--> ' . htmlspecialchars( $text );
641 if ( !empty( $this->debug ) ) {
642 $html .=
"<!--\n" . $e->getTraceAsString() .
"\n-->";
657 $this->parserOptions->setExternalLinkTarget(
false );
661 global $wgExternalLinkTarget;
662 $this->parserOptions->setExternalLinkTarget( $wgExternalLinkTarget );
682 'ss_total_edits' => 0,
683 'ss_good_articles' => 0,
684 'ss_total_pages' => 0,
705 foreach ( self::getDBTypes()
as $name ) {
706 $allNames[] =
wfMessage(
"config-type-$name" )->text();
711 $databases = array_flip( $databases );
712 foreach ( array_keys( $databases )
as $db ) {
714 $status = $installer->checkPrerequisites();
719 unset( $databases[$db] );
722 $databases = array_flip( $databases );
724 $this->
showError(
'config-no-db', $wgLang->commaList( $allNames ), count( $allNames ) );
740 $this->
showError(
'config-brokenlibxml' );
757 MediaWiki\suppressWarnings();
758 $regexd = preg_replace(
'/[\x{0430}-\x{04FF}]/iu',
'',
'-АБВГД-' );
763 $regexprop = preg_replace(
'/\p{Zs}/u',
'',
"-\xE3\x80\x80-" );
764 MediaWiki\restoreWarnings();
765 if ( $regexd !=
'--' || $regexprop !=
'--' ) {
766 $this->
showError(
'config-pcre-no-utf8' );
779 $limit = ini_get(
'memory_limit' );
787 if ( $n < $this->minMemorySize * 1024 * 1024 ) {
788 $newLimit =
"{$this->minMemorySize}M";
790 if ( ini_set(
"memory_limit", $newLimit ) ===
false ) {
794 $this->
setVar(
'_RaiseMemory',
true );
806 foreach ( $this->objectCaches
as $name => $function ) {
807 if ( function_exists( $function ) ) {
811 $caches[
$name] =
true;
816 $key =
'config-no-cache-apcu';
820 $this->
setVar(
'_Caches', $caches );
828 if ( self::apacheModulePresent(
'mod_security' )
829 || self::apacheModulePresent(
'mod_security2' ) ) {
841 $names = [
"gdiff3",
"diff3",
"diff3.exe" ];
842 $versionInfo = [
'$1 --version 2>&1',
'GNU diffutils' ];
844 $diff3 = self::locateExecutableInDefaultPaths( $names, $versionInfo );
847 $this->
setVar(
'wgDiff3', $diff3 );
849 $this->
setVar(
'wgDiff3',
false );
861 $names = [
wfIsWindows() ?
'convert.exe' :
'convert' ];
862 $versionInfo = [
'$1 -version',
'ImageMagick' ];
863 $convert = self::locateExecutableInDefaultPaths( $names, $versionInfo );
865 $this->
setVar(
'wgImageMagickConvertCommand',
'' );
867 $this->
setVar(
'wgImageMagickConvertCommand', $convert );
868 $this->
showMessage(
'config-imagemagick', $convert );
871 } elseif ( function_exists(
'imagejpeg' ) ) {
888 $versionInfo = [
'$1 --version',
'git version' ];
890 $git = self::locateExecutableInDefaultPaths( $names, $versionInfo );
893 $this->
setVar(
'wgGitBin', $git );
896 $this->
setVar(
'wgGitBin',
false );
910 if ( $server !== null ) {
911 $this->
showMessage(
'config-using-server', $server );
924 $this->
getVar(
'wgServer' ),
925 $this->
getVar(
'wgScriptPath' )
935 $os = php_uname(
's' );
936 $supported = [
'Linux',
'SunOS',
'HP-UX',
'Darwin' ]; # Tested these
938 if ( !in_array( $os, $supported ) ) {
942 # Get a list of available locales.
951 $candidatesByLocale = [];
952 $candidatesByLang = [];
955 if ( $line ===
'' ) {
959 if ( !preg_match(
'/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
965 $candidatesByLocale[$m[0]] = $m;
966 $candidatesByLang[
$lang][] = $m;
969 # Try the current value of LANG.
970 if ( isset( $candidatesByLocale[getenv(
'LANG' )] ) ) {
971 $this->
setVar(
'wgShellLocale', getenv(
'LANG' ) );
976 # Try the most common ones.
977 $commonLocales = [
'en_US.UTF-8',
'en_US.utf8',
'de_DE.UTF-8',
'de_DE.utf8' ];
978 foreach ( $commonLocales
as $commonLocale ) {
979 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
980 $this->
setVar(
'wgShellLocale', $commonLocale );
986 # Is there an available locale in the Wiki's language?
987 $wikiLang = $this->
getVar(
'wgLanguageCode' );
989 if ( isset( $candidatesByLang[$wikiLang] ) ) {
990 $m = reset( $candidatesByLang[$wikiLang] );
991 $this->
setVar(
'wgShellLocale', $m[0] );
996 # Are there any at all?
997 if ( count( $candidatesByLocale ) ) {
998 $m = reset( $candidatesByLocale );
999 $this->
setVar(
'wgShellLocale', $m[0] );
1015 $dir = $IP .
'/images/';
1016 $url = $this->
getVar(
'wgServer' ) . $this->
getVar(
'wgScriptPath' ) .
'/images/';
1032 $maxValueLength = ini_get(
'suhosin.get.max_value_length' );
1033 if ( $maxValueLength > 0 && $maxValueLength < 1024 ) {
1035 $this->
showMessage(
'config-suhosin-max-value-length', $maxValueLength );
1050 } elseif ( $c <= 0x7FF ) {
1051 return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
1052 } elseif ( $c <= 0xFFFF ) {
1053 return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F ) .
1054 chr( 0x80 | $c & 0x3F );
1055 } elseif ( $c <= 0x10FFFF ) {
1056 return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F ) .
1057 chr( 0x80 | $c >> 6 & 0x3F ) .
1058 chr( 0x80 | $c & 0x3F );
1078 $useNormalizer =
'php';
1079 $needsUpdate =
false;
1081 if ( function_exists(
'normalizer_normalize' ) ) {
1082 $useNormalizer =
'intl';
1083 $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
1084 if ( $intl !== $normal_c ) {
1085 $needsUpdate =
true;
1090 if ( $useNormalizer ===
'php' ) {
1091 $this->
showMessage(
'config-unicode-pure-php-warning' );
1093 $this->
showMessage(
'config-unicode-using-' . $useNormalizer );
1094 if ( $needsUpdate ) {
1095 $this->
showMessage(
'config-unicode-update-warning' );
1105 if ( $server !== null ) {
1106 $this->
setVar(
'wgServer', $server );
1121 $IP = dirname( dirname( __DIR__ ) );
1122 $this->
setVar(
'IP', $IP );
1134 [
'/usr/bin',
'/usr/local/bin',
'/opt/csw/bin',
1135 '/usr/gnu/bin',
'/usr/sfw/bin',
'/sw/bin',
'/opt/local/bin' ],
1136 explode( PATH_SEPARATOR, getenv(
'PATH' ) )
1158 if ( !is_array( $names ) ) {
1159 $names = [ $names ];
1165 MediaWiki\suppressWarnings();
1166 $file_exists = file_exists(
$command );
1167 MediaWiki\restoreWarnings();
1169 if ( $file_exists ) {
1170 if ( !$versionInfo ) {
1175 if ( strstr(
wfShellExec( $file ), $versionInfo[1] ) !==
false ) {
1197 foreach ( self::getPossibleBinPaths()
as $path ) {
1198 $exe = self::locateExecutable( $path, $names, $versionInfo );
1199 if ( $exe !==
false ) {
1218 "<?php echo 'ex' . 'ec';",
1219 "#!/var/env php5\n<?php echo 'ex' . 'ec';",
1225 MediaWiki\suppressWarnings();
1227 foreach ( $scriptTypes
as $ext => $contents ) {
1229 $file =
'exectest.' .
$ext;
1231 if ( !file_put_contents(
$dir . $file, $source ) ) {
1236 $text =
Http::get( $url . $file, [
'timeout' => 3 ], __METHOD__ );
1241 unlink(
$dir . $file );
1243 if ( $text ==
'exec' ) {
1244 MediaWiki\restoreWarnings();
1251 MediaWiki\restoreWarnings();
1263 if ( function_exists(
'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) {
1268 phpinfo( INFO_MODULES );
1269 $info = ob_get_clean();
1271 return strpos( $info, $moduleName ) !==
false;
1280 $this->parserOptions->setTargetLanguage(
$lang );
1281 $this->parserOptions->setUserLang(
$lang );
1290 return "{$_SERVER['PHP_SELF']}?page=" . urlencode(
$page );
1303 if ( $this->
getVar(
'IP' ) === null ) {
1307 $extDir = $this->
getVar(
'IP' ) .
'/' . $directory;
1308 if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
1313 $jsonFile = substr( $directory, 0, strlen( $directory ) -1 ) .
'.json';
1315 $dh = opendir( $extDir );
1317 while ( ( $file = readdir( $dh ) ) !==
false ) {
1318 if ( !is_dir(
"$extDir/$file" ) ) {
1321 if ( file_exists(
"$extDir/$file/$jsonFile" ) || file_exists(
"$extDir/$file/$file.php" ) ) {
1326 natcasesort( $exts );
1340 $defaultSkin =
$GLOBALS[
'wgDefaultSkin'];
1341 if ( !$skinNames || in_array( $defaultSkin, $skinNames ) ) {
1342 return $defaultSkin;
1344 return $skinNames[0];
1355 $exts = $this->
getVar(
'_Extensions' );
1356 $IP = $this->
getVar(
'IP' );
1367 $wgAutoloadClasses = [];
1370 require
"$IP/includes/DefaultSettings.php";
1372 foreach ( $exts
as $e ) {
1373 if ( file_exists(
"$IP/extensions/$e/extension.json" ) ) {
1374 $queue[
"$IP/extensions/$e/extension.json"] = 1;
1376 require_once
"$IP/extensions/$e/$e.php";
1381 $data = $registry->readFromQueue(
$queue );
1382 $wgAutoloadClasses += $data[
'autoload'];
1384 $hooksWeWant = isset(
$wgHooks[
'LoadExtensionSchemaUpdates'] ) ?
1385 $wgHooks[
'LoadExtensionSchemaUpdates'] : [];
1387 if ( isset( $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
1388 $hooksWeWant = array_merge_recursive(
1390 $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates']
1395 $GLOBALS[
'wgHooks'] = [
'LoadExtensionSchemaUpdates' => $hooksWeWant ];
1413 $coreInstallSteps = [
1414 [
'name' =>
'database',
'callback' => [ $installer,
'setupDatabase' ] ],
1415 [
'name' =>
'tables',
'callback' => [ $installer,
'createTables' ] ],
1416 [
'name' =>
'interwiki',
'callback' => [ $installer,
'populateInterwikiTable' ] ],
1417 [
'name' =>
'stats',
'callback' => [ $this,
'populateSiteStats' ] ],
1418 [
'name' =>
'keys',
'callback' => [ $this,
'generateKeys' ] ],
1419 [
'name' =>
'updates',
'callback' => [ $installer,
'insertUpdateKeys' ] ],
1420 [
'name' =>
'sysop',
'callback' => [ $this,
'createSysop' ] ],
1421 [
'name' =>
'mainpage',
'callback' => [ $this,
'createMainpage' ] ],
1426 foreach ( $coreInstallSteps
as $step ) {
1427 $this->installSteps[] = $step;
1428 if ( isset( $this->extraInstallSteps[$step[
'name']] ) ) {
1429 $this->installSteps = array_merge(
1430 $this->installSteps,
1431 $this->extraInstallSteps[$step[
'name']]
1437 if ( isset( $this->extraInstallSteps[
'BEGINNING'] ) ) {
1438 $this->installSteps = array_merge(
1439 $this->extraInstallSteps[
'BEGINNING'],
1445 if ( count( $this->
getVar(
'_Extensions' ) ) ) {
1446 array_unshift( $this->installSteps,
1447 [
'name' =>
'extensions',
'callback' => [ $this,
'includeExtensions' ] ]
1449 $this->installSteps[] = [
1450 'name' =>
'extension-tables',
1451 'callback' => [ $installer,
'createExtensionTables' ]
1467 $installResults = [];
1469 $installer->preInstall();
1471 foreach ( $steps
as $stepObj ) {
1472 $name = $stepObj[
'name'];
1473 call_user_func_array( $startCB, [
$name ] );
1476 $status = call_user_func( $stepObj[
'callback'], $installer );
1489 $this->
setVar(
'_InstallDone',
true );
1492 return $installResults;
1501 $keys = [
'wgSecretKey' => 64 ];
1502 if ( strval( $this->
getVar(
'wgUpgradeKey' ) ) ===
'' ) {
1503 $keys[
'wgUpgradeKey'] = 16;
1530 $names = array_keys(
$keys );
1531 $names = preg_replace(
'/^(.*)$/',
'\$$1', $names );
1533 $status->warning(
'config-insecure-keys', $wgLang->listToText( $names ), count( $names ) );
1553 if (
$user->idForName() == 0 ) {
1554 $user->addToDatabase();
1557 $user->setPassword( $this->
getVar(
'_AdminPassword' ) );
1562 $user->addGroup(
'sysop' );
1563 $user->addGroup(
'bureaucrat' );
1564 if ( $this->
getVar(
'_AdminEmail' ) ) {
1565 $user->setEmail( $this->
getVar(
'_AdminEmail' ) );
1567 $user->saveSettings();
1571 $ssUpdate->doUpdate();
1575 if ( $this->
getVar(
'_Subscribe' ) && $this->
getVar(
'_AdminEmail' ) ) {
1587 'email' => $this->
getVar(
'_AdminEmail' ),
1594 $myLang = $this->
getVar(
'_UserLang' );
1595 if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
1596 $myLang = $myLang ==
'pt-br' ?
'pt_BR' : $myLang;
1597 $params[
'language'] = $myLang;
1602 [
'method' =>
'POST',
'postData' =>
$params ], __METHOD__ )->execute();
1603 if ( !
$res->isOK() ) {
1604 $s->
warning(
'config-install-subscribe-fail',
$res->getMessage() );
1607 $s->
warning(
'config-install-subscribe-notpossible' );
1622 wfMessage(
'mainpagetext' )->inContentLanguage()->
text() .
"\n\n" .
1623 wfMessage(
'mainpagedocfooter' )->inContentLanguage()->
text()
1634 $status->fatal(
'config-install-mainpage-failed', $e->getMessage() );
1646 define(
'MW_NO_SESSION_HANDLER', 1 );
1649 $GLOBALS[
'wgUseDatabaseMessages'] =
false;
1653 $GLOBALS[
'wgShowExceptionDetails'] =
true;
1655 $GLOBALS[
'wgExternalLinkTarget'] =
'_blank';
1658 $GLOBALS[
'wgShowSQLErrors'] =
true;
1659 $GLOBALS[
'wgShowDBErrorBacktrace'] =
true;
1662 $GLOBALS[
'wgDisableOutputCompression'] =
true;
1665 $GLOBALS[
'wgCookiePrefix'] =
'mw_installer';
1674 'class' =>
'InstallerSessionProvider',
1693 $this->extraInstallSteps[$findStep][] = $callback;
1701 MediaWiki\suppressWarnings();
1702 set_time_limit( 0 );
1703 MediaWiki\restoreWarnings();
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
envCheckServer()
Environment check to inform user which server we've assumed.
array $internalDefaults
Variables that are stored alongside globals, and are used for any configuration of the installation p...
envCheckBrokenXML()
Some versions of libxml+PHP break < and > encoding horribly.
static getLocalisationCache()
Get the LocalisationCache instance.
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
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
this 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
the array() calling protocol came about after MediaWiki 1.4rc1.
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Title $parserTitle
Cached Title, used by parse().
performInstallation($startCB, $endCB)
Actually perform the installation.
array $dbInstallers
Cached DB installer instances, access using getDBInstaller().
wfIsHHVM()
Check if we are running under HHVM.
static newMainPage()
Create a new Title for the Main Page.
dirIsExecutable($dir, $url)
Checks if scripts located in the given directory can be executed via the given URL.
setVar($name, $value)
Set a MW configuration variable, or internal installer configuration variable.
wfShorthandToInteger($string= '', $default=-1)
Converts shorthand byte notation to integer form.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
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
envPrepPath()
Environment prep for setting $IP and $wgScriptPath.
Set options of the Parser.
if(!isset($args[0])) $lang
processing should stop and the error should be shown to the user * false
envCheckShellLocale()
Environment check for preferred locale in shell.
includeExtensions()
Installs the auto-detected extensions.
envCheckGraphics()
Environment check for ImageMagick and GD.
static newFromId($id)
Static factory method for creation from a given user ID.
envCheckGit()
Search for git.
static wasStrong()
Return a boolean indicating whether or not the source used for cryptographic random bytes generation ...
$wgHooks['ArticleShow'][]
static locateExecutableInDefaultPaths($names, $versionInfo=false)
Same as locateExecutable(), but checks in getPossibleBinPaths() by default.
envCheckDiff3()
Search for GNU diff3.
ParserOptions $parserOptions
Cached ParserOptions, used by parse().
wfShellExec($cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
envCheckModSecurity()
Scare user to death if they have mod_security or mod_security2.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
doGenerateKeys($keys)
Generate a secret value for variables using our CryptRand generator.
when a variable name is used in a it is silently declared as a new local masking the global
addInstallStep($callback, $findStep= 'BEGINNING')
Add an installation step following the given step.
wfIsWindows()
Check if the operating system is Windows.
static newFatal($message)
Factory function for fatal errors.
static canMakeRequests()
Simple function to test if we can make any sort of requests at all, using cURL or fopen() ...
warning($message)
Add a new warning.
static disableBackend()
Disables all access to the load balancer, will cause all database access to throw a DBAccessError...
getConnection()
Connect to the database using the administrative user/password currently defined in the session...
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
getDocUrl($page)
Overridden by WebInstaller to provide lastPage parameters.
array $objectCaches
Known object cache types and the functions used to test for their existence.
$wgExtensionDirectory
Filesystem extensions directory.
findExtensions($directory= 'extensions')
Finds extensions that follow the format /$directory/Name/Name.php, and returns an array containing th...
showStatusMessage(Status $status)
Show a message to the installing user by using a Status object.
envCheckSuhosinMaxValueLength()
Checks if suhosin.get.max_value_length is set, and if so generate a warning because it decreases Reso...
$mediaWikiAnnounceLanguages
Supported language codes for Mailman.
static getMain()
Static methods.
generateKeys()
Generate $wgSecretKey.
static maybeGetWebserverPrimaryGroup()
On POSIX systems return the primary group of the webserver we're running under.
array $envPreps
A list of environment preparation methods called by doEnvironmentPreps().
array $envChecks
A list of environment check methods called by doEnvironmentChecks().
wfIniGetBool($setting)
Safety wrapper around ini_get() for boolean settings.
showMessage($msg)
UI interface for displaying a short message The parameters are like parameters to wfMessage()...
static locateExecutable($path, $names, $versionInfo=false)
Search a path for any of the given executable names.
Class for handling updates to the site_stats table.
array array $installSteps
The actual list of installation steps.
parse($text, $lineStart=false)
Convert wikitext $text to HTML.
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
Exception class for attempted DB access.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form 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 unsetoffset-wrap String Wrap the message in html(usually something like"<
int $minMemorySize
Minimum memory size in MB.
getInstallSteps(DatabaseInstaller $installer)
Get an array of install steps.
array $compiledDBs
List of detected DBs, access using getCompiledDBs().
showError($msg)
Same as showMessage(), but for displaying errors.
A BagOStuff object with no objects in it.
global $wgAutoloadClasses
disableTimeLimit()
Disable the time limit for execution.
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
static apacheModulePresent($moduleName)
Checks for presence of an Apache module.
Content object for wiki text pages.
Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
array array $rightsProfiles
User rights profiles.
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
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
createMainpage(DatabaseInstaller $installer)
Insert Main Page with default content.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
setPassword($name, $value)
Set a variable which stores a password, except if the new value is a fake password in which case leav...
unicodeChar($c)
Convert a hex string representing a Unicode code point to that code point.
envCheckCache()
Environment check for compiled object cache types.
envCheckUploadsDirectory()
Environment check for the permissions of the uploads directory.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
const MINIMUM_PCRE_VERSION
The oldest version of PCRE we can support.
envCheckDB()
Environment check for DB types.
populateSiteStats(DatabaseInstaller $installer)
Install step which adds a row to the site_stats table with appropriate initial values.
Show an error when any operation involving passwords fails to run.
array $extraInstallSteps
Extra steps for installation, for things like DatabaseInstallers to modify.
getCompiledDBs()
Get a list of DBs supported by current PHP setup.
array array array $licenses
License types.
envGetDefaultServer()
Helper function to be called from envPrepServer()
getDBInstaller($type=false)
Get an instance of DatabaseInstaller for the specified DB type.
envCheckPCRE()
Environment check for the PCRE module.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
envCheckPath()
Environment check to inform user which paths we've assumed.
static generateHex($chars, $forceStrong=false)
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format...
__construct()
Constructor, always call this from child classes.
$wgStyleDirectory
Filesystem stylesheets directory.
static array $dbTypes
Known database types.
Base class for DBMS-specific installation helper classes.
static overrideConfig()
Override the necessary bits of the config to run an installation.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell...
static factory($url, $options=null, $caller=__METHOD__)
Generate a new request object.
static clear()
Clear all the cached instances.
static getDBTypes()
Get a list of known DB types.
setParserLanguage($lang)
ParserOptions are constructed before we determined the language, so fix it.
getFakePassword($realPassword)
Get a fake password for sending back to the user in HTML.
static get($url, $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
getVar($name, $default=null)
Get an MW configuration variable, or internal installer configuration variable.
envCheckLibicu()
Check the libicu version.
envCheckMemory()
Environment check for available memory.
doEnvironmentChecks()
Do initial checks of the PHP environment.
createSysop()
Create the first user account, grant it sysop and bureaucrat rights.
static getPossibleBinPaths()
Get an array of likely places we can find executables.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
envPrepServer()
Environment prep for the server hostname.
array array array $mediaWikiAnnounceUrl
URL to mediawiki-announce subscription.
static newGood($value=null)
Factory function for good results.
array $defaultVarNames
MediaWiki configuration globals that will eventually be passed through to LocalSettings.php.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
subscribeToMediaWikiAnnounce(Status $s)
Allows to change the fields on the form that will be generated $name
getDefaultSkin(array $skinNames)
Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings, but will fall back to another if the default skin is missing and some other one is present instead.