MDL-59848 auth: Remove config for old plugins
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 17 Aug 2017 03:35:02 +0000 (11:35 +0800)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 22 Aug 2017 10:20:19 +0000 (12:20 +0200)
Note: (stronk7@moodle.org) Amended slightly from original to update versions.

lib/db/upgrade.php
version.php

index 638044f..ef2c2df 100644 (file)
@@ -2308,5 +2308,19 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2017080700.01);
     }
 
         upgrade_main_savepoint(true, 2017080700.01);
     }
 
+    if ($oldversion < 2017082200.00) {
+        $plugins = ['radius', 'fc', 'nntp', 'pam', 'pop3', 'imap'];
+
+        foreach ($plugins as $plugin) {
+            // Check to see if the plugin exists on disk.
+            // If it does not, remove the config for it.
+            if (!file_exists($CFG->dirroot . "/auth/{$plugin}/auth.php")) {
+                // Clean config.
+                unset_all_config_for_plugin("auth_{$plugin}");
+            }
+        }
+        upgrade_main_savepoint(true, 2017082200.00);
+    }
+
     return true;
 }
     return true;
 }
index 6c1203d..6483437 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2017081700.00;              // YYYYMMDD      = weekly release date of this DEV branch.
+$version  = 2017082200.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.
 
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.