Skip to content

Commit

Permalink
Merge branch 'MDL-73801-311' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_311_STABLE
  • Loading branch information
snake committed May 26, 2022
2 parents 3cca8ba + a2a37f3 commit 0ed76e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backup/util/helper/backup_cron_helper.class.php
Expand Up @@ -77,6 +77,7 @@ abstract class backup_cron_automated_helper {
* First backup courses that do not have an entry in backup_courses first,
* as they are likely new and never been backed up. Do the oldest modified courses first.
* Then backup courses that have previously been backed up starting with the oldest next start time.
* Finally, all else being equal, defer to the sortorder of the courses.
*
* @param null|int $now timestamp to use in course selection.
* @return moodle_recordset The recordset of matching courses.
Expand All @@ -93,7 +94,8 @@ protected static function get_courses($now = null) {
LEFT JOIN {backup_courses} bc ON bc.courseid = c.id
WHERE bc.nextstarttime IS NULL OR bc.nextstarttime < ?
ORDER BY nextstarttime ASC,
c.timemodified DESC';
c.timemodified DESC,
c.sortorder';

$params = array(
$now, // Only get courses where the backup start time is in the past.
Expand Down
2 changes: 1 addition & 1 deletion backup/util/helper/tests/cronhelper_test.php
Expand Up @@ -393,7 +393,7 @@ private function course_setup() {
$backupcourse3 = new \stdClass;
$backupcourse3->courseid = $course3->id;
$backupcourse3->laststatus = testable_backup_cron_automated_helper::BACKUP_STATUS_OK;
$backupcourse3->nextstarttime = 1554858160;
$backupcourse3->nextstarttime = 1554822160;
$DB->insert_record('backup_courses', $backupcourse3);

$backupcourse4 = new \stdClass;
Expand Down

0 comments on commit 0ed76e9

Please sign in to comment.