summaryrefslogtreecommitdiff
path: root/framework/TApplication.php
diff options
context:
space:
mode:
authorxue <>2005-12-26 17:57:16 +0000
committerxue <>2005-12-26 17:57:16 +0000
commit28fa4ab2490f518f4d0469c87e63addfe7dbbc8e (patch)
tree53e6f1260f2f297e9bbf63afafdb3ab8f7fb2329 /framework/TApplication.php
parent2c820d4dcfa96cd604687d11eeea3fa4ee8dce76 (diff)
Fixed a bug about GlobalState.
Diffstat (limited to 'framework/TApplication.php')
-rw-r--r--framework/TApplication.php32
1 files changed, 9 insertions, 23 deletions
diff --git a/framework/TApplication.php b/framework/TApplication.php
index 97c9f8e3..5d264546 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -349,22 +349,11 @@ class TApplication extends TComponent
*/
public function setGlobalState($key,$value,$defaultValue=null)
{
+ $this->_stateChanged=true;
if($value===$defaultValue)
- {
- if(isset($this->_globals[$key]))
- {
- unset($this->_globals[$key]);
- $this->_stateChanged=true;
- }
- }
+ unset($this->_globals[$key]);
else
- {
- if(!isset($this->_globals[$key]) || (isset($this->_globals[$key]) && $this->_globals[$key]!==$value))
- {
- $this->_globals[$key]=$value;
- $this->_stateChanged=true;
- }
- }
+ $this->_globals[$key]=$value;
}
/**
@@ -375,11 +364,8 @@ class TApplication extends TComponent
*/
public function clearGlobalState($key)
{
- if(isset($this->_globals[$key]))
- {
- unset($this->_globals[$key]);
- $this->_stateChanged=true;
- }
+ $this->_stateChanged=true;
+ unset($this->_globals[$key]);
}
/**
@@ -391,7 +377,7 @@ class TApplication extends TComponent
protected function loadGlobals()
{
if(($cache=$this->getCache())!==null && ($value=$cache->get('prado:globals'))!==false)
- $this->_globals=$value;
+ $this->_globals=unserialize($value);
else
{
if(($content=@file_get_contents($this->getRuntimePath().'/'.self::GLOBAL_FILE))!==false)
@@ -411,10 +397,10 @@ class TApplication extends TComponent
$saveFile=true;
if(($cache=$this->getCache())!==null)
{
- if($cache->get('prado:globals')!==$content)
- $cache->set('prado:globals',$content);
- else
+ if($cache->get('prado:globals')===$content)
$saveFile=false;
+ else
+ $cache->set('prado:globals',$content);
}
if($saveFile)
{