|
|
@@ -133,7 +133,18 @@ class Config {
|
|
|
|
|
|
$activeProject = V::get('P5_ACTIVE_PROJECT', '', $_SERVER);
|
|
|
DBG::log("\$activeProject = '{$activeProject}' (ENV)");
|
|
|
- if (!$activeProject) $activeProject = DB::getPDO()->fetchValue(" select c.CONF_VAL from CRM_CONFIG c where c.CONF_KEY = 'activeProject' ");
|
|
|
+ if ($activeProject) {
|
|
|
+ $path = APP_PATH_ROOT . DS . "projects" . DS . "{$activeProject}";
|
|
|
+ if (!file_exists($path)) throw new Exception("Missing project folder '{$activeProject}' (env)");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$activeProject) {
|
|
|
+ $activeProject = DB::getPDO()->fetchValue(" select c.CONF_VAL from CRM_CONFIG c where c.CONF_KEY = 'activeProject' ");
|
|
|
+ if ($activeProject) {
|
|
|
+ $path = APP_PATH_ROOT . DS . "projects" . DS . "{$activeProject}";
|
|
|
+ if (!file_exists($path)) throw new Exception("Missing project folder '{$activeProject}' (db)");
|
|
|
+ }
|
|
|
+ }
|
|
|
DBG::log("\$activeProject = '{$activeProject}' (ENV, DB)");
|
|
|
$_activeProject = (string)$activeProject;
|
|
|
|
|
|
@@ -143,9 +154,7 @@ class Config {
|
|
|
public static function getProjectPath() {
|
|
|
$activeProject = self::getProjectName();
|
|
|
if (!$activeProject) return null;
|
|
|
- $path = APP_PATH_ROOT . DS . "projects" . DS . "{$activeProject}";
|
|
|
- if (!file_exists($path)) throw new Exception("Missing project folder '{$activeProject}'");
|
|
|
- return $path;
|
|
|
+ return APP_PATH_ROOT . DS . "projects" . DS . "{$activeProject}";
|
|
|
}
|
|
|
|
|
|
}
|