This class is an abstract class with methods that can be called to aid the running of automated backups over cron.
More...
This class is an abstract class with methods that can be called to aid the running of automated backups over cron.
◆ calculate_next_automated_backup()
static backup_cron_automated_helper::calculate_next_automated_backup |
( |
|
$ignoredtimezone, |
|
|
|
$now |
|
) |
| |
|
static |
Works out the next time the automated backup should be run.
- Parameters
-
mixed | $ignoredtimezone | all settings are in server timezone! |
int | $now | timestamp, should not be in the past, most likely time() |
- Return values
-
int | timestamp of the next execution at server time |
◆ get_automated_backup_state()
static moodle_database backup_cron_automated_helper::get_automated_backup_state |
( |
|
$rundirective = self::RUN_ON_SCHEDULE | ) |
|
|
static |
Gets the state of the automated backup system.
$DB
- Return values
-
◆ get_backup_status_array()
static moodle_database backup_cron_automated_helper::get_backup_status_array |
( |
| ) |
|
|
static |
Gets the results from the last automated backup that was run based upon the statuses of the courses that were looked at.
$DB
- Return values
-
◆ get_backups_to_delete()
static backup_cron_automated_helper::get_backups_to_delete |
( |
|
$backupfiles, |
|
|
|
$now |
|
) |
| |
|
staticprotected |
Get the list of backup files to delete depending on the automated backup settings.
- Parameters
-
array | $backupfiles | Existing backup files |
int | $now | Starting time of the process |
- Return values
-
array | Backup files to delete |
◆ get_courses()
static backup_cron_automated_helper::get_courses |
( |
|
$now = null | ) |
|
|
staticprotected |
Get the courses to backup.
When there are multiple courses to backup enforce some order to the record set. The following is the preference order. 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.
- Parameters
-
null | int | $now | timestamp to use in course selection. |
- Return values
-
◆ is_course_modified()
static backup_cron_automated_helper::is_course_modified |
( |
|
$courseid, |
|
|
|
$since |
|
) |
| |
|
staticprotected |
Check logs to find out if a course was modified since the given time.
- Parameters
-
int | $courseid | course id to check |
int | $since | timestamp, from which to check |
- Return values
-
bool | true if the course was modified, false otherwise. This also returns false if no readers are enabled. This is intentional, since we cannot reliably determine if any modification was made or not. |
◆ launch_automated_backup()
static backup_cron_automated_helper::launch_automated_backup |
( |
|
$course, |
|
|
|
$starttime, |
|
|
|
$userid |
|
) |
| |
|
static |
Launches a automated backup routine for the given course.
- Parameters
-
stdClass | $course | |
int | $starttime | |
int | $userid | |
- Return values
-
◆ outcome_from_results()
static backup_cron_automated_helper::outcome_from_results |
( |
|
$results | ) |
|
|
static |
Returns the backup outcome by analysing its results.
- Parameters
-
array | $results | returned by a backup |
- Return values
-
◆ remove_deleted_courses_from_schedule()
static moodle_database backup_cron_automated_helper::remove_deleted_courses_from_schedule |
( |
| ) |
|
|
static |
Removes deleted courses fromn the backup_courses table so that we don't waste time backing them up.
$DB
- Return values
-
◆ remove_excess_backups()
static backup_cron_automated_helper::remove_excess_backups |
( |
|
$course, |
|
|
|
$now = null |
|
) |
| |
|
static |
Removes excess backups from a specified course.
- Parameters
-
stdClass | $course | Course object |
int | $now | Starting time of the process |
- Return values
-
bool | Whether or not backups is being removed |
◆ remove_excess_backups_from_course()
static backup_cron_automated_helper::remove_excess_backups_from_course |
( |
|
$course, |
|
|
|
$now |
|
) |
| |
|
staticprotected |
Removes excess backups in the course backup filearea from a specified course.
- Parameters
-
stdClass | $course | Course object |
int | $now | Starting time of the process |
- Return values
-
bool | Whether or not backups are being removed |
◆ remove_excess_backups_from_directory()
static backup_cron_automated_helper::remove_excess_backups_from_directory |
( |
|
$course, |
|
|
|
$now |
|
) |
| |
|
staticprotected |
Removes excess backups in the specified external directory from a specified course.
- Parameters
-
stdClass | $course | Course object |
int | $now | Starting time of the process |
- Return values
-
bool | Whether or not backups are being removed |
◆ run_automated_backup()
static moodle_database backup_cron_automated_helper::run_automated_backup |
( |
|
$rundirective = self::RUN_ON_SCHEDULE | ) |
|
|
static |
Runs the automated backups if required.
$DB
◆ set_state_running()
static backup_cron_automated_helper::set_state_running |
( |
|
$running = true | ) |
|
|
static |
Sets the state of the automated backup system.
- Parameters
-
- Return values
-
◆ RUN_ON_SCHEDULE
const backup_cron_automated_helper::RUN_ON_SCHEDULE = 0 |
Run if required by the schedule set in config.
Default.
The documentation for this class was generated from the following file: