From edb257109e8407059582b1dbe196963d444fc8df Mon Sep 17 00:00:00 2001 From: Charles Fulton Date: Fri, 20 Apr 2012 08:42:55 -0700 Subject: [PATCH] MDL-28657 backup: make automated backup filenames site admin-configurable --- admin/settings/courses.php | 1 + backup/util/helper/backup_cron_helper.class.php | 2 +- lang/en/admin.php | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/admin/settings/courses.php b/admin/settings/courses.php index 1aa8578ca5b2b..92d824d22ad50 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -138,6 +138,7 @@ 400 => '400', 500 => '500'); $temp->add(new admin_setting_configselect('backup/backup_auto_keep', get_string('keep'), get_string('backupkeephelp'), 1, $keepoptoins)); + $temp->add(new admin_setting_configcheckbox('backup/backup_shortname', get_string('backup_shortname', 'admin'), get_string('backup_shortnamehelp', 'admin'), 0)); $temp->add(new admin_setting_heading('automatedsettings', get_string('automatedsettings','backup'), '')); diff --git a/backup/util/helper/backup_cron_helper.class.php b/backup/util/helper/backup_cron_helper.class.php index b359975715762..ba433804d5b9d 100644 --- a/backup/util/helper/backup_cron_helper.class.php +++ b/backup/util/helper/backup_cron_helper.class.php @@ -356,7 +356,7 @@ public static function launch_automated_backup($course, $starttime, $userid) { $dir = null; } if (!empty($dir) && $storage !== 0) { - $filename = backup_plan_dbops::get_default_backup_filename($format, $type, $course->id, $users, $anonymised, true); + $filename = backup_plan_dbops::get_default_backup_filename($format, $type, $course->id, $users, $anonymised, !$config->backup_shortname); $outcome = $file->copy_content_to($dir.'/'.$filename); if ($outcome && $storage === 1) { $file->delete(); diff --git a/lang/en/admin.php b/lang/en/admin.php index 2c893be04566d..59105a53b44b9 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -66,6 +66,8 @@ $string['availablelicenses'] = 'Available licences'; $string['backgroundcolour'] = 'Transparent colour'; $string['backups'] = 'Backups'; +$string['backup_shortname'] = 'Use course name in backup filename'; +$string['backup_shortnamehelp'] = 'Use the course name as part of the backup filename instead of the course id number.'; $string['badwordsconfig'] = 'Enter your list of bad words separated by commas.'; $string['badwordsdefault'] = 'If the custom list is empty, a default list from the language pack will be used.'; $string['badwordslist'] = 'Custom bad words list';