I have just experienced the effect of the default settings being used to reset my YaBB forum when a fault occurred as an administrator was saving some changes to the settings.
The purpose behind having these default settings is, I'm sure, to provide a graceful recovery from potential catastrophe.
The actual effect was to let all hell break loose.And I suspect that this is a problem waiting to happen on everybody's YaBB system, because of the way the defaults are written (ie. deeply embedded into the PHP code).
One problem (could call it a bug) is that the default settings do not reflect the defaults of the system that it is installed into. (They do not even reflect the defaults that are offered during the installation process.)
The solution I'm proposing might actually be simpler than what is currently done in Admin.php.
- Create a file called Settings_def.php that is used to house all the default settings. The layout of Settings_def.php can be identical to Settings.php.
- In Admin.php, when there is the need to reimpose the default settings, Settings_def.php can be copied as Settings.php. If it's also necessary to have those values for immediate use in Admin.php, an include_once('Settings_def.php') should do the trick.
- As the final step of the installation process, Settings.php would be copied to Settings_def.php to establish a useful set of defaults.
- It would also be useful to add a link to the admin page, saying "Update default settings with current settings", so that the administrator can bring the defaults up to date when they want.
I'd be very interested in comments from the YaBB creators. If you can't see any problems with this, I'll have a go at creating the mod myself. {gulp}
Cheers,
Paul.