From ba21fff1334ded0f51fec75ebb5a69b974ff3e84 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sat, 15 Aug 2009 21:29:45 +0300 Subject: [PATCH] * Added environment specific config files. * Made environment config files set the ActionEnvironment object properties directly. --- config/environment.php | 7 ++++++- vendor/zynapse/action_environment.php | 24 ++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/config/environment.php b/config/environment.php index b075f60..691caac 100644 --- a/config/environment.php +++ b/config/environment.php @@ -12,7 +12,12 @@ # configurations. # # ( development | test | staging | production ) -$environment = 'development'; +$this->env = 'development'; + + +# Default server display mode - Overridden by host +# specific configurations. +$this->mode = 'web'; # When enabled, environment and more is set based diff --git a/vendor/zynapse/action_environment.php b/vendor/zynapse/action_environment.php index c3dc515..8b5f7c4 100644 --- a/vendor/zynapse/action_environment.php +++ b/vendor/zynapse/action_environment.php @@ -47,7 +47,7 @@ class ActionEnvironment { $public_path, $tmp_path, $cache_path, - $scripts_path, + $script_path, # misc $is_windows, @@ -59,12 +59,21 @@ class ActionEnvironment { $this->load_environment_file(); } + function __wakeup () { + $this->define_constants(); + } + function load_environment_file () { require_once(ZNAP_CONFIG . "/environment.php"); - $this->env = $environment; if ( !empty($enable_host_specific_configuration) ) { $this->load_hosts_file(); } + $this->load_environment_specific_file(); + $this->define_constants(); + } + + function load_environment_specific_file () { + require_once(ZNAP_CONFIG . "/environments/". $this->env . ".php"); } function load_hosts_file () { @@ -87,7 +96,7 @@ class ActionEnvironment { $this->public_path = ZNAP_ROOT . "/public"; $this->tmp_path = ZNAP_ROOT . "/tmp"; $this->cache_path = $this->tmp_path . "/log"; - $this->scripts_path = ZNAP_LIB_ROOT . "/shell_scripts"; + $this->script_path = ZNAP_ROOT . "/script"; } function set_include_paths () { @@ -98,15 +107,18 @@ class ActionEnvironment { $this->is_windows = true; $this->path_seperator = ";"; } - ini_set("include_path", '.' . $this->path_seperator . ZNAP_LIB_ROOT . $this->path_seperator . - $this->scripts_path . $this->path_seperator . + ZNAP_LIB_ROOT . "/script" . $this->path_seperator . $this->lib_path . $this->path_seperator . ini_get('include_path') ); - + } + + function define_constants () { + define("ZNAP_ENV", $this->env); + define("ZNAP_MODE", $this->mode); } function match_to_host ($list = array()) {