Merge branch 'MDL-33562-23' of git://github.com/danpoltawski/moodle into MOODLE_23_STABLE
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 17 Jun 2013 22:48:50 +0000 (00:48 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 17 Jun 2013 22:48:50 +0000 (00:48 +0200)
Conflicts:
version.php

lib/db/upgrade.php
lib/moodlelib.php
version.php

index cc0cc36..73d48f8 100644 (file)
@@ -1187,5 +1187,14 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2012062507.01);
     }
 
+    if ($oldversion < 2012062507.06) {
+        // Clean up old tokens which haven't been deleted.
+        $DB->execute("DELETE FROM {user_private_key} WHERE NOT EXISTS
+                         (SELECT 'x' FROM {user} WHERE deleted = 0 AND id = userid)");
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2012062507.06);
+    }
+
     return true;
 }
index 277b496..a1f8a0a 100644 (file)
@@ -4031,6 +4031,9 @@ function delete_user(stdClass $user) {
     // unauthorise the user for all services
     $DB->delete_records('external_services_users', array('userid'=>$user->id));
 
+    // Remove users private keys.
+    $DB->delete_records('user_private_key', array('userid' => $user->id));
+
     // force logout - may fail if file based sessions used, sorry
     session_kill_user($user->id);
 
index 880310b..bc166b2 100644 (file)
@@ -29,8 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-
-$version  = 2012062507.05;              // YYYYMMDD      = weekly release date of this DEV branch
+$version  = 2012062507.06;              // YYYYMMDD      = weekly release date of this DEV branch
                                         //         RR    = release increments - 00 in DEV branches
                                         //           .XX = incremental changes