From 9907c02a115b5e41cec1bb340b27b0c45193c030 Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Thu, 10 Oct 2019 11:02:18 -0500 Subject: [PATCH] Resolved transaction issue --- ext/media/main.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/media/main.php b/ext/media/main.php index 8e399a01..1a9d674b 100644 --- a/ext/media/main.php +++ b/ext/media/main.php @@ -1053,14 +1053,17 @@ class Media extends Extension $database->execute("SET statement_timeout TO 300000;"); } - $database->commit(); // Each of these commands could hit a lot of data, combining them into one big transaction would not be a good idea. - + if ($database->transaction === true) { + $database->commit(); // Each of these commands could hit a lot of data, combining them into one big transaction would not be a good idea. + } log_info("upgrade", "Setting predictable media values for known file types"); $database->execute($database->scoreql_to_sql("UPDATE images SET image = SCORE_BOOL_N WHERE ext IN ('swf','mp3','ani','flv','mp4','m4v','ogv','webm')")); $database->execute($database->scoreql_to_sql("UPDATE images SET image = SCORE_BOOL_Y WHERE ext IN ('jpg','jpeg''ico','cur','png')")); $config->set_int(MediaConfig::VERSION, 2); log_info("media", "extension at version 2"); + + $database->beginTransaction(); } } }