Skip to content

Commit af4158b

Browse files
committed
fix creating backup by changing to mode_general (#233), fix amount indicator delayed courses, fix missing courses error page (#228)
1 parent a081c8a commit af4158b

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

classes/local/manager/backup_manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public static function create_course_backup($courseid) {
6868
}
6969
// Perform Backup.
7070
$bc = new \backup_controller(\backup::TYPE_1COURSE, $courseid, \backup::FORMAT_MOODLE,
71-
\backup::INTERACTIVE_NO, \backup::MODE_AUTOMATED, get_admin()->id);
72-
$bc->execute_plan(); // Execute backup.
71+
\backup::INTERACTIVE_NO, \backup::MODE_GENERAL, get_admin()->id);
72+
$bc->execute_plan(); // Execute backup.
7373
$results = $bc->get_results(); // Get the file information needed.
7474
/* @var $file \stored_file instance of the backup file*/
7575
$file = $results['backup_destination'];

classes/local/table/process_errors_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct() {
5656
'rollback' => get_string('rollback', 'tool_lifecycle'),
5757
];
5858

59-
$fields = 'c.fullname as course, w.title as workflow, s.instancename as step, pe.*';
59+
$fields = 'c.id, c.fullname as course, w.title as workflow, s.instancename as step, pe.*';
6060

6161
$from = '{tool_lifecycle_proc_error} pe ' .
6262
'JOIN {tool_lifecycle_workflow} w ON pe.workflowid = w.id ' .

classes/tabs.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,18 @@ public static function get_tabrow($activelink = false, $deactivatelink = false,
7171
$i = $DB->count_records_sql($sql);
7272
$deactivatedewf = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
7373

74+
$time = time();
7475
// Get number of delayed courses.
75-
$sql = "select count(id)
76-
from {tool_lifecycle_delayed}";
76+
$sql = "select count(c.id) from {course} c LEFT JOIN
77+
(SELECT dw.courseid, dw.workflowid, w.title as workflow, dw.delayeduntil as workflowdelay,maxtable.wfcount as workflowcount
78+
FROM ( SELECT courseid, MAX(dw.id) AS maxid, COUNT(*) AS wfcount FROM {tool_lifecycle_delayed_workf} dw
79+
JOIN {tool_lifecycle_workflow} w ON dw.workflowid = w.id
80+
WHERE dw.delayeduntil >= $time AND w.timeactive IS NOT NULL GROUP BY courseid ) maxtable JOIN
81+
{tool_lifecycle_delayed_workf} dw ON maxtable.maxid = dw.id JOIN
82+
{tool_lifecycle_workflow} w ON dw.workflowid = w.id ) wfdelay ON wfdelay.courseid = c.id LEFT JOIN
83+
(SELECT * FROM {tool_lifecycle_delayed} d WHERE d.delayeduntil > $time ) d ON c.id = d.courseid JOIN
84+
{course_categories} cat ON c.category = cat.id
85+
where COALESCE(wfdelay.courseid, d.courseid) IS NOT NULL";
7786
$i = $DB->count_records_sql($sql);
7887
$delayedcourses = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
7988

0 commit comments

Comments
 (0)