-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-typo3-conf.php
More file actions
executable file
·50 lines (44 loc) · 1.64 KB
/
get-typo3-conf.php
File metadata and controls
executable file
·50 lines (44 loc) · 1.64 KB
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
<?php
/**
* Return specified values from TYPO3 configuration files for use in shell scripts
*
* @param1 name of webroot dir
* @param2 name of PHP variable to return, or array key in TYPO3_CONF_VARS if @param3 is set
* @param3 sub-array key in TYPO3_CONF_VARS
*/
// If not run from the command line, then exit silently
if (php_sapi_name() != 'cli') {
die();
}
define('TYPO3_MODE', TRUE);
global $TYPO3_CONF_VARS;
if (isset($argv[1])) {
if (is_dir($argv[1])) {
$webroot = rtrim($argv[1], '/\ ');
define('PATH_site', $webroot . '/');
if (file_exists($webroot . '/typo3conf/LocalConfiguration.php')) {
// TYPO3 version >= 6.0
$GLOBALS['TYPO3_CONF_VARS'] = require($webroot . '/typo3conf/LocalConfiguration.php');
if (file_exists($webroot . '/typo3conf/AdditionalConfiguration.php')) {
include($webroot . '/typo3conf/AdditionalConfiguration.php');
}
} elseif (file_exists($webroot . '/local/config/AdditionalConfiguration.php')) {
include($webroot . '/local/config/AdditionalConfiguration.php');
} elseif (file_exists($webroot . '/typo3conf/localconf.php')) {
// TYPO3 version <= 4.7.x
include($webroot . '/typo3conf/localconf.php');
} elseif (file_exists($webroot . '/local/config/localsettings.php')) {
include($webroot . '/local/config/localsettings.php');
}
// If arguments 2 and 3 are set, return value from TYPO3_CONF_VARS array
if (isset($argv[3])) {
if (isset($GLOBALS['TYPO3_CONF_VARS'][$argv[2]][$argv[3]])) {
echo $GLOBALS['TYPO3_CONF_VARS'][$argv[2]][$argv[3]];
}
// if only argument 2 is set, return value from the variable with that name
} elseif (isset($argv[2])) {
echo $$argv[2];
}
}
}
?>