From 5b1c00e09eaaf871cc5917af195fef50adfeb426 Mon Sep 17 00:00:00 2001 From: Tim Lock Date: Mon, 28 Oct 2013 09:39:59 +1030 Subject: [PATCH] Fix capability upgrade issues for Attendance --- locallib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/locallib.php b/locallib.php index 28a081e..f377c18 100644 --- a/locallib.php +++ b/locallib.php @@ -1438,6 +1438,13 @@ function attforblock_upgrade() { WHERE itemmodule = ?"; $DB->execute($sql, array('attendance', 'attforblock')); + // Now convert role capabilities to 'attendance' + $sql = "UPDATE {role_capabilities} + SET capability = REPLACE(capability, ?, ?) + WHERE " . $DB->sql_like('capability', '?'); + $params = array("mod/attforblock:", "mod/attendance:", "mod/attforblock:%"); + $DB->execute($sql, $params); + // Clear cache for courses with attendances. $attendances = $DB->get_recordset('attendance', array(), '', 'course'); foreach ($attendances as $attendance) {