]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20699 fixed ws protocol servers to use new abort transactiosn function
authorPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 10:07:58 +0000 (10:07 +0000)
committerPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 10:07:58 +0000 (10:07 +0000)
webservice/lib.php

index ffd9717f477b8c85eaebc7a4c3fe0ade1258aadf..be4f1c69013f54bc65157dfa92d15067aa34510f 100644 (file)
@@ -485,17 +485,8 @@ class '.$classname.' {
      * @return void does not return
      */
     public function exception_handler($ex) {
-        global $CFG, $DB, $SCRIPT;
-
         // detect active db transactions, rollback and log as error
-        if ($DB->is_transaction_started()) {
-            error_log('Database transaction aborted by exception in ' . $CFG->dirroot . $SCRIPT);
-            try {
-                // note: transaction blocks should never change current $_SESSION
-                $DB->rollback_sql();
-            } catch (Exception $ignored) {
-            }
-        }
+        abort_all_db_transactions();
 
         // some hacks might need a cleanup hook
         $this->session_cleanup($ex);
@@ -631,17 +622,8 @@ abstract class webservice_base_server extends webservice_server {
      * @return void does not return
      */
     public function exception_handler($ex) {
-        global $CFG, $DB, $SCRIPT;
-
         // detect active db transactions, rollback and log as error
-        if ($DB->is_transaction_started()) {
-            error_log('Database transaction aborted by exception in ' . $CFG->dirroot . $SCRIPT);
-            try {
-                // note: transaction blocks should never change current $_SESSION
-                $DB->rollback_sql();
-            } catch (Exception $ignored) {
-            }
-        }
+        abort_all_db_transactions();
 
         // some hacks might need a cleanup hook
         $this->session_cleanup($ex);