forked from extern/egroupware
only save preferences of apps whos preferences actually changed
This commit is contained in:
parent
2ff1107b78
commit
ad85c88c72
@ -839,9 +839,14 @@ class preferences
|
|||||||
(!($old_prefs = $this->cache_read($account_id)) || $old_prefs[$account_id] != $prefs))
|
(!($old_prefs = $this->cache_read($account_id)) || $old_prefs[$account_id] != $prefs))
|
||||||
{
|
{
|
||||||
//error_log(__METHOD__."(type=$type) saved, because old_prefs[$account_id] != prefs=".array2string($prefs));
|
//error_log(__METHOD__."(type=$type) saved, because old_prefs[$account_id] != prefs=".array2string($prefs));
|
||||||
$this->db->transaction_begin();
|
$changed = 0;
|
||||||
foreach($prefs as $app => $value)
|
foreach($prefs as $app => $value)
|
||||||
{
|
{
|
||||||
|
// check if app preferences have changed, if not no need to save them
|
||||||
|
if ($old_prefs && $old_prefs[$app] == $value) continue;
|
||||||
|
|
||||||
|
if (!$changed++) $this->db->transaction_begin();
|
||||||
|
|
||||||
if (!is_array($value) || !$value)
|
if (!is_array($value) || !$value)
|
||||||
{
|
{
|
||||||
$this->db->delete($this->table, array(
|
$this->db->delete($this->table, array(
|
||||||
@ -860,11 +865,14 @@ class preferences
|
|||||||
),__LINE__,__FILE__);
|
),__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($changed)
|
||||||
|
{
|
||||||
$this->db->transaction_commit();
|
$this->db->transaction_commit();
|
||||||
|
|
||||||
// update instance-wide cache
|
// update instance-wide cache
|
||||||
egw_cache::setInstance(__CLASS__, $account_id, $prefs);
|
egw_cache::setInstance(__CLASS__, $account_id, $prefs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//else error_log(__METHOD__."(type=$type) NOT saved because old_prefs[$account_id] == prefs=".array2string($prefs));
|
//else error_log(__METHOD__."(type=$type) NOT saved because old_prefs[$account_id] == prefs=".array2string($prefs));
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user