by bretthopper · 3y ago · 0 comments
Since WordPress doesn't have a database abstraction, SQLite integration is done by transforming the SQL query strings meant for MySQL. This not only means doing regexp matches with string replacement, but trying to emulate MySQL functions with either SQLite equivalents, or in the worst case, in PHP application code.
it’s one file — ‘db.php’ — you swap in for the core file. From there, it’s mostly been seamless. ~20% of the 5k LOC, is “Method to emulate MySQL XXX() function.”
Less than that for query parsing, regex & rewrites
https://github.com/aaemnnosttv/wp-sqlite-db/blob/master/src/...
How hard would it be to "add one"/refactor?
Behold: https://github.com/WordPress/WordPress/blob/master/wp-includ...
From a technical POV: This is potentially straightforward if WordPress leverages (and "blesses", for plug-in developers) a proven abstraction layer like Doctrine DBAL that supports both MySQL and SQLite.
From a non-technical POV: There are tens of thousands of WordPress plug-ins, and even updating the top 1,000 that are good/popular will be a multi-year lift.
MediaWiki technically supports PostgreSQL and SQLite for many years, but extensions are really MySQL focused making it the only real choice.
To add one? Trivial.
To refactor all of WP core to use it? I could probably do it in a week or two of focused work.
To enable all plugins and wordpress themes to use it? It is, literally, probably a million times more LOC.