MDL-28346 Backup: Added new status 'warning' for backup result

This commit is contained in:
Frederic Massart 2012-07-30 14:10:46 +08:00
parent 569f1ad63b
commit 05e521c9bc
4 changed files with 55 additions and 15 deletions

View file

@ -27,6 +27,9 @@ require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/backup/lib.php');
// Required for constants in backup_cron_automated_helper
require_once($CFG->dirroot.'/backup/util/helper/backup_cron_helper.class.php');
admin_externalpage_setup('reportbackups', '', null, '', array('pagelayout'=>'report'));
$table = new html_table;
@ -45,6 +48,7 @@ $strerror = get_string("error");
$strok = get_string("ok");
$strunfinished = get_string("unfinished");
$strskipped = get_string("skipped");
$strwarning = get_string("warning");
list($select, $join) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$sql = "SELECT bc.*, c.fullname $select
@ -58,15 +62,18 @@ foreach ($rs as $backuprow) {
context_instance_preload($backuprow);
// Prepare a cell to display the status of the entry
if ($backuprow->laststatus == 1) {
if ($backuprow->laststatus == backup_cron_automated_helper::BACKUP_STATUS_OK) {
$status = $strok;
$statusclass = 'backup-ok'; // Green
} else if ($backuprow->laststatus == 2) {
} else if ($backuprow->laststatus == backup_cron_automated_helper::BACKUP_STATUS_UNFINISHED) {
$status = $strunfinished;
$statusclass = 'backup-unfinished'; // Red
} else if ($backuprow->laststatus == 3) {
} else if ($backuprow->laststatus == backup_cron_automated_helper::BACKUP_STATUS_SKIPPED) {
$status = $strskipped;
$statusclass = 'backup-skipped'; // Green
} else if ($backuprow->laststatus == backup_cron_automated_helper::BACKUP_STATUS_WARNING) {
$status = $strwarning;
$statusclass = 'backup-warning'; // Orange
} else {
$status = $strerror;
$statusclass = 'backup-error'; // Red