Skip to content

Commit

Permalink
MDL-61578 backup: Prevent backup logging triggering fresh backups.
Browse files Browse the repository at this point in the history
Thanks to Renaat Debleu for their contribution to this solution.
  • Loading branch information
mickhawkins committed Jul 10, 2018
1 parent c7d148d commit 4b9c292
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backup/util/helper/backup_cron_helper.class.php
Expand Up @@ -730,9 +730,16 @@ protected static function get_backups_to_delete($backupfiles, $now) {
protected static function is_course_modified($courseid, $since) {
$logmang = get_log_manager();
$readers = $logmang->get_readers('core\log\sql_reader');
$where = "courseid = :courseid and timecreated > :since and crud <> 'r'";
$params = array('courseid' => $courseid, 'since' => $since);
foreach ($readers as $reader) {

foreach ($readers as $readerpluginname => $reader) {
$where = "courseid = :courseid and timecreated > :since and crud <> 'r'";

// Prevent logs of prevous backups causing a false positive.
if ($readerpluginname != 'logstore_legacy') {
$where .= " and target <> 'course_backup'";
}

if ($reader->get_events_select_count($where, $params)) {
return true;
}
Expand Down

0 comments on commit 4b9c292

Please sign in to comment.