mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-09 01:25:22 +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
4aafcf7e2b
commit
095a95ab9a
@ -242,6 +242,7 @@ class Request
|
|||||||
*/
|
*/
|
||||||
public function &id()
|
public function &id()
|
||||||
{
|
{
|
||||||
|
$this->cleanup();
|
||||||
$data = serialize($this->data);
|
$data = serialize($this->data);
|
||||||
|
|
||||||
// compress the data if available
|
// compress the data if available
|
||||||
@ -266,6 +267,24 @@ class Request
|
|||||||
return $id;
|
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
|
* 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))
|
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'));
|
//error_log(__METHOD__."() saving $this->id".($this->data_modified?'':' data NOT modified, just keeping session alife'));
|
||||||
|
$this->cleanup();
|
||||||
$this->data['last_saved'] = time();
|
$this->data['last_saved'] = time();
|
||||||
if (!Api\Cache::setTree($GLOBALS['egw_info']['server']['install_id'].'_etemplate', $this->id, $this->data,
|
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
|
// 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");
|
//error_log(__METHOD__."() destroying $this->id");
|
||||||
@unlink(self::$directory.'/'.$this->id);
|
@unlink(self::$directory.'/'.$this->id);
|
||||||
}
|
}
|
||||||
elseif (!$this->destroyed && $this->data_modified &&
|
elseif (!$this->destroyed && $this->data_modified)
|
||||||
!file_put_contents($filename = self::$directory.'/'.$this->id,serialize($this->data)))
|
|
||||||
{
|
{
|
||||||
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)
|
elseif (!$this->destroyed && $this->data_modified)
|
||||||
{
|
{
|
||||||
|
$this->cleanup();
|
||||||
|
|
||||||
Api\Cache::setSession('etemplate', $this->id, $this->data);
|
Api\Cache::setSession('etemplate', $this->id, $this->data);
|
||||||
}
|
}
|
||||||
if (!$this->garbage_collection_done)
|
if (!$this->garbage_collection_done)
|
||||||
|
Loading…
Reference in New Issue
Block a user