mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
never storing rows in Etemplate\Request and by that keeping apps from storing it as state into the session
This commit is contained in:
parent
76087e2cb7
commit
4f9e14fcc6
@ -242,6 +242,7 @@ class Request
|
||||
*/
|
||||
public function &id()
|
||||
{
|
||||
$this->cleanup();
|
||||
$data = serialize($this->data);
|
||||
|
||||
// compress the data if available
|
||||
@ -266,6 +267,24 @@ class Request
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up data before storing it: currently only removes "real" nextmatch rows
|
||||
*/
|
||||
protected function cleanup()
|
||||
{
|
||||
if (isset($this->data['content']['nm']) && is_array($this->data['content']['nm']['rows']))
|
||||
{
|
||||
foreach(array_keys($this->data['content']['nm']['rows']) as $n)
|
||||
{
|
||||
if (is_int($n))
|
||||
{
|
||||
unset($this->data['content']['nm']['rows'][$n]);
|
||||
}
|
||||
}
|
||||
//error_log(__METHOD__."() content[nm][rows]=".array2string($this->data['content']['nm']['rows']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a form-variable to be processed
|
||||
*
|
||||
|
@ -135,6 +135,7 @@ class Cache extends Etemplate\Request
|
||||
isset($this->data['last_saved']) && (time()-$this->data['last_saved']) > self::EXPIRATION/2))
|
||||
{
|
||||
//error_log(__METHOD__."() saving $this->id".($this->data_modified?'':' data NOT modified, just keeping session alife'));
|
||||
$this->cleanup();
|
||||
$this->data['last_saved'] = time();
|
||||
if (!Api\Cache::setTree($GLOBALS['egw_info']['server']['install_id'].'_etemplate', $this->id, $this->data,
|
||||
// use bigger one of our own self::EXPIRATION=4h and session lifetime (session.gc_maxlifetime) as expiration time
|
||||
|
@ -151,10 +151,14 @@ class Files extends Etemplate\Request
|
||||
//error_log(__METHOD__."() destroying $this->id");
|
||||
@unlink(self::$directory.'/'.$this->id);
|
||||
}
|
||||
elseif (!$this->destroyed && $this->data_modified &&
|
||||
!file_put_contents($filename = self::$directory.'/'.$this->id,serialize($this->data)))
|
||||
elseif (!$this->destroyed && $this->data_modified)
|
||||
{
|
||||
error_log("Error opening '$filename' to store the etemplate request data!");
|
||||
$this->cleanup();
|
||||
|
||||
if (!file_put_contents($filename = self::$directory.'/'.$this->id,serialize($this->data)))
|
||||
{
|
||||
error_log("Error opening '$filename' to store the etemplate request data!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -121,6 +121,8 @@ class Session extends Etemplate\Request
|
||||
}
|
||||
elseif (!$this->destroyed && $this->data_modified)
|
||||
{
|
||||
$this->cleanup();
|
||||
|
||||
Api\Cache::setSession('etemplate', $this->id, $this->data);
|
||||
}
|
||||
if (!$this->garbage_collection_done)
|
||||
|
Loading…
Reference in New Issue
Block a user