mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-03 23:52:24 +01:00
External backups can be downloaded from the "About info page".
This commit is contained in:
@@ -2004,11 +2004,15 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
||||
// Skip directories (they would be added automatically)
|
||||
if (!$file->isDir()) {
|
||||
// Get real and relative path for current file
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = substr($filePath, strlen($rootPath) + 1);
|
||||
$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
|
||||
$fileName = $file->getFilename();
|
||||
$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
|
||||
|
||||
//$relativePath = substr($fileFullRealPath, strlen($rootPath) + 1);
|
||||
$relativePath = substr(($filePath ? $filePath.'/' : '').$fileName, strlen($rootPath) + 1);
|
||||
|
||||
// Add current file to archive
|
||||
$zip->addFile($filePath, $relativePath);
|
||||
$zip->addFile($fileFullRealPath, $relativePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2196,22 +2200,29 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
|
||||
}
|
||||
|
||||
// Create recursive directory iterator
|
||||
// This does not return symbolic links
|
||||
/** @var SplFileInfo[] $files */
|
||||
$files = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($inputdir),
|
||||
RecursiveIteratorIterator::LEAVES_ONLY
|
||||
);
|
||||
|
||||
//var_dump($inputdir);
|
||||
foreach ($files as $name => $file) {
|
||||
// Skip directories (they would be added automatically)
|
||||
if (!$file->isDir()) {
|
||||
// Get real and relative path for current file
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1);
|
||||
$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
|
||||
$fileName = $file->getFilename();
|
||||
$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
|
||||
|
||||
if (empty($excludefiles) || !preg_match($excludefiles, $filePath)) {
|
||||
//$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($fileFullRealPath, strlen($inputdir) + 1);
|
||||
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr(($filePath ? $filePath.'/' : '').$fileName, strlen($inputdir) + 1);
|
||||
|
||||
//var_dump($filePath);var_dump($fileFullRealPath);var_dump($relativePath);
|
||||
if (empty($excludefiles) || !preg_match($excludefiles, $fileFullRealPath)) {
|
||||
// Add current file to archive
|
||||
$zip->addFile($filePath, $relativePath);
|
||||
$zip->addFile($fileFullRealPath, $relativePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user