changes for locking while reading/saving preferences

This commit is contained in:
skeeter 2001-01-18 05:14:59 +00:00
parent 8c49050e33
commit 010a789b9b
4 changed files with 11 additions and 6 deletions

View File

@ -33,7 +33,7 @@
}
if (! $error) {
$phpgw->db->lock(array("accounts","groups","preferences"));
$phpgw->db->lock(array("accounts","groups"));
$phpgw->accounts->add_app($n_group_permissions);
$apps = $phpgw->accounts->add_app("",True);

View File

@ -34,7 +34,7 @@
$phpgw->accounts->phpgw_fillarray();
if(!$phpgw->preferences->account_id) {
$phpgw->preferences = new preferences($phpgw_info["user"]["account_id"]);
$phpgw->preferences = CreateObject('phpgwapi.preferences',$phpgw_info["user"]["account_id"]);
}
$phpgw_info["user"]["preferences"] = $phpgw->preferences->get_preferences();
$this->groups = $this->read_groups($phpgw_info["user"]["userid"]);

View File

@ -55,12 +55,13 @@
//echo "Account ID (After Initializing) = ".$this->account_id."<br>\n";
if ($load_pref) {
$db2->query("SELECT preference_value FROM preferences WHERE preference_owner='"
. $this->account_id . "'",__LINE__,__FILE__);
$db2->lock("preferences");
$db2->query("SELECT preference_value FROM preferences WHERE preference_owner=".$this->account_id,__LINE__,__FILE__);
$db2->next_record();
$pref_info = $db2->f("preference_value");
$this->preference = unserialize($pref_info);
// echo "Preferences = ".$this->get_preferences()."<br>\n";
$db2->unlock();
}
}
@ -73,6 +74,8 @@
if ($this->account_id) {
$db = $phpgw->db;
$db->lock("preferences");
$db->query("delete from preferences where preference_owner=" . $this->account_id,__LINE__,__FILE__);
if ($PHP_VERSION < "4.0.0") {
@ -84,6 +87,9 @@
$db->query("insert into preferences (preference_owner,preference_value) values ("
. $this->account_id . ",'" . $pref_info . "')",__LINE__,__FILE__);
$db->unlock();
if ($phpgw_info["user"]["account_id"] == $this->account_id) {
$phpgw->preferences->preference = $this->get_preferences();
$phpgw->accounts->sync(__LINE__,__FILE__);

View File

@ -244,7 +244,6 @@
$preferences_update = True;
}
if ($preferences_update) {
echo "Committing new preferences<br>\n";
$phpgw->preferences->commit(__LINE__,__FILE__);
}
unset($preferences_update);