Commit 06d1e9fc authored by Marc Egger's avatar Marc Egger
Browse files

form as file: change backup file name convention (date with -_)

parent 43b9f1db
Pipeline #4011 failed with stages
in 4 minutes and 7 seconds
......@@ -750,12 +750,12 @@ class FormAsFile
}
}
$cwdToBackupFile = Path::join($cwdToBackup, $formName . '.' . date('YmdHis') . ".$tag.json");
$cwdToBackupFile = Path::join($cwdToBackup, $formName . '.' . date('Y-m-d_H-i-s') . ".$tag.json");
// add index to filename if backup file with current timestamp already exists
$index = 1;
while (file_exists($cwdToBackupFile)) {
$cwdToBackupFile = Path::join($cwdToBackup, $formName . '.' . date('YmdHis') . ".$index.$tag.json");
$cwdToBackupFile = Path::join($cwdToBackup, $formName . '.' . date('Y-m-d_H-i-s') . ".$index.$tag.json");
$index ++;
if ($index > 100) {
Thrower::userFormException('Error while trying to backup form file.', 'Infinite loop.');
......
......@@ -215,12 +215,12 @@ class ReportAsFile
}
}
$cwdToBackupFile = Path::join($cwdToBackup, basename($cwdToReportFile, REPORT_FILE_EXTENSION) . '.' . date('YmdHis') . ".json");
$cwdToBackupFile = Path::join($cwdToBackup, basename($cwdToReportFile, REPORT_FILE_EXTENSION) . '.' . date('Y-m-d_H-i-s') . ".json");
// add index to filename if backup file with current timestamp already exists
$index = 1;
while (file_exists($cwdToBackupFile)) {
$cwdToBackupFile = Path::join($cwdToBackup, basename($cwdToReportFile, REPORT_FILE_EXTENSION) . '.' . date('YmdHis') . ".$index.json");
$cwdToBackupFile = Path::join($cwdToBackup, basename($cwdToReportFile, REPORT_FILE_EXTENSION) . '.' . date('Y-m-d_H-i-s') . ".$index.json");
$index ++;
if ($index > 100) {
Thrower::userFormException('Error while trying to backup report file.', 'Infinite loop.');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment