From e610d719b1bb5053c6d3bc941b14715376cc26a8 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 16 Aug 2009 02:02:27 +0300 Subject: [PATCH] Moved the main path config's out of ActionEnvironment and into ActionBase where they make more sense to be. --- vendor/zynapse/action_base.php | 32 +++++++++++++++++++++++++++ vendor/zynapse/action_environment.php | 23 +++++++------------ vendor/zynapse/zynapse.php | 3 +++ 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/vendor/zynapse/action_base.php b/vendor/zynapse/action_base.php index 9adea94..de198b1 100644 --- a/vendor/zynapse/action_base.php +++ b/vendor/zynapse/action_base.php @@ -32,6 +32,38 @@ class ActionBase { + + public + + # components + $env, // ActionEnvironment + $view, // ActionView + $locale, // ActionLocale + $log, // ActionLog + + # paths + $apps_path, + $lib_path, + $log_path, + $public_path, + $tmp_path, + $cache_path, + $script_path; + + + function __construct () { + $this->set_paths(); + } + + function set_paths () { + $this->apps_path = ZNAP_ROOT . "/apps"; + $this->lib_path = ZNAP_ROOT . "/lib"; + $this->log_path = ZNAP_ROOT . "/log"; + $this->public_path = ZNAP_ROOT . "/public"; + $this->tmp_path = ZNAP_ROOT . "/tmp"; + $this->cache_path = $this->tmp_path . "/log"; + $this->script_path = ZNAP_ROOT . "/script"; + } } diff --git a/vendor/zynapse/action_environment.php b/vendor/zynapse/action_environment.php index a2373b1..6b905ba 100644 --- a/vendor/zynapse/action_environment.php +++ b/vendor/zynapse/action_environment.php @@ -54,7 +54,6 @@ class ActionEnvironment { $path_separator; function __construct () { - $this->set_paths(); $this->set_include_paths(); $this->load_environment_file(); } @@ -72,10 +71,6 @@ class ActionEnvironment { $this->define_constants(); } - function load_environment_specific_file () { - require_once(ZNAP_CONFIG . "/environments/". $this->env . ".php"); - } - function load_hosts_file () { require_once(ZNAP_CONFIG . "/hosts.php"); $host = $this->match_to_host($hosts); @@ -89,14 +84,8 @@ class ActionEnvironment { } } - function set_paths () { - $this->apps_path = ZNAP_ROOT . "/apps"; - $this->lib_path = ZNAP_ROOT . "/lib"; - $this->log_path = ZNAP_ROOT . "/log"; - $this->public_path = ZNAP_ROOT . "/public"; - $this->tmp_path = ZNAP_ROOT . "/tmp"; - $this->cache_path = $this->tmp_path . "/log"; - $this->script_path = ZNAP_ROOT . "/script"; + function load_environment_specific_file () { + require_once(ZNAP_CONFIG . "/environments/". $this->env . ".php"); } function set_include_paths () { @@ -116,8 +105,12 @@ class ActionEnvironment { } function define_constants () { - define("ZNAP_ENV", $this->env); - define("ZNAP_MODE", $this->mode); + if ( !defined("ZNAP_ENV") ) { + define("ZNAP_ENV", $this->env); + } + if ( !defined("ZNAP_MODE") ) { + define("ZNAP_MODE", $this->mode); + } } function match_to_host ($list = array()) { diff --git a/vendor/zynapse/zynapse.php b/vendor/zynapse/zynapse.php index 5147d0e..2d3ecf4 100644 --- a/vendor/zynapse/zynapse.php +++ b/vendor/zynapse/zynapse.php @@ -47,6 +47,9 @@ class Zynapse { require_once(ZNAP_LIB_ROOT . "/active_session.php"); self::$env = new ActionEnvironment(); + self::$base = new ActionBase(); + + self::$base->env =& self::$env; echo "hello world
\n"; echo self::$env->env;