MediaWiki REL1_39
BootstrapHelperFunctions.php
Go to the documentation of this file.
1<?php
30function wfDetectLocalSettingsFile( ?string $installationPath = null ): string {
31 if ( defined( 'MW_CONFIG_FILE' ) ) {
32 return MW_CONFIG_FILE;
33 }
34
35 if ( $installationPath === null ) {
36 $installationPath = wfDetectInstallPath();
37 }
38
39 // We could look for LocalSettings.yaml and LocalSettings.json,
40 // and use them if they exist. But having them in a web accessible
41 // place is dangerous, so better not to encourage that.
42 // In order to use LocalSettings.yaml and LocalSettings.json, they
43 // will have to be referenced explicitly by MW_CONFIG_FILE.
44 $configFile = getenv( 'MW_CONFIG_FILE' ) ?: "LocalSettings.php";
45 // Can't use str_contains because for maintenance scripts (update.php, install.php),
46 // this is called *before* Setup.php and vendor (polyfill-php80) are included.
47 if ( strpos( $configFile, '/' ) === false ) {
48 $configFile = "$installationPath/$configFile";
49 }
50
51 define( 'MW_CONFIG_FILE', $configFile );
52 return $configFile;
53}
54
68function wfDetectInstallPath(): string {
69 if ( !defined( 'MW_INSTALL_PATH' ) ) {
70 $IP = getenv( 'MW_INSTALL_PATH' );
71 if ( $IP === false ) {
72 $IP = dirname( __DIR__ );
73 }
74 define( 'MW_INSTALL_PATH', $IP );
75 }
76
77 return MW_INSTALL_PATH;
78}
wfDetectLocalSettingsFile(?string $installationPath=null)
Decide and remember where to load LocalSettings from.
wfDetectInstallPath()
Decide and remember where mediawiki is installed.
if(!defined( 'MEDIAWIKI')) if(ini_get('mbstring.func_overload')) if(!defined( 'MW_ENTRY_POINT')) global $IP
Environment checks.
Definition Setup.php:91
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Definition WebStart.php:82