From 86e6c8295ff439962f027dfb3172a2f560fbe22a Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Wed, 9 Sep 2015 09:44:39 +0000 Subject: [PATCH] Instrumented the code to help in solving the "restore runing" issue. Retrofit from trunk of [3733] and [3595]: better error handling... check error.log! SVN:2.1.0[3738] --- core/mutex.class.inc.php | 4 +++- datamodels/2.x/itop-backup/ajax.backup.php | 7 +++++-- datamodels/2.x/itop-backup/main.itop-backup.php | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/mutex.class.inc.php b/core/mutex.class.inc.php index 82e67dd60..ea459d0bf 100644 --- a/core/mutex.class.inc.php +++ b/core/mutex.class.inc.php @@ -133,7 +133,9 @@ class iTopMutex } if (($res !== '1') && ($res !== '0')) { - IssueLog::Error('GET_LOCK('.$this->sName.', 0) returned: '.var_export($res, true).'. Expected values are: 0, 1 or null !!'); + $sMsg = 'GET_LOCK('.$this->sName.', 0) returned: '.var_export($res, true).'. Expected values are: 0, 1 or null'; + IssueLog::Error($sMsg); + throw new Exception($sMsg); } return ($res !== '0'); } diff --git a/datamodels/2.x/itop-backup/ajax.backup.php b/datamodels/2.x/itop-backup/ajax.backup.php index 24020c7b5..6e92249fc 100644 --- a/datamodels/2.x/itop-backup/ajax.backup.php +++ b/datamodels/2.x/itop-backup/ajax.backup.php @@ -1,5 +1,5 @@ Lock(); + IssueLog::Info('Backup Restore - LOCK acquired, executing...'); try { set_time_limit(0); @@ -144,6 +146,7 @@ EOF $sBackupFile = $sBackupDir.$sFile; $sRes = $oDBRS->RestoreFromZip($sBackupFile, $sEnvironment); + IssueLog::Info('Backup Restore - Done, releasing the LOCK'); $oRestoreMutex->Unlock(); } catch (Exception $e) diff --git a/datamodels/2.x/itop-backup/main.itop-backup.php b/datamodels/2.x/itop-backup/main.itop-backup.php index 2ea3f914a..d2cc37afa 100644 --- a/datamodels/2.x/itop-backup/main.itop-backup.php +++ b/datamodels/2.x/itop-backup/main.itop-backup.php @@ -1,5 +1,5 @@ Set('access_mode', ACCESS_READONLY, 'itop-backup'); MetaModel::GetConfig()->Set('access_message', ' - '.dict::S('bkp-restore-running'), 'itop-backup'); } } catch(Exception $e) { - + IssueLog::Error(__class__.'::'.__function__.' Failed to check if a backup/restore is running: '.$e->getMessage()); } } }