Improved transactions support (multilevel).
[fa-stable.git] / includes / errors.inc
index 551d32e4438a2c5b63f260d2e5adf84ac96be76d..9e0dba2e87fc99edf3694e96528e6096e74c31b3 100644 (file)
@@ -94,13 +94,16 @@ function error_box() {
 /*
        Helper to avoid sparse log notices.
 */
-function end_flush () {
-       global $Ajax;
+function end_flush() {
+       global $Ajax, $transaction_level;
 
        if (isset($Ajax))
                $Ajax->run();
        // flush all output buffers (works also with exit inside any div levels)
        while(ob_get_level()) ob_end_flush();
+
+       // if any transaction was aborted unexpectedly rollback changes
+       cancel_transaction();
 }
 
 function display_db_error($msg, $sql_statement=null, $exit=true)