N°1002 Backup: '.' character in iTop instance path was causing a crash when trying to -temporary- replace them in the backup filename (due to compression lib limitations).

SVN:trunk[4883]
This commit is contained in:
Guillaume Lajarige
2017-08-29 14:30:46 +00:00
parent c022d12a0a
commit 9cf42f6cc8
2 changed files with 3 additions and 4 deletions

View File

@@ -182,4 +182,3 @@ catch (Exception $e)
IssueLog::Error($e->getMessage());
}
?>

View File

@@ -282,10 +282,10 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
{
$this->LogInfo("Creating backup: '$sTargetFile.tar.gz'");
// Note: PharData::compress strips averything after the first dot found in the name of the tar, then it adds .tar.gz
// Note: PharData::compress strips everything after the first dot found in the name of the tar, then it adds .tar.gz
// Hence, we have to create our own file in the target directory, and rename it when the process is complete
$sTarFile = str_replace('.', '_', $sTargetFile).'.tar';
$this->LogInfo("Tar file: '$sTarFile'");
$sTarFile = dirname($sTargetFile) . '/' . str_replace('.', '_', basename($sTargetFile)) . '.tar';
$this->LogInfo("Tar file: '$sTarFile'");
$oArchive = new PharData($sTarFile);
// Note: the file is created by tempnam and might not be writeable by another process (Windows/IIS)