MDL-32450 upgrade: do not remove DragMath settings if the files still exist
authorMark Nelson <markn@moodle.com>
Thu, 19 Jun 2014 01:54:44 +0000 (18:54 -0700)
committerMark Nelson <markn@moodle.com>
Sun, 29 Jun 2014 22:48:21 +0000 (15:48 -0700)
lib/db/upgrade.php

index 38cd760..ba5ccae 100644 (file)
@@ -3677,9 +3677,12 @@ function xmldb_main_upgrade($oldversion) {
     }
 
     if ($oldversion < 2014062600.01) {
-        // Purge DragMath plugin which is incompatible with GNU GPL license.
-        // Hacky emulation of plugin uninstallation.
-        unset_all_config_for_plugin('tinymce_dragmath');
+        // We only want to delete DragMath if the directory no longer exists. If the directory
+        // is present then it means it has been restored, so do not perform the uninstall.
+        if (!check_dir_exists($CFG->libdir . '/editor/tinymce/plugins/dragmath', false)) {
+            // Purge DragMath plugin which is incompatible with GNU GPL license.
+            unset_all_config_for_plugin('tinymce_dragmath');
+        }
 
         // Main savepoint reached.
         upgrade_main_savepoint(true, 2014062600.01);