Skip to content

Commit

Permalink
Merge branch 'MDL-47601_m27' of https://github.com/markn86/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_27_STABLE
  • Loading branch information
danpoltawski committed Nov 24, 2014
2 parents a054294 + 1b74866 commit e7f3fb0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions backup/util/helper/backup_cron_helper.class.php
Expand Up @@ -556,9 +556,6 @@ public static function remove_excess_backups($course) {
return true;
}

$backupword = str_replace(' ', '_', core_text::strtolower(get_string('backupfilename')));
$backupword = trim(clean_filename($backupword), '_');

if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) {
$dir = null;
}
Expand All @@ -573,9 +570,6 @@ public static function remove_excess_backups($course) {
$files = array();
// Store all the matching files into timemodified => stored_file array.
foreach ($fs->get_area_files($context->id, $component, $filearea, $itemid) as $file) {
if (strpos($file->get_filename(), $backupword) !== 0) {
continue;
}
$files[$file->get_timemodified()] = $file;
}
if (count($files) <= $keep) {
Expand All @@ -595,8 +589,8 @@ 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 . '-';
$regex = '#^'.preg_quote($filename, '#').'.*\.mbz$#';
$filename = backup::FORMAT_MOODLE . '-' . backup::TYPE_1COURSE . '-' . $course->id . '-';
$regex = '#' . preg_quote($filename, '#') . '.*\.mbz$#';

// Store all the matching files into filename => timemodified array.
$files = array();
Expand Down

0 comments on commit e7f3fb0

Please sign in to comment.