MyBB Community Forums

Full Version: Plugins' Master stylesheets deleted on core upgrade
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 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?
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/4265

Thanks for contributing to MyBB!

Regards,
The MyBB Group