}
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);