From 12ffa60023c3b9ae88e75008e9f7a6e99f38fb71 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 24 Apr 2017 11:13:08 -0400 Subject: [PATCH] fix applying sorting to MOnitors. --- web/ajax/console.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/ajax/console.php b/web/ajax/console.php index c22a51b28..61c8e87fb 100644 --- a/web/ajax/console.php +++ b/web/ajax/console.php @@ -6,7 +6,9 @@ if ( canEdit( 'Monitors' ) ) { { $monitor_ids = $_POST['monitor_ids']; # Two concurrent sorts could generate odd sortings... so lock the table. - dbQuery( 'LOCK TABLES Monitors WRITE' ); + global $dbConn; + $dbConn->beginTransaction(); + $dbConn->exec( 'LOCK TABLES Monitors WRITE' ); for ( $i = 0; $i < count($monitor_ids); $i += 1 ) { $monitor_id = $monitor_ids[$i]; $monitor_id = preg_replace( '/^monitor_id-/', '', $monitor_id ); @@ -16,7 +18,9 @@ if ( canEdit( 'Monitors' ) ) { } dbQuery( 'UPDATE Monitors SET Sequence=? WHERE Id=?', array( $i, $monitor_id ) ); } // end for each monitor_id - dbQuery('UNLOCK TABLES'); + $dbConn->commit(); + $dbConn->exec('UNLOCK TABLES'); + return; } // end case sort default: