diff --git a/www/install/php/Update-21.04.1.php b/www/install/php/Update-21.04.1.php index 35dba413611..a68a5330687 100644 --- a/www/install/php/Update-21.04.1.php +++ b/www/install/php/Update-21.04.1.php @@ -72,9 +72,14 @@ $statement->bindValue(':criterias', $criterias, \PDO::PARAM_STR); $statement->execute(); } - $pearDB->commit(); + + if ($pearDB->inTransaction()) { + $pearDB->commit(); + } } catch (\Exception $e) { - $pearDB->rollBack(); + if ($pearDB->inTransaction()) { + $pearDB->rollBack(); + } $centreonLog->insertLog( 4, $versionOfTheUpgrade . $errorMessage . diff --git a/www/install/php/Update-21.04.2.php b/www/install/php/Update-21.04.2.php index 204147f5271..cbb1330d9bd 100644 --- a/www/install/php/Update-21.04.2.php +++ b/www/install/php/Update-21.04.2.php @@ -56,9 +56,14 @@ $statement->bindValue(':moduleMetaId', (int) $moduleMetaId, \PDO::PARAM_INT); $statement->execute(); } - $pearDB->commit(); + + if ($pearDB->inTransaction()) { + $pearDB->commit(); + } } catch (\Exception $e) { - $pearDB->rollBack(); + if ($pearDB->inTransaction()) { + $pearDB->rollBack(); + } $centreonLog->insertLog( 4, $versionOfTheUpgrade . $errorMessage . diff --git a/www/install/php/Update-21.04.5.php b/www/install/php/Update-21.04.5.php index dcf2e959b14..5aaa50e12e3 100644 --- a/www/install/php/Update-21.04.5.php +++ b/www/install/php/Update-21.04.5.php @@ -38,9 +38,14 @@ "ALTER TABLE `contact` ADD COLUMN `contact_platform_data_sending` ENUM('0', '1', '2')" ); } - $pearDB->commit(); + + if ($pearDB->inTransaction()) { + $pearDB->commit(); + } } catch (\Exception $e) { - $pearDB->rollBack(); + if ($pearDB->inTransaction()) { + $pearDB->rollBack(); + } $centreonLog->insertLog( 4, $versionOfTheUpgrade . $errorMessage .