]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20948 proper removal of cached pasword hashes just in case upgrading from <1.9.7
authorPetr Skoda <skodak@moodle.org>
Tue, 24 Nov 2009 14:39:35 +0000 (14:39 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 24 Nov 2009 14:39:35 +0000 (14:39 +0000)
auth/db/auth.php
auth/db/db/install.php [new file with mode: 0644]
auth/db/version.php [new file with mode: 0644]
auth/fc/db/install.php [new file with mode: 0644]
auth/fc/version.php [new file with mode: 0644]
auth/imap/db/install.php [new file with mode: 0644]
auth/imap/version.php [new file with mode: 0644]

index caf57f0c4cfb3798caa18b9d04cecc0c7b6df745..441911cb1e7efcdef17516cd1fdd2ca34e99cfd9 100644 (file)
@@ -576,6 +576,9 @@ class auth_plugin_db extends auth_plugin_base {
      * @return bool
      */
     function is_internal() {
+        if (!isset($this->config->passtype)) {
+            return true;
+        }
         return ($this->config->passtype == 'internal');
     }
 
diff --git a/auth/db/db/install.php b/auth/db/db/install.php
new file mode 100644 (file)
index 0000000..93704bf
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+function xmldb_auth_db_install() {
+    global $CFG, $DB;
+
+    // upgrade from 1.9.x, introducing version.php
+
+    // remove cached passwords, we do not need them for this plugin, but only if internal
+    $type = get_config('auth/db', 'passtype');
+    if ($type and $type !== 'internal') {
+        $DB->set_field('user', 'password', 'not cached', array('auth'=>'db'));
+    }
+
+}
diff --git a/auth/db/version.php b/auth/db/version.php
new file mode 100644 (file)
index 0000000..a744fca
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+
+$plugin->version = 2009112400;
diff --git a/auth/fc/db/install.php b/auth/fc/db/install.php
new file mode 100644 (file)
index 0000000..53be4b4
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+function xmldb_auth_fc_install() {
+    global $CFG, $DB;
+
+    // upgrade from 1.9.x, introducing version.php
+
+    // remove cached passwords, we do not need them for this plugin
+    $DB->set_field('user', 'password', 'not cached', array('auth'=>'fc'));
+
+}
diff --git a/auth/fc/version.php b/auth/fc/version.php
new file mode 100644 (file)
index 0000000..a744fca
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+
+$plugin->version = 2009112400;
diff --git a/auth/imap/db/install.php b/auth/imap/db/install.php
new file mode 100644 (file)
index 0000000..9f43278
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+function xmldb_auth_imap_install() {
+    global $CFG, $DB;
+
+    // upgrade from 1.9.x, introducing version.php
+
+    // remove cached passwords, we do not need them for this plugin
+    $DB->set_field('user', 'password', 'not cached', array('auth'=>'imap'));
+
+}
diff --git a/auth/imap/version.php b/auth/imap/version.php
new file mode 100644 (file)
index 0000000..a744fca
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+
+$plugin->version = 2009112400;