Skip to content

Commit

Permalink
MDL-33531 Fixed the regexp to find old backup files, considering back…
Browse files Browse the repository at this point in the history
…up_shortname backup option
  • Loading branch information
nicusX authored and David Monllao committed Aug 10, 2012
1 parent e6aac11 commit 203e8d4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backup/util/helper/backup_cron_helper.class.php
Expand Up @@ -508,7 +508,17 @@ 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 ( $config->backup_shortname ) {
$courseref = $course->shortname;
$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
Expand Down

0 comments on commit 203e8d4

Please sign in to comment.