Move master config to configs folder and create symlink

This commit is contained in:
Clemens Schwaighofer
2018-10-15 09:54:08 +09:00
parent a923f07fc7
commit 826b5fdfd6
2 changed files with 26 additions and 25 deletions

View File

@@ -1,25 +0,0 @@
<?php
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2018/10/11
* SHORT DESCRIPTION:
* pre config included -> includes master config
* HISTORY:
*********************************************************************/
define('CONFIG_PATH', 'configs'.DIRECTORY_SEPARATOR);
// config path prefix search, start with 0, got down each level __DIR__ has, if nothing found -> bail
$CONFIG_PATH_PREFIX = '';
for ($dir_pos = 0, $dir_max = count(explode('/', __DIR__)); $dir_pos <= $dir_max; $dir_pos ++) {
$CONFIG_PATH_PREFIX .= '..'.DIRECTORY_SEPARATOR;
if (file_exists($CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc')) {
require $CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc';
break;
}
}
// fail if no base DS is not set
if (!defined('DS')) {
exit('Base config unloadable');
}
// __END__

1
www/admin/config.php Symbolic link
View File

@@ -0,0 +1 @@
../configs/config.php

25
www/configs/config.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
/********************************************************************
* AUTHOR: Clemens Schwaighofer
* CREATED: 2018/10/11
* SHORT DESCRIPTION:
* pre config included -> includes master config
* HISTORY:
*********************************************************************/
define('CONFIG_PATH', 'configs'.DIRECTORY_SEPARATOR);
// config path prefix search, start with 0, got down each level __DIR__ has, if nothing found -> bail
$CONFIG_PATH_PREFIX = '';
for ($dir_pos = 0, $dir_max = count(explode('/', __DIR__)); $dir_pos <= $dir_max; $dir_pos ++) {
$CONFIG_PATH_PREFIX .= '..'.DIRECTORY_SEPARATOR;
if (file_exists($CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc')) {
require $CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc';
break;
}
}
// fail if no base DS is not set
if (!defined('DS')) {
exit('Base config unloadable');
}
// __END__