Commit 2279fc84 authored by Aaron Wells's avatar Aaron Wells
Browse files

Disable transactions in MySQL (Bug 1514608)

Mahara's usage of transactions has been causing
major deadlock issues in MySQL with InnoDB.
The immediate fix is to disable them.

behatnotneeded: Covered by existing tests

Change-Id: I2c7e6424e2d58502acd26fdd5d05c797e4ee5eac
(cherry picked from commit e52be8a3)
parent 296fe519
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1514,6 +1514,9 @@ $GLOBALS['_TRANSACTION_LEVEL'] = 0;
 */
function db_begin() {
    global $db;
    if (is_mysql()) {
        return;
    }

    $GLOBALS['_TRANSACTION_LEVEL']++;
    $db->StartTrans();
@@ -1527,6 +1530,9 @@ function db_begin() {
 */
function db_commit() {
    global $db;
    if (is_mysql()) {
        return;
    }
    $GLOBALS['_TRANSACTION_LEVEL']--;

    if ($GLOBALS['_TRANSACTION_LEVEL'] == 0) {
@@ -1545,6 +1551,9 @@ function db_commit() {
 */
function db_rollback() {
    global $db;
    if (is_mysql()) {
        return;
    }
    $db->FailTrans();
    for ($i = $GLOBALS['_TRANSACTION_LEVEL']; $i >= 0; $i--) {
        $db->CompleteTrans();