MediaWiki
master
Toggle main menu visibility
BootstrapHelperFunctions.php
Go to the documentation of this file.
1
<?php
7
30
function
wfDetectLocalSettingsFile
( ?
string
$installationPath =
null
): string {
31
if
( defined(
'MW_CONFIG_FILE'
) ) {
32
return
MW_CONFIG_FILE;
33
}
34
35
$installationPath ??=
wfDetectInstallPath
();
36
37
// We could look for LocalSettings.yaml and LocalSettings.json,
38
// and use them if they exist. But having them in a web accessible
39
// place is dangerous, so better not to encourage that.
40
// In order to use LocalSettings.yaml and LocalSettings.json, they
41
// will have to be referenced explicitly by MW_CONFIG_FILE.
42
$configFile = getenv(
'MW_CONFIG_FILE'
) ?:
"LocalSettings.php"
;
43
// Can't use str_contains because for maintenance scripts (update.php, install.php),
44
// this is called *before* Setup.php and vendor (polyfill-php80) are included.
45
if
( !str_contains( $configFile,
'/'
) ) {
46
$configFile =
"$installationPath/$configFile"
;
47
}
48
49
define(
'MW_CONFIG_FILE'
, $configFile );
50
return
$configFile;
51
}
52
66
function
wfDetectInstallPath
(): string {
67
if
( !defined(
'MW_INSTALL_PATH'
) ) {
68
$IP
= getenv(
'MW_INSTALL_PATH'
);
69
if
(
$IP
===
false
) {
70
$IP
= dirname( __DIR__ );
71
}
72
define(
'MW_INSTALL_PATH'
,
$IP
);
73
}
74
75
return
MW_INSTALL_PATH;
76
}
77
83
function
wfIsWindows
() {
84
return
PHP_OS_FAMILY ===
'Windows'
;
85
}
86
93
function
wfIsCLI
() {
94
return
PHP_SAPI ===
'cli'
|| PHP_SAPI ===
'phpdbg'
;
95
}
wfDetectLocalSettingsFile
wfDetectLocalSettingsFile(?string $installationPath=null)
Decide and remember where to load LocalSettings from.
Definition
BootstrapHelperFunctions.php:30
wfIsWindows
wfIsWindows()
Check if the operating system is Windows.
Definition
BootstrapHelperFunctions.php:83
wfDetectInstallPath
wfDetectInstallPath()
Decide and remember where mediawiki is installed.
Definition
BootstrapHelperFunctions.php:66
wfIsCLI
wfIsCLI()
Check if we are running from the commandline.
Definition
BootstrapHelperFunctions.php:93
$IP
if(!defined('MEDIAWIKI')) if(!defined( 'MW_ENTRY_POINT')) $IP
Environment checks.
Definition
Setup.php:102
if
if(!defined('MW_SETUP_CALLBACK'))
Definition
WebStart.php:72
includes
BootstrapHelperFunctions.php
Generated on
for MediaWiki by
1.18.0