-
Notifications
You must be signed in to change notification settings - Fork 71
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
Wordpress Sqlite implementation #126
base: master
Are you sure you want to change the base?
Conversation
…ram CS (not needed, could also get installed manually), add default database path to gitignore, if you want to use MySQL just set UseMySQL in appsettings to true, in that case any SQLite implementation is getting ignored
this is awesome! I see the main change is in |
Basically this works already since Version 4.X, I did use it since years in the php version (always more or less the same file, just some changes after the php 8.X update) - I don't see any specific reason why it should break in newer Wordpress Versions as long as they dont change the main wp-db.php logic (what is IMHO unlikely) So I'm pretty sure we're able to use this file without modifications for some years ;-) Just as Info for anyone who want to embed this in e.g. a desktop application and/or standalone app with only some users: I add in app.csproj -> PropertyGroup: This will reduce the memory usage from 2-3GB to something like 300MB (with a higher CPU usage because of the GC, but for a desktop app/low load usages this should be fine and CPU for Memory could be a good tradeoff) Besides of that: The SQLite implementation is pretty fast, even with the overhead from the db.php wrapper, but It's clear that in a high load scenario MySQL is still the better choice and it's possible that some plugins/themes are not working (if the author did e.g. wrote in some direct mysql queries that bypass the wordpress db implementation - On the other hand, if thats the case it's bad practice and possibly the plugin should get avoided anyway^^) I currently run this version locally with Elementor, WooCommerce and OceanWP as theme (and some additional oceanwp plugins). Seems to work fine with SQLite :-) |
sounds good! also good tip with the So we have to find a way of keeping this change when updating Also, I'd like to make the Sqlite option disabled by default. So by default, it should behave like typical WordPress. Will be thinking about it. |
Absolutely - MySQL should be the default option as it is in the official version - I just set it as default in my branch to give a quickstart :-) SQLite should also be only in appsettings.json as default, all models should use MySQL as default (UseMySQL and USE_MYSQL) In Terms of the db.php file - If you just download the files there should not be any conflict, the db.php file itself dont exists in the official version, so you should still be able to download the files as usual and overwrite existing content (and preserve db.php as it is). From what I currently see this is a manual step (at least I could not find any pull script in the pipeline/actions) - If there is any CI that do this we could copy over db.php to a temp folder, delete wordpress folder, pull official files and move it back to wp-content folder after the extraction is successfully completed :-) |
… set MySQL as default in appsettings
Thanks, @LORDofDOOM - we'll be merging the PR soon for the next major update! |
@jakubmisek Great :-) Thank you - I'll just played a little bit with different configurations between MySQL and SQLite and did fix the install routine (was not working if the system was start as SQLite - Than toggle to MySQL without existing database) - Should now work - I'll also add a little information on the dashboard widget on what database wordpress is currently running - Was myself sometimes confused after that many switches between them^^ :-D |
@LORDofDOOM thank you for the updates! |
This PR will integrate SQLite support into Wordpress, as you see it's a little hacky but it works great for my current project.
SQLite is IMHO a pretty useful addition specifically for PeachPied Wordpress and will enable the option to e.g. embed Wordpress into a existing project without any need to deploy a additional mysql server (great for Blazor or headless wordpress)
The complete implementation could get skipped with "UseMySQL": true in appsettings.json - This will skip the db.php wrapper and work as usual with MySQL
BTW: Thank you for this great project