Commit 9c703b6f authored by DamienMcKenna's avatar DamienMcKenna Committed by DamienMcKenna

Issue #2941981 by DamienMcKenna, Rick J, camhoward: Backup files being...

Issue #2941981 by DamienMcKenna, Rick J, camhoward: Backup files being overwritten because of a change to the append_timestamp setting.
parent 0115f1f4
......@@ -769,3 +769,10 @@ function backup_migrate_update_7305() {
'default' => 'builtin',
));
}
/**
* Leave a message to explain the mixup over the backup option.
*/
function backup_migrate_update_7306() {
drupal_set_message(t('Please note that release 7.x-3.4 had a bug which caused all backups to be overwritten instead of having a timestamp added. Please review all backup settings to ensure they work as intended.'), 'warning');
}
......@@ -34,7 +34,7 @@ class backup_migrate_destination_files extends backup_migrate_destination {
$filepath = rtrim($dir, "/") ."/". $file->filename();
// Allow files to be overwritten by the filesystem.
$replace_method = $settings->append_timestamp == 1 ? FILE_EXISTS_REPLACE : FILE_EXISTS_RENAME;
$replace_method = $settings->append_timestamp == 2 ? FILE_EXISTS_REPLACE : FILE_EXISTS_RENAME;
// Copy the file if there are multiple destinations.
if (count($settings->get_destinations()) > 1) {
......
......@@ -154,7 +154,7 @@ function _backup_migrate_construct_filename($settings) {
// Generate a timestamp if needed.
$timestamp = '';
if ($settings->append_timestamp == 2 && $settings->timestamp_format) {
if ($settings->append_timestamp == 1 && $settings->timestamp_format) {
$timestamp = format_date(time(), 'custom', $settings->timestamp_format);
}
......
......@@ -123,17 +123,17 @@ function _backup_migrate_ui_backup_settings_form($profile) {
$form['file']['append_timestamp'] = array(
"#type" => "radios",
'#options' => array(
0 => t('Create seperate backups even if `Backup file name` is the same.'),
1 => t('Overwrite backup.'),
2 => t('Append timestamp.'),
0 => t('Create separate backups if `Backup file name` already exists'),
2 => t('Overwrite the existing backup file'),
1 => t('Append the timestamp'),
),
"#title" => t("Save modes."),
"#title" => t("Save mode"),
"#default_value" => $profile->append_timestamp,
);
$form['file']['timestamp_format_wrapper'] = array(
'#type' => 'backup_migrate_dependent',
'#dependencies' => array(
'append_timestamp' => 2,
'append_timestamp' => 1,
),
);
$form['file']['timestamp_format_wrapper']['timestamp_format'] = array(
......
Markdown is supported
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