mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Fix extension of backup file
This commit is contained in:
@@ -560,7 +560,7 @@ print load_fiche_titre($title?$title:$langs->trans("BackupZipWizard"));
|
|||||||
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||||
$prefix='documents';
|
$prefix='documents';
|
||||||
$ext='zip';
|
$ext='zip';
|
||||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
|
||||||
print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
|
print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,11 @@ $langs->load("admin");
|
|||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$what=GETPOST('what', 'alpha');
|
$what=GETPOST('what', 'alpha');
|
||||||
$export_type=GETPOST('export_type', 'alpha');
|
$export_type=GETPOST('export_type', 'alpha');
|
||||||
$file=GETPOST('zipfilename_template', 'alpha');
|
$file=trim(GETPOST('zipfilename_template', 'alpha'));
|
||||||
$compression = GETPOST('compression');
|
$compression = GETPOST('compression');
|
||||||
|
|
||||||
$file = dol_sanitizeFileName($file);
|
$file = dol_sanitizeFileName($file);
|
||||||
|
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);
|
||||||
|
|
||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
@@ -112,6 +113,7 @@ $utils = new Utils($db);
|
|||||||
|
|
||||||
if ($compression == 'zip')
|
if ($compression == 'zip')
|
||||||
{
|
{
|
||||||
|
$file .= '.zip';
|
||||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/');
|
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/');
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
{
|
{
|
||||||
@@ -131,7 +133,6 @@ elseif (in_array($compression, array('gz', 'bz')))
|
|||||||
|
|
||||||
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
|
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
|
||||||
|
|
||||||
$file = substr($file, 0, strrpos($file, '.'));
|
|
||||||
$file .= '.tar';
|
$file .= '.tar';
|
||||||
// We also exclude '/temp/' dir and 'documents/admin/documents'
|
// We also exclude '/temp/' dir and 'documents/admin/documents'
|
||||||
$cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude='documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT);
|
$cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude='documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT);
|
||||||
|
|||||||
Reference in New Issue
Block a user