2020-10-03, 08:17 PM
Reporting this as a bug per frostschutz's suggestion in my original thread by the same name in the Plugin Development forum. This is an only slightly edited version of that post to remove parts irrelevant to the bug report:
For a while now I've noticed that often after upgrading MyBB to the latest version, some of my plugins lose their styling.
After digging around in the code, I think I've identified why, although I haven't done any testing to confirm this.
It looks as though Master stylesheets are unconditionally deleted on line 222 of admin/inc/functions_themes.php, in the function
...as called on line 487 of install/upgrade.php, in the function
By "unconditionally" deleted I mean that all Master stylesheets, including those of plugins and not just those of core, are deleted. If the admin hasn't modified any of these stylesheets for any theme such that inheritance is overridden and the theme has its own copy, then the stylesheet is lost.
Is this even intended behaviour, or is it a bug, and if it is a bug, then could the fix be to add a method of marking stylesheets as either belonging to core or a plugin, and for
For a while now I've noticed that often after upgrading MyBB to the latest version, some of my plugins lose their styling.
After digging around in the code, I think I've identified why, although I haven't done any testing to confirm this.
It looks as though Master stylesheets are unconditionally deleted on line 222 of admin/inc/functions_themes.php, in the function
import_theme_xml()
:$db->delete_query("themestylesheets", "tid='{$options['tid']}'");
...as called on line 487 of install/upgrade.php, in the function
upgradethemes()
:import_theme_xml($contents, array("tid" => 1, "no_templates" => 1, "version_compat" => 1));
By "unconditionally" deleted I mean that all Master stylesheets, including those of plugins and not just those of core, are deleted. If the admin hasn't modified any of these stylesheets for any theme such that inheritance is overridden and the theme has its own copy, then the stylesheet is lost.
Is this even intended behaviour, or is it a bug, and if it is a bug, then could the fix be to add a method of marking stylesheets as either belonging to core or a plugin, and for
import_theme_xml()
to only conditionally delete core stylesheets, and leave plugin stylesheets alone?