This class is an abstract class with methods that can be called to aid the running of automated backups over cron.
More...
|
const | AUTO_BACKUP_DISABLED = 0 |
|
const | AUTO_BACKUP_ENABLED = 1 |
|
const | AUTO_BACKUP_MANUAL = 2 |
|
const | BACKUP_STATUS_ERROR = 0 |
| Course automated backup errored.
|
|
const | BACKUP_STATUS_NOTYETRUN = 5 |
| Course automated backup has yet to be run.
|
|
const | BACKUP_STATUS_OK = 1 |
| Course automated backup completed successfully.
|
|
const | BACKUP_STATUS_QUEUED = 6 |
| Course automated backup has been added to adhoc task queue.
|
|
const | BACKUP_STATUS_SKIPPED = 3 |
| Course automated backup was skipped.
|
|
const | BACKUP_STATUS_UNFINISHED = 2 |
| Course automated backup never finished.
|
|
const | BACKUP_STATUS_WARNING = 4 |
| Course automated backup had warnings.
|
|
const | RUN_IMMEDIATELY = 1 |
| Run immediately.
|
|
const | RUN_ON_SCHEDULE = 0 |
| Run if required by the schedule set in config. More...
|
|
const | STATE_DISABLED = 1 |
| Automated backups are disabled and will not be run.
|
|
const | STATE_OK = 0 |
| Automated backups are active and ready to run.
|
|
const | STATE_RUNNING = 2 |
| Automated backups are all ready running!
|
|
const | STORAGE_COURSE = 0 |
| Automated backup storage in course backup filearea.
|
|
const | STORAGE_COURSE_AND_DIRECTORY = 2 |
| Automated backup storage in course backup filearea and specified directory.
|
|
const | STORAGE_DIRECTORY = 1 |
| Automated backup storage in specified directory.
|
|
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_lock()
static backup_cron_automated_helper::get_automated_backup_lock |
( |
|
$rundirective = self::RUN_ON_SCHEDULE | ) |
|
|
static |
Try to get lock for automated backup.
- Parameters
-
- Return values
-
core::lock::lock|boolean | - An instance of core\lock\lock if the lock was obtained, or false. |
◆ get_backup_status_array()
static 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.
- 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 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.
- 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 backup_cron_automated_helper::run_automated_backup |
( |
|
$rundirective = self::RUN_ON_SCHEDULE | ) |
|
|
static |
Runs the automated backups if required.
- Parameters
-
◆ 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: