mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +00:00
getConfigDir() checks all parent directories
it used to check only the current and the parent directory of the running script. This wasn't suffcient for scripts in the extensions anymore. Now it checks all parent directories recursively
This commit is contained in:
parent
69aa7db50b
commit
99483da8a3
|
@ -806,16 +806,30 @@ class Settings { /* {{{ */
|
||||||
/**
|
/**
|
||||||
* Returns absolute path for configuration files respecting links
|
* Returns absolute path for configuration files respecting links
|
||||||
*
|
*
|
||||||
* This function checks three directories for a configuration directory
|
* This function checks all parent directories of the current script
|
||||||
* 1. The directory where the current script is located adding '/conf'
|
* for a configuration directory named 'conf'. It doesn't check
|
||||||
* 2. The parent directory of the current script adding '/conf'
|
* if that directory contains a configuration file.
|
||||||
* 3. The directory /etc/seeddms
|
* If none was found a final try will be made checking /etc/seeddms
|
||||||
* @return NULL|string config directory
|
* @return NULL|string config directory
|
||||||
*/
|
*/
|
||||||
function getConfigDir() { /* {{{ */
|
function getConfigDir() { /* {{{ */
|
||||||
$_tmp = dirname($_SERVER['SCRIPT_FILENAME']);
|
$_tmp = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||||
$_arr = preg_split('/\//', $_tmp);
|
$_arr = preg_split('/\//', $_tmp);
|
||||||
$configDir = null;
|
$configDir = null;
|
||||||
|
/* new code starts here */
|
||||||
|
while($_arr && !$configDir) {
|
||||||
|
if(file_exists(implode('/', $_arr)."/conf/"))
|
||||||
|
$configDir = implode('/', $_arr)."/conf/";
|
||||||
|
else
|
||||||
|
array_pop($_arr);
|
||||||
|
}
|
||||||
|
if(!$configDir) {
|
||||||
|
if(file_exists('/etc/seeddms'))
|
||||||
|
$configDir = '/etc/seeddms';
|
||||||
|
}
|
||||||
|
return $configDir;
|
||||||
|
/* new code ends here */
|
||||||
|
|
||||||
if(file_exists(implode('/', $_arr)."/conf/"))
|
if(file_exists(implode('/', $_arr)."/conf/"))
|
||||||
$configDir = implode('/', $_arr)."/conf/";
|
$configDir = implode('/', $_arr)."/conf/";
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user