Error with new plugin settings when filter_wiris is enabled
Hi everyone,
I’ve identified an issue that occurs when the filter_wiris plugin is enabled alongside the Tiny editor in Moodle. Specifically, there is a plugin setting type called admin_setting_confightmleditor, which creates a setting using an HTML editor. Since Tiny is the default editor in Moodle, it is the one used for this setting.
If the filter_wiris plugin is enabled and another plugin with this setting type is added, the page at <site url>/admin/upgradesettings.php becomes inaccessible. This issue arises because caching is disabled on that page, which triggers an exception in the filter_wiris code. The exception is in the FolderTreeStorageAndCache.class.php file, located here: filter/wiris/integration/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.class.php#L63 and here https://github.com/wiris/moodle-filter_wiris/blob/main/integration/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.class.php#L35.
This is a more detailed explanation on how to replicate the error:
- Have a site with Tiny editor enabled by default.
- Add a new plugin or, using a code editor, modify the settings of an existing plugin to add new setting that uses the
admin_setting_confightmleditorsetting type. This can be done modifying thesettings.phpfile from the plugin and adding a code like this:
$settings->add(new admin_setting_confightmleditor('testsetting',
"visiblename",
"description",
"defaultvalue",
PARAM_RAW));
- Save changes.
- Login as admin.
- Go to
<site url>/admin/upgradesettings.php. - With this, the following error is displayed:
uncaught exception: Error: can't write on cache: formulas/Error saving cache on filter_wiris area
in file: /var/www/html/filter/wiris/integration/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.class.php line 69
#0 /var/www/html/filter/wiris/integration/lib/com/wiris/plugin/impl/RenderImpl.class.php(336): com_wiris_plugin_impl_FolderTreeStorageAndCache->codeDigest('')
#1 /var/www/html/filter/wiris/integration/lib/com/wiris/plugin/impl/TextServiceImpl.class.php(80): com_wiris_plugin_impl_RenderImpl->computeDigest(NULL, Array)
#2 /var/www/html/filter/wiris/integration/lib/com/wiris/plugin/impl/TextServiceImpl.class.php(149): com_wiris_plugin_impl_TextServiceImpl->jsonResponse('latex2mathml', Object(com_wiris_plugin_impl_GenericParamsProviderImpl))
#3 /var/www/html/filter/wiris/integration/lib/com/wiris/plugin/impl/TextServiceImpl.class.php(55): com_wiris_plugin_impl_TextServiceImpl->service('latex2mathml', Object(com_wiris_plugin_impl_GenericParamsProviderImpl))
#4 /var/www/html/filter/wiris/integration/lib/com/wiris/plugin/impl/TextServiceImpl.class.php(45): com_wiris_plugin_impl_TextServiceImpl->latex2mathml('$$\\pi$$')
#5 /var/www/html/filter/wiris/subfilters/php.php(94): com_wiris_plugin_impl_TextServiceImpl->getMathML(NULL, '$$\\pi$$')
#6 /var/www/html/filter/wiris/classes/text_filter.php(83): filter_wiris\subfilters\filter_wiris_php->filter('filter_stage_post_clean('filter_text('$$\\pi$$', Object(core\context\system), Array, NULL)
#11 /var/www/html/lib/classes/formatting.php(240): performance_measuring_filter_manager->filter_text('$$\\pi$$', Object(core\context\system), Array)
#12 /var/www/html/lib/weblib.php(1449): core\formatting->format_text('$$\\pi$$', '1', Object(core\context\system))
#13 /var/www/html/lib/editor/tiny/plugins/equation/classes/plugininfo.php(66): format_text('$$\\pi$$', true, Array)
#14 /var/www/html/lib/editor/tiny/classes/plugin.php(80): tiny_equation\plugininfo::get_plugin_configuration_for_context(Object(core\context\system), Array, Array, NULL)
#15 /var/www/html/lib/editor/tiny/classes/manager.php(72): editor_tiny\plugin::get_plugin_info(Object(core\context\system), Array, Array, NULL)
#16 /var/www/html/lib/editor/tiny/classes/editor.php(58): editor_tiny\manager->get_plugin_configuration(Object(core\context\system), Array, Array)
#17 /var/www/html/lib/editor/tiny/classes/editor.php(149): editor_tiny\editor::set_default_configuration(Object(editor_tiny\manager))
#18 /var/www/html/lib/adminlib.php(2727): editor_tiny\editor->use_editor('id_s__testsetti...', Array)
#19 /var/www/html/lib/adminlib.php(9214): admin_setting_confightmleditor->output_html('defaultvalue')
#20 /var/www/html/lib/adminlib.php(9189): admin_output_new_settings_by_page(Object(admin_settingpage))
#21 /var/www/html/lib/adminlib.php(9189): admin_output_new_settings_by_page(Object(admin_category))
#22 /var/www/html/lib/adminlib.php(9189): admin_output_new_settings_by_page(Object(admin_category))
#23 /var/www/html/admin/upgradesettings.php(38): admin_output_new_settings_by_page(Object(admin_root))
#24 {main}
Hello @danielcifuentesopen,
Thank you for reporting this! We've moved this suggestion to the next step and will let you know once we start working on it and once it is released. Any further issues, please feel free to contact us again.
Hello @danielcifuentesopen,
With the latest Moodle and Wiris versions, this is no longer reproducible. Thanks for taking the time to report this and using MathType. If you need further assistance, please feel free to open a new issue or contact us at [email protected].