From 847f077e39dd7deda8aedef064727faff1013892 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 22 Nov 2009 17:05:14 +0000 Subject: [PATCH] MDL-20933 fixed a regression, we should not force changing of password for admins that can not actually change the password --- lib/db/upgrade.php | 3 ++- version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 8f7c9381b0e..2e4da8edd0d 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -846,6 +846,7 @@ function xmldb_main_upgrade($oldversion=0) { if ($result && $oldversion < 2007021599.14) { // this block tries to undo incorrect forcing of new passwords for admins that have no // way to change passwords MDL-20933 + $systemcontext = get_context_instance(CONTEXT_SYSTEM); $sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, u.picture, u.imagealt, u.email, u.password, u.auth FROM {$CFG->prefix}role_capabilities rc JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = rc.contextid AND ra.roleid = rc.roleid) @@ -853,7 +854,7 @@ function xmldb_main_upgrade($oldversion=0) { WHERE rc.capability = 'moodle/site:doanything' AND rc.permission = ".CAP_ALLOW." AND u.deleted = 0 - AND rc.contextid = ".SYSCONTEXTID.""; + AND rc.contextid = ".$systemcontext->id.""; $adminusers = get_records_sql($sql); foreach ($adminusers as $adminuser) { diff --git a/version.php b/version.php index 027bef36cd5..ac70cb0dd17 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2007021599.13; // YYYYMMDD = date of the 1.8 branch (don't change) + $version = 2007021599.14; // YYYYMMDD = date of the 1.8 branch (don't change) // 99 = we reached a .10 release! (don't change) // .XX = release number 1.8.[10,11,12,..]