Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-33531_23' of git://github.com/dmonllao/moodle into …

…MOODLE_23_STABLE
  • Loading branch information...
commit a9c8c1c95144d9ed23d8432712f92a5f8d4fb56c 2 parents 02d8fb1 + 3de32f8
@samhemelryk samhemelryk authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 backup/util/helper/backup_cron_helper.class.php
View
13 backup/util/helper/backup_cron_helper.class.php
@@ -508,7 +508,18 @@ public static function remove_excess_backups($course) {
if (!empty($dir) && ($storage == 1 || $storage == 2)) {
// Calculate backup filename regex, ignoring the date/time/info parts that can be
// variable, depending of languages, formats and automated backup settings
- $filename = $backupword . '-' . backup::FORMAT_MOODLE . '-' . backup::TYPE_1COURSE . '-' .$course->id . '-';
+
+
+ // MDL-33531: use different filenames depending on backup_shortname option
+ if ( !empty($config->backup_shortname) ) {
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseref = format_string($course->shortname, true, array('context' => $context));
+ $courseref = str_replace(' ', '_', $courseref);
+ $courseref = textlib::strtolower(trim(clean_filename($courseref), '_'));
+ } else {
+ $courseref = $course->id;
+ }
+ $filename = $backupword . '-' . backup::FORMAT_MOODLE . '-' . backup::TYPE_1COURSE . '-' .$courseref . '-';
$regex = '#^'.preg_quote($filename, '#').'.*\.mbz$#';
// Store all the matching files into fullpath => timemodified array
Please sign in to comment.
Something went wrong with that request. Please try again.