From 2898a68af5251366457cd06b43246609e1a9e0ec Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 17 Aug 2009 00:26:51 +0300 Subject: [PATCH] Misc changes, and inital tests with serializing and unserializing core objects. --- vendor/zynapse/action_base.php | 17 ++++++++++++++++- vendor/zynapse/action_environment.php | 3 +++ vendor/zynapse/zynapse.php | 8 ++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/vendor/zynapse/action_base.php b/vendor/zynapse/action_base.php index 504576b..a01dcdb 100644 --- a/vendor/zynapse/action_base.php +++ b/vendor/zynapse/action_base.php @@ -55,6 +55,21 @@ class ActionBase { } + function __sleep () { + $blacklist = array_flip(array("env", "view", "log", "locale")); + $save = array(); + foreach( $this as $key => $value ) { + if ( !array_key_exists($key, $blacklist) ) { + $save[] = $key; + } + } + return $save; + } + + function __wakeup () { + + } + function init () { $this->set_paths(); } @@ -65,7 +80,7 @@ class ActionBase { $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->cache_path = $this->tmp_path . "/cache"; $this->script_path = ZNAP_ROOT . "/script"; } diff --git a/vendor/zynapse/action_environment.php b/vendor/zynapse/action_environment.php index 239f99f..dface6c 100644 --- a/vendor/zynapse/action_environment.php +++ b/vendor/zynapse/action_environment.php @@ -59,6 +59,9 @@ class ActionEnvironment { if ( !empty($enable_host_specific_configuration) ) { $this->load_hosts_file(); } + if ( !empty($_SERVER['ZNAP_ENV']) ) { + $this->environment = $_SERVER['ZNAP_ENV']; + } $this->load_environment_specific_file(); $this->define_constants(); } diff --git a/vendor/zynapse/zynapse.php b/vendor/zynapse/zynapse.php index b50d091..bbe056d 100644 --- a/vendor/zynapse/zynapse.php +++ b/vendor/zynapse/zynapse.php @@ -48,14 +48,18 @@ class Zynapse { require_once(ZNAP_LIB_ROOT . "/action_base.php"); require_once(ZNAP_LIB_ROOT . "/active_session.php"); + $start = microtime(true); self::$env = new ActionEnvironment(); self::$base = new ActionBase(); self::$base->init(); - self::$base->env =& self::$env; + echo microtime(true) - $start . "
\n"; echo "hello world
\n"; - echo self::$env->environment; + echo self::$env->environment . "
\n
\n"; + + // echo serialize(self::$env) . "
\n
\n"; + // echo serialize(self::$base) . "
\n
\n"; } }