Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
47f7dfba
Commit
47f7dfba
authored
Feb 04, 2021
by
Marc Egger
Browse files
rename form backup directory and backup file name pattern
parent
00690ab4
Pipeline
#4956
passed with stages
in 4 minutes and 16 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/Form/FormAsFile.php
View file @
47f7dfba
...
...
@@ -779,12 +779,12 @@ class FormAsFile
}
}
$cwdToBackupFile
=
Path
::
join
(
$cwdToBackup
,
$formName
.
'.'
.
date
(
'Y-m-d_H-i-s'
)
.
".
$tag
.json
"
);
$cwdToBackupFile
=
Path
::
join
(
$cwdToBackup
,
$formName
.
'.
json.
'
.
date
(
'Y-m-d_H-i-s'
)
.
".
$tag
"
);
// add index to filename if backup file with current timestamp already exists
$index
=
1
;
while
(
file_exists
(
$cwdToBackupFile
))
{
$cwdToBackupFile
=
Path
::
join
(
$cwdToBackup
,
$formName
.
'.'
.
date
(
'Y-m-d_H-i-s'
)
.
".
$index
.
$tag
.json
"
);
$cwdToBackupFile
=
Path
::
join
(
$cwdToBackup
,
$formName
.
'.
json.
'
.
date
(
'Y-m-d_H-i-s'
)
.
".
$index
.
$tag
"
);
$index
++
;
if
(
$index
>
20
)
{
Thrower
::
userFormException
(
'Error while trying to backup form file.'
,
'Infinite loop.'
);
...
...
extension/Classes/Core/Helper/Path.php
View file @
47f7dfba
...
...
@@ -57,9 +57,9 @@ class Path
private
const
APP_TO_PROJECT_IN_PROTECTED
=
'fileadmin/protected/qfqProject'
;
const
PROJECT_TO_FORM
=
'form'
;
const
PROJECT_TO_CONF
=
'conf'
;
const
FORM_TO_FORM_BACKUP
=
'
_
backup'
;
const
FORM_TO_FORM_BACKUP
=
'
.
backup'
;
const
PROJECT_DIR_TO_REPORT
=
'report'
;
// TODO: refactor: remove DIR from constant name
const
REPORT_FILE_TO_BACKUP
=
'
_
backup'
;
// The path from a directory containing a report file to the directory containing backups of that report file
const
REPORT_FILE_TO_BACKUP
=
'
.
backup'
;
// The path from a directory containing a report file to the directory containing backups of that report file
// Config
const
APP_TO_TYPO3_CONF
=
'typo3conf'
;
...
...
extension/Classes/Core/Report/ReportAsFile.php
View file @
47f7dfba
...
...
@@ -215,14 +215,14 @@ class ReportAsFile
}
}
$cwdToBackupFile
=
Path
::
join
(
$cwdToBackup
,
basename
(
$cwdToReportFile
,
REPORT_FILE_EXTENSION
)
.
'.'
.
date
(
'Y-m-d_H-i-s'
)
.
".json"
);
$cwdToBackupFile
=
Path
::
join
(
$cwdToBackup
,
basename
(
$cwdToReportFile
,
REPORT_FILE_EXTENSION
)
.
REPORT_FILE_EXTENSION
.
'.'
.
date
(
'Y-m-d_H-i-s'
));
// 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
(
'Y-m-d_H-i-s'
)
.
".
$index
.json
"
);
$cwdToBackupFile
=
Path
::
join
(
$cwdToBackup
,
basename
(
$cwdToReportFile
,
REPORT_FILE_EXTENSION
)
.
REPORT_FILE_EXTENSION
.
'.'
.
date
(
'Y-m-d_H-i-s'
)
.
".
$index
"
);
$index
++
;
if
(
$index
>
10
0
)
{
if
(
$index
>
2
0
)
{
Thrower
::
userFormException
(
'Error while trying to backup report file.'
,
'Infinite loop.'
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment