diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index 56a20a54a3..c62392860e 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -445,14 +445,16 @@ EOF foreach($this->oModelReflection->ListAttributes($sClass) as $sAttCode => $sAttType) { // For external fields, find the real type of the target + $sExtFieldAttCode = $sAttCode; $sTargetClass = $sClass; while (is_a($sAttType, 'AttributeExternalField', true)) { - $sExtKeyAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sAttCode, 'extkey_attcode'); - $sTargetAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sAttCode, 'target_attcode'); + $sExtKeyAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sExtFieldAttCode, 'extkey_attcode'); + $sTargetAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sExtFieldAttCode, 'target_attcode'); $sTargetClass = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sExtKeyAttCode, 'targetclass'); $aTargetAttCodes = $this->oModelReflection->ListAttributes($sTargetClass); $sAttType = $aTargetAttCodes[$sTargetAttCode]; + $sExtFieldAttCode = $sTargetAttCode; } if (is_a($sAttType, 'AttributeLinkedSet', true)) { diff --git a/datamodels/2.x/itop-backup/main.itop-backup.php b/datamodels/2.x/itop-backup/main.itop-backup.php index ed0a93b831..698bfc70bd 100644 --- a/datamodels/2.x/itop-backup/main.itop-backup.php +++ b/datamodels/2.x/itop-backup/main.itop-backup.php @@ -161,7 +161,14 @@ class BackupExec implements iScheduledProcess } $sBackupFile = $this->sBackupDir.$sName; $sSourceConfigFile = APPCONF.utils::GetCurrentEnvironment().'/'.ITOP_CONFIG_FILE; - $oBackup->CreateCompressedBackup($sBackupFile, $sSourceConfigFile); + try + { + $oBackup->CreateCompressedBackup($sBackupFile, $sSourceConfigFile); + } + catch (BackupException $e) + { + throw new ProcessFatalException($e->getMessage()); + } } catch (Exception $e) { diff --git a/setup/backup.class.inc.php b/setup/backup.class.inc.php index 238124ab76..457829e123 100644 --- a/setup/backup.class.inc.php +++ b/setup/backup.class.inc.php @@ -302,6 +302,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the " * @param string $sTargetFile Path and name, without the extension * @param string|null $sSourceConfigFile Configuration file to embed into the backup, if not the current one * + * @throws \BackupException if archive cannot be created * @throws \Exception */ public function CreateCompressedBackup($sTargetFile, $sSourceConfigFile = null) @@ -315,7 +316,13 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the " $sFilesList = var_export($aFiles, true); $this->LogInfo("backup: adding to archive files '$sFilesList'"); - $oArchive->createModify($aFiles, '', $sTmpFolder); + $bArchiveCreationResult = $oArchive->createModify($aFiles, '', $sTmpFolder); + if (!$bArchiveCreationResult) + { + $sErrorMsg = 'Cannot backup : unable to create archive'; + $this->LogError($sErrorMsg); + throw new BackupException($sErrorMsg); + } $this->LogInfo("backup: removing tmp folder '$sTmpFolder'"); SetupUtils::rrmdir($sTmpFolder);