Permalink
Browse files

MDL-33812 Backup: Respect of backup_auto_keep

  • Loading branch information...
1 parent 8f3c8e7 commit cdf58e680c6fa258f2ae8dd692d2de0458c489e3 @FMCorz FMCorz committed Aug 14, 2012
Showing with 10 additions and 6 deletions.
  1. +9 −5 backup/util/dbops/backup_plan_dbops.class.php
  2. +1 −1 lang/en/admin.php
@@ -197,19 +197,19 @@ public static function get_mnet_localhost_wwwroot() {
* @param int $courseid/$sectionid/$cmid
* @param bool $users Should be true is users were included in the backup
* @param bool $anonymised Should be true is user information was anonymized.
- * @param bool $useidasname true to use id, false to use strings (default)
+ * @param bool $withoutname if false, include the name in the file name (default)
* @return string The filename to use
*/
- public static function get_default_backup_filename($format, $type, $id, $users, $anonymised, $useidasname = false) {
+ public static function get_default_backup_filename($format, $type, $id, $users, $anonymised, $withoutname = false) {
global $DB;
// Calculate backup word
$backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename')));
$backupword = trim(clean_filename($backupword), '_');
+ // Not $withoutname, lets fetch the name
$shortname = '';
- // Not $useidasname, lets calculate it, else $id will be used
- if (!$useidasname) {
+ if (!$withoutname) {
// Calculate proper name element (based on type)
switch ($type) {
case backup::TYPE_1COURSE:
@@ -231,7 +231,11 @@ public static function get_default_backup_filename($format, $type, $id, $users,
$shortname = moodle_strtolower(trim(clean_filename($shortname), '_'));
}
- $name = empty($shortname) ? $id : $shortname;
+ // The name will always contain the ID, but we append the course short name if requested.
+ $name = $id;
+ if (!$withoutname && $shortname != '') {
+ $name .= '-' . $shortname;
+ }
// Calculate date
$backupdateformat = str_replace(' ', '_', get_string('backupnameformat', 'langconfig'));
View
@@ -67,7 +67,7 @@
$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['backup_shortnamehelp'] = 'Use the course name as part of the backup filename.';
$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';

0 comments on commit cdf58e6

Please sign in to comment.