瀏覽代碼

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).

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4883 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 7 年之前
父節點
當前提交
ab66e298f1
共有 2 個文件被更改,包括 3 次插入4 次删除
  1. 0 1
      datamodels/2.x/itop-backup/ajax.backup.php
  2. 3 3
      setup/backup.class.inc.php

+ 0 - 1
datamodels/2.x/itop-backup/ajax.backup.php

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

+ 3 - 3
setup/backup.class.inc.php

@@ -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)