-
Notifications
You must be signed in to change notification settings - Fork 265
[3.0] Add support for WAL in Sqlite3 caching #8880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.0] Add support for WAL in Sqlite3 caching #8880
Conversation
Everything is static in SMF\Config, so there are no object properties at all, and therefore no setter or getter methods. Instead, anything setting that isn't part of SMF's standard configuration settings exists in SMF\Config::$custom and should be read from there directly. For example, if Settings.php contains the following custom setting: ... then any mod that wants to read that custom setting can access it as No hooks are needed or expected.
Adding your setting as a named static property of the Config class would be the best approach, actually. The Config class is intended to provide all of SMF's standard settings as named static properties of the class, so adding your new setting as a property of Config makes perfectly good sense. First, you should add something like this in the Config::$settings_defs array: Then you can add this at the appropriate location in Config's list of static properties: The result will be that Now, in theory you could skip the second step and everything would still work, except that instead of |
That's a good idea in theory, but it would require a bunch of extra pain and complication because we would need to handle both the old and new ways of recording that information in Settings.php. Doing so would involve both correctly interpreting both formats when reading Settings.php in |
|
Another note to add to my recent commit. There is a way to better determine the sqlite file is in readonly mode. https://www.sqlite.org/fileformat.html#file_format_version_numbers
I could have read bytes 18/19 to see the file was in wol mode and that we had it off. This just seems simpler. |
PHP offers no way to determine that, so sniff for the file to guess. Additionally to fix issues with errors occurring, enabled exceptions for sqlite3 and used that to handle silently logging the error.
3428d68 to
469cbaa
Compare
Co-authored-by: Jon Stovell <[email protected]>
Fixes #7512
@Sesquipedalian, I ran into an issue here and worked around it, but I know it could be better.
The config class doesn't allow me to do "custom" variables well. It would be nice if I could specify a
Config::sqlite_walvariable. The set method does support$customattributes, but there is no support for the getter. It looks like its expected that mod authors would extend this with a hook.I didn't think it was necessary to update the Config class just to add a single boolean.
Another idea I had was to make a
Config::$cache_opts = [];data set, and we would store various cache options in there, including the memcache stuff, etc. Seemed like an idea that would ensure caching, which needs to know its settings before connecting to the database, has a way to be extensible.