From 0e768f7268647684de2f55dee2f3c99d6deafd88 Mon Sep 17 00:00:00 2001 From: jengo Date: Mon, 4 Jun 2001 01:17:40 +0000 Subject: [PATCH] Added some transactions --- phpgwapi/inc/class.accounts_sql.inc.php | 3 +++ phpgwapi/inc/class.preferences.inc.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index fdddf4b07e..d744985bc9 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -234,6 +234,7 @@ $sql = "insert into phpgw_accounts"; $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; $sql .= "values (".$accountid.", '".$accountname."','u', '".md5($passwd)."', '".$accountname."', 'AutoCreated', ".time().", 'A')"; + $this->db->transaction_begin(); $this->db->query($sql); $this->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('".$accountid."', '$default_prefs')"); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 1)",__LINE__,__FILE__); @@ -244,6 +245,8 @@ $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__); + $this->db->transaction_commit(); + return $accountid; } } //end of class diff --git a/phpgwapi/inc/class.preferences.inc.php b/phpgwapi/inc/class.preferences.inc.php index 97a929963b..8991606141 100644 --- a/phpgwapi/inc/class.preferences.inc.php +++ b/phpgwapi/inc/class.preferences.inc.php @@ -146,7 +146,7 @@ if (! $phpgw->acl->check('session_only_preferences',1,'preferences')) { - $this->db->lock('phpgw_preferences'); + $this->db->transaction_begin(); $this->db->query("delete from phpgw_preferences where preference_owner='" . $this->account_id . "'",__LINE__,__FILE__); @@ -162,7 +162,7 @@ $this->db->query("insert into phpgw_preferences (preference_owner,preference_value) values ('" . $this->account_id . "','" . $pref_info . "')",__LINE__,__FILE__); - $this->db->unlock(); + $this->db->transaction_commit(); } else {