Misc changes, and inital tests with serializing and unserializing core objects.

This commit is contained in:
2009-08-17 00:26:51 +03:00
parent b38c7ac3bd
commit 2898a68af5
3 changed files with 25 additions and 3 deletions

View File

@@ -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";
}

View File

@@ -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();
}

View File

@@ -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 . "<br />\n";
echo "hello world<br />\n";
echo self::$env->environment;
echo self::$env->environment . "<br />\n<br />\n";
// echo serialize(self::$env) . "<br />\n<br />\n";
// echo serialize(self::$base) . "<br />\n<br />\n";
}
}