diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 38cd760480e..ba5ccae53ec 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -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);