-
Notifications
You must be signed in to change notification settings - Fork 0
/
InitializeSettings.php
87 lines (65 loc) · 2.22 KB
/
InitializeSettings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
# WARNING: This file is publically viewable on the web. Do not put private data here.
#
# This file initializes SFWiki specific global variables used later on in the
#
# It is included by LocalSettings.php.
#
$sfwikiIsDev = false;
if ($_SERVER['HTTP_HOST'] == "dev.starfieldwiki.net" || $_SERVER['HTTP_HOST'] == "devgr.starfieldwiki.net") $sfwikiIsDev = true;
if ($_SERVER['HTTP_HOST'] == "dev.sfwiki.net" || $_SERVER['HTTP_HOST'] == "devde.sfwiki.net") $sfwikiIsDev = true;
$curDir = getcwd();
if (substr($curDir, 0, 21) == "/home/sfwiki/dev/www/") $sfwikiIsDev = true;
# Translation Projects and Languages
# The language suffix is added to the end of database names and other
# settings for translation wiki projects. Set in Language.php if needed
$sfwikiLanguageSuffix = "";
# TODO: More robust language detection
$wgLanguageCode = "en";
$host = $_SERVER['HTTP_HOST'];
if ($host == "de.starfieldwiki.net" || $host == "devde.starfieldwiki.net")
{
$wgLanguageCode = "de";
}
if ($wgLanguageCode != "en")
{
$sfwikiLanguageSuffix = "_" . $wgLanguageCode;
}
$wgLocalInterwikis = array( $wgLanguageCode );
# Set server according to environment and host name
if ($sfwikiIsDev)
{
$wgServer = "https://dev" . $wgLanguageCode . ".starfieldwiki.net";
if ($wgLanguageCode == "en") $wgServer = "https://dev.starfieldwiki.net";
}
else
{
$wgServer = "https://" . $wgLanguageCode . ".starfieldwiki.net";
if ($wgLanguageCode == "en") $wgServer = "https://starfieldwiki.net";
}
# Check command line arguments (this only parses long options related to the SFWiki).
# In MW 1.38 it doesn't let you use unknown command line parameters (results in an error).
if (php_sapi_name() == "cli") {
function sfwikiParseCommandArgs()
{
global $argv;
$args = array();
for ( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) )
{
if ( substr( $arg, 0, 2 ) == '--' )
{
$option = substr( $arg, 2 );
$bits = explode( '=', $option, 2 );
if ($bits[1] == null) $bits[1] = true;
$args[$bits[0]] = $bits[1];
}
}
return $args;
}
$sfwikiArgs = sfwikiParseCommandArgs();
if ($sfwikiArgs["sfwikidev"])
{
$sfwikiIsDev = true;
}
}
if ($sfwikiIsDev && defined('STDERR')) fwrite(STDERR, "\tForcing SFWiki dev wiki!\n");