SMF icon indicating copy to clipboard operation
SMF copied to clipboard

updateSettings cannot remove entries from smf_settings

Open Arantor opened this issue 12 years ago • 2 comments

I'm not sure whether this is technically a bug or a feature request. Either way: if a mod wants to be diligent and clean house, it cannot do so where settings are concerned without doing it manually.

updateSettings() does not have any ability to actually remove a setting. It can set things to empty if they would subsequently be empty but there's still a value in the database.

It already checks the new things being changed to see if they would increment or decrement a given value (set the new value to bool true or bool false respectively and updateSettings will do it for you) but there's no way to have updateSettings remove anything, e.g. if the value were explicitly set to null.

Arantor avatar May 30 '14 01:05 Arantor

Ideally, if the "remove database data" mark is checked, it should remove any associated rows in smf_settings, especially from an optimization standpoint. The smf_settings table is large enough to begin with, and since the settings will be re-installed if the modification is re-installed, I see no need to keep them around. I haven't looked at the code in some time, but I imagine it would be a simple fix to add this when the "remove database data" option is ticked upon uninstall.

jasonclemons avatar Jun 01 '14 00:06 jasonclemons

There's no way to log which setting(s) were added at install, so no way to remove them at uninstall time.

Some mods (SimpleDesk) were good enough to clean their own house on uninstall however but it's effort intensive and error prone to keep that maintained.

Arantor avatar Jun 01 '14 01:06 Arantor