diff --git a/backup/log.php b/backup/log.php index 5fd40316024..0e90fa2436a 100644 --- a/backup/log.php +++ b/backup/log.php @@ -22,8 +22,10 @@ $stradmin = get_string("administration"); $strconfiguration = get_string("configuration"); $strbackup = get_string("backup"); + $strbackupdetails = get_string("backupdetails"); $strlogs = get_string("logs"); $strftimedatetime = get_string("strftimerecent"); + $strftimetime = get_string("strftimetime").":%S"; $strerror = get_string("error"); $strok = get_string("ok"); $strcourse = get_string("course"); @@ -31,15 +33,15 @@ $strstatus = get_string("status"); $strnext = get_string("next"); - print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname, - "$stradmin -> ". - "$strconfiguration -> ". - "$strbackup -> ". - $strlogs); - //Decide when to show last execution logs or detailed logs //Lastlog view if (!$courseid) { + print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname, + "$stradmin -> ". + "$strconfiguration -> ". + "$strbackup -> ". + $strlogs); + print_heading($backuploglaststatus); print_simple_box_start("center", "", "$THEME->cellheading"); //Now, get every record from backup_courses @@ -60,7 +62,7 @@ $coursename = get_field ("course","fullname","id",$course->courseid); if ($coursename) { echo ""; - echo "courseid\">".$coursename.""; + echo "courseid\">".$coursename.""; echo "".userdate($course->laststarttime,$strftimedatetime).""; echo " - "; echo "".userdate($course->lastendtime,$strftimedatetime).""; @@ -78,14 +80,55 @@ print_simple_box_end(); //Detailed View !! } else { + print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname, + "$stradmin -> ". + "$strconfiguration -> ". + "$strbackup -> ". + "$strlogs -> ". + $strbackupdetails); + print_heading($backuplogdetailed); + + $coursename = get_field("course","fullname","id","$courseid"); + print_heading("$strcourse: $coursename"); + print_simple_box_start("center", "", "$THEME->cellheading"); //First, me get all the distinct backups for that course in backup_log - $executions = get_records_sql("SELECT DISTINCT id,laststarttime + $executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime FROM {$CFG->prefix}backup_log - WHERE courseid = '$courseid'"); - + WHERE courseid = '$courseid' + ORDER BY laststarttime DESC"); + + //Iterate over backup executions + if (!$executions) { + notify("No logs found!"); + } else { + echo ""; + foreach($executions as $execution) { + echo ""; + echo ""; + echo ""; + $logs = get_records_sql("SELECT * + FROM {$CFG->prefix}backup_log + WHERE courseid = '$courseid' AND + laststarttime = '$execution->laststarttime' + ORDER BY time"); + if ($logs) { + foreach ($logs as $log) { + echo ""; + echo ""; + $log->info = str_replace("- ERROR!!","- ERROR!!",$log->info); + $log->info = str_replace("- OK","- OK",$log->info); + echo ""; + echo ""; + } + } + } + echo "
"; + print_simple_box("
".userdate($execution->laststarttime)."
", "center"); + echo "
".userdate($log->time,$strftimetime)."".str_replace(" ","    ",$log->info)."
"; + } print_simple_box_end(); }