evilMediaWikiBootstrap.php ➔ loadSettings()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
define( 'MEDIAWIKI', true );
4
5
$self = 'foobar';
6
7
// Detect compiled mode
8
# Get the MWInit class
9
require_once "$IP/includes/Init.php";
10
require_once "$IP/includes/AutoLoader.php";
11
# Stub the profiler
12
require_once "$IP/includes/profiler/Profiler.php";
13
14
# Start the profiler
15
$wgProfiler = array();
16
if ( file_exists( "$IP/StartProfiler.php" ) ) {
17
	require "$IP/StartProfiler.php";
18
}
19
20
// Some other requires
21
require_once "$IP/includes/Defines.php";
22
23
require_once MWInit::compiledPath( 'includes/DefaultSettings.php' );
24
25
foreach ( get_defined_vars() as $key => $var ) {
26
	if ( !array_key_exists( $key, $GLOBALS ) ) {
27
		$GLOBALS[$key] = $var;
28
	}
29
}
30
31
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
32
	# Use a callback function to configure MediaWiki
33
	MWFunction::call( MW_CONFIG_CALLBACK );
34
} else {
35
	// Require the configuration (probably LocalSettings.php)
36
	require loadSettings();
37
}
38
39
// Some last includes
40
require_once MWInit::compiledPath( 'includes/Setup.php' );
41
42
// Much much faster startup than creating a title object
43
$wgTitle = null;
44
45
46
function loadSettings() {
47
	global $wgCommandLineMode, $IP;
48
49
	$settingsFile = "$IP/LocalSettings.php";
50
51
	if ( !is_readable( $settingsFile ) ) {
52
		$this->error( "A copy of your installation's LocalSettings.php\n" .
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
53
			"must exist and be readable in the source directory.\n" .
54
			"Use --conf to specify it.", true );
55
	}
56
	$wgCommandLineMode = true;
57
	return $settingsFile;
58
}