mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 03:28:45 +02:00
Backup/restore : apply COmbodo formatting
SVN:trunk[5667]
This commit is contained in:
@@ -36,6 +36,7 @@ class DBRestore extends DBBackup
|
||||
{
|
||||
//IssueLog::Info('non juste info: '.$sMsg);
|
||||
}
|
||||
|
||||
protected function LogError($sMsg)
|
||||
{
|
||||
IssueLog::Error($sMsg);
|
||||
@@ -103,6 +104,7 @@ class DBRestore extends DBBackup
|
||||
|
||||
/**
|
||||
* @deprecated Use RestoreFromCompressedBackup instead
|
||||
*
|
||||
* @param $sZipFile
|
||||
* @param string $sEnvironment
|
||||
*/
|
||||
|
||||
@@ -22,12 +22,14 @@ interface BackupArchive
|
||||
{
|
||||
/**
|
||||
* @param string $sFile
|
||||
*
|
||||
* @return bool <b>TRUE</b> if the file is present, <b>FALSE</b> otherwise.
|
||||
*/
|
||||
public function hasFile($sFile);
|
||||
|
||||
/**
|
||||
* @param string $sDirectory
|
||||
*
|
||||
* @return bool <b>TRUE</b> if the directory is present, <b>FALSE</b> otherwise.
|
||||
*/
|
||||
public function hasDir($sDirectory);
|
||||
@@ -35,6 +37,7 @@ interface BackupArchive
|
||||
/**
|
||||
* @param string $sDestinationDir
|
||||
* @param string $sArchiveFile
|
||||
*
|
||||
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
|
||||
*/
|
||||
public function extractFileTo($sDestinationDir, $sArchiveFile);
|
||||
@@ -42,17 +45,22 @@ interface BackupArchive
|
||||
/**
|
||||
* Extract a whole directory from the archive.
|
||||
* Usage: $oArchive->extractDirTo('/var/www/html/itop/data', '/production-modules/')
|
||||
*
|
||||
* @param string $sDestinationDir
|
||||
* @param string $sArchiveDir Note: must start and end with a slash !!
|
||||
*
|
||||
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
|
||||
*/
|
||||
public function extractDirTo($sDestinationDir, $sArchiveDir);
|
||||
|
||||
/**
|
||||
* Returns the entry contents using its name
|
||||
*
|
||||
* @param string $name Name of the entry
|
||||
* @param int $length [optional] The length to be read from the entry. If 0, then the entire entry is read.
|
||||
* @param int $flags [optional] The flags to use to open the archive. the following values may be ORed to it. <b>ZipArchive::FL_UNCHANGED</b>
|
||||
* @param int $flags [optional] The flags to use to open the archive. the following values may be ORed to it.
|
||||
* <b>ZipArchive::FL_UNCHANGED</b>
|
||||
*
|
||||
* @return string the contents of the entry on success or <b>FALSE</b> on failure.
|
||||
*/
|
||||
public function getFromName($name, $length = 0, $flags = null);
|
||||
@@ -102,6 +110,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
|
||||
/**
|
||||
* @param string $sFile
|
||||
*
|
||||
* @return bool <b>TRUE</b> if the file is present, <b>FALSE</b> otherwise.
|
||||
*/
|
||||
public function hasFile($sFile)
|
||||
@@ -111,6 +120,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
|
||||
/**
|
||||
* @param string $sDirectory
|
||||
*
|
||||
* @return bool <b>TRUE</b> if the directory is present, <b>FALSE</b> otherwise.
|
||||
*/
|
||||
public function hasDir($sDirectory)
|
||||
@@ -121,6 +131,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
/**
|
||||
* @param string $sDestinationDir
|
||||
* @param string $sArchiveFile
|
||||
*
|
||||
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
|
||||
*/
|
||||
public function extractFileTo($sDestinationDir, $sArchiveFile)
|
||||
@@ -131,8 +142,10 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
/**
|
||||
* Extract a whole directory from the archive.
|
||||
* Usage: $oZip->extractDirTo('/var/www/html/itop/data', '/production-modules/')
|
||||
*
|
||||
* @param string $sDestinationDir
|
||||
* @param string $sZipDir Must start and end with a slash !!
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function extractDirTo($sDestinationDir, $sZipDir)
|
||||
@@ -153,6 +166,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} // class ZipArchiveEx
|
||||
@@ -220,6 +234,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
|
||||
/**
|
||||
* Create a normalized backup name, depending on the current date/time and Database
|
||||
*
|
||||
* @param sNameSpec string Name and path, eventually containing itop placeholders + time formatting specs
|
||||
*/
|
||||
public function SetMySQLBinDir($sMySQLBinDir)
|
||||
@@ -229,6 +244,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
|
||||
/**
|
||||
* Create a normalized backup name, depending on the current date/time and Database
|
||||
*
|
||||
* @param string sNameSpec Name and path, eventually containing itop placeholders + time formatting specs
|
||||
*/
|
||||
public function MakeName($sNameSpec = "__DB__-%Y-%m-%d")
|
||||
@@ -239,6 +255,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
$sFileName = str_replace('__SUBNAME__', $this->sDBSubName, $sFileName);
|
||||
// Transform %Y, etc.
|
||||
$sFileName = strftime($sFileName);
|
||||
|
||||
return $sFileName;
|
||||
}
|
||||
|
||||
@@ -345,6 +362,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
$sDataFile = $sTmpFolder.'/itop-dump.sql';
|
||||
$this->DoBackup($sDataFile);
|
||||
$aRet[] = $sDataFile;
|
||||
|
||||
return $aRet;
|
||||
}
|
||||
|
||||
@@ -471,7 +489,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
|
||||
$oZip = new ZipArchiveEx();
|
||||
$res = $oZip->open($sZipArchiveFile, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
||||
if ($res === TRUE)
|
||||
if ($res === true)
|
||||
{
|
||||
foreach ($aFiles as $aFile)
|
||||
{
|
||||
@@ -588,6 +606,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
|
||||
{
|
||||
$aTables[] = $aRow[0];
|
||||
}
|
||||
|
||||
return $aTables;
|
||||
}
|
||||
|
||||
@@ -695,6 +714,7 @@ class TarGzArchive implements BackupArchive
|
||||
|
||||
/**
|
||||
* @param string $sFile
|
||||
*
|
||||
* @return bool <b>TRUE</b> if the file is present, <b>FALSE</b> otherwise.
|
||||
*/
|
||||
public function hasFile($sFile)
|
||||
@@ -713,11 +733,13 @@ class TarGzArchive implements BackupArchive
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDirectory
|
||||
*
|
||||
* @return bool <b>TRUE</b> if the directory is present, <b>FALSE</b> otherwise.
|
||||
*/
|
||||
public function hasDir($sDirectory)
|
||||
@@ -736,12 +758,14 @@ class TarGzArchive implements BackupArchive
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDestinationDir
|
||||
* @param string $sArchiveFile
|
||||
*
|
||||
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
|
||||
*/
|
||||
public function extractFileTo($sDestinationDir, $sArchiveFile)
|
||||
@@ -752,8 +776,10 @@ class TarGzArchive implements BackupArchive
|
||||
/**
|
||||
* Extract a whole directory from the archive.
|
||||
* Usage: $oArchive->extractDirTo('/var/www/html/itop/data', '/production-modules/')
|
||||
*
|
||||
* @param string $sDestinationDir
|
||||
* @param string $sArchiveDir
|
||||
*
|
||||
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
|
||||
*/
|
||||
public function extractDirTo($sDestinationDir, $sArchiveDir)
|
||||
@@ -763,9 +789,11 @@ class TarGzArchive implements BackupArchive
|
||||
|
||||
/**
|
||||
* Returns the entry contents using its name
|
||||
*
|
||||
* @param string $name Name of the entry
|
||||
* @param int $length unused.
|
||||
* @param int $flags unused.
|
||||
*
|
||||
* @return string the contents of the entry on success or <b>FALSE</b> on failure.
|
||||
*/
|
||||
public function getFromName($name, $length = 0, $flags = null)
|
||||
|
||||
Reference in New Issue
Block a user