Browse Source

Fix capability upgrade issues for Attendance

MOODLE_26_STABLE
Tim Lock 11 years ago
parent
commit
5b1c00e09e
  1. 7
      locallib.php

7
locallib.php

@ -1438,6 +1438,13 @@ function attforblock_upgrade() {
WHERE itemmodule = ?"; WHERE itemmodule = ?";
$DB->execute($sql, array('attendance', 'attforblock')); $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. // Clear cache for courses with attendances.
$attendances = $DB->get_recordset('attendance', array(), '', 'course'); $attendances = $DB->get_recordset('attendance', array(), '', 'course');
foreach ($attendances as $attendance) { foreach ($attendances as $attendance) {

Loading…
Cancel
Save