mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-16 06:31:21 +00:00
get dir of config file even if config file is set in environment
This commit is contained in:
parent
b9f4d7b0ba
commit
401452767e
|
@ -23,6 +23,7 @@
|
||||||
class Settings { /* {{{ */
|
class Settings { /* {{{ */
|
||||||
// Config File Path
|
// Config File Path
|
||||||
var $_configFilePath = null;
|
var $_configFilePath = null;
|
||||||
|
var $_configFileDir = '';
|
||||||
|
|
||||||
// Fields not shown in gui
|
// Fields not shown in gui
|
||||||
var $_hiddenConfFields = '';
|
var $_hiddenConfFields = '';
|
||||||
|
@ -348,6 +349,8 @@ class Settings { /* {{{ */
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->_configFileDir = dirname($this->_configFilePath);
|
||||||
|
|
||||||
if(!$this->load($configFilePath)) {
|
if(!$this->load($configFilePath)) {
|
||||||
echo "Your configuration contains errors.";
|
echo "Your configuration contains errors.";
|
||||||
exit;
|
exit;
|
||||||
|
@ -1167,6 +1170,10 @@ class Settings { /* {{{ */
|
||||||
* @return NULL|string config directory
|
* @return NULL|string config directory
|
||||||
*/
|
*/
|
||||||
static function getConfigDir() { /* {{{ */
|
static function getConfigDir() { /* {{{ */
|
||||||
|
if(defined("SEEDDMS_CONFIG_FILE"))
|
||||||
|
return dirname(SEEDDMS_CONFIG_FILE);
|
||||||
|
elseif(getenv("SEEDDMS_CONFIG_FILE"))
|
||||||
|
return dirname(getenv("SEEDDMS_CONFIG_FILE"));
|
||||||
$_tmp = dirname($_SERVER['SCRIPT_FILENAME']);
|
$_tmp = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||||
$_arr = preg_split('/\//', rtrim(str_replace('\\', '/', $_tmp)));
|
$_arr = preg_split('/\//', rtrim(str_replace('\\', '/', $_tmp)));
|
||||||
$configDir = null;
|
$configDir = null;
|
||||||
|
|
|
@ -25,7 +25,7 @@ elseif(getenv("SEEDDMS_CONFIG_FILE"))
|
||||||
$settings = new Settings(getenv("SEEDDMS_CONFIG_FILE"));
|
$settings = new Settings(getenv("SEEDDMS_CONFIG_FILE"));
|
||||||
else
|
else
|
||||||
$settings = new Settings();
|
$settings = new Settings();
|
||||||
if(!defined("SEEDDMS_INSTALL") && file_exists(dirname($settings->_configFilePath)."/ENABLE_INSTALL_TOOL")) {
|
if(!defined("SEEDDMS_INSTALL") && file_exists($settings->_configFileDir."/ENABLE_INSTALL_TOOL")) {
|
||||||
die("SeedDMS won't run unless your remove the file ENABLE_INSTALL_TOOL from your configuration directory.");
|
die("SeedDMS won't run unless your remove the file ENABLE_INSTALL_TOOL from your configuration directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user