-
Notifications
You must be signed in to change notification settings - Fork 53
Studio: Sites with old SQLite database integration are not updated # #966
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
Conversation
| const sqlitePath = path.join( sitePath, 'wp-content', 'mu-plugins', SQLITE_FILENAME ); | ||
| const hasWpConfig = await fs.pathExists( path.join( sitePath, 'wp-config.php' ) ); | ||
| const sqliteInstalled = await isSqlLiteInstalled( sqlitePath ); | ||
| const sqliteOutdated = sqliteInstalled && ( await isSqliteInstallationOutdated( sqlitePath ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This current logic is problematic because is checks if the sqlite is installed at export const SQLITE_FILENAME = 'sqlite-database-integration' file path. When it does not find it (which it won't because the directory has main at the end), it evaluates to false so the update fails on the condition sqliteOutdated below: if ( ( ! sqliteInstalled && ! hasWpConfig ) || sqliteOutdated ). By removing the check, we are only checking if SqLite is outdated resulting in true and the installation of the update gets executed correctly.
|
FYI, I will fix the unit test later if we agree on the approach! |
bcotrim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think removing the sqliteInstalled check from the sqliteOutdated calculation might make the hasWpConfig protection ineffective. Since isSqliteInstallationOutdated() returns true when no version is found (i.e., when SQLite isn't installed), wouldn't this cause SQLite to be installed on MySQL sites (with wp-config.php) when it shouldn't?
I might be missing something, what do you think?
|
Thanks for the feedback @bcotrim - I thought this might be a problem so I have another possible solution and that is to keep the check for Let me know what you think about this approach 🙇 |
…-sites-not-updated
bcotrim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification and adjustments!
I tested the changes and they work as expected.
The code looks good, and I think this more conservative approach is better.
LGTM 👍
…-sites-not-updated
|
@katinthehatsite it's great that we have a simple solution than the initial one. It fixed the issue for my older sites, and now, all of them have the plugin in the correct location, and all can be exported. |
Related issues
Closes https://github.com/Automattic/dotcom-forge/issues/8638
Related to https://github.com/Automattic/dotcom-forge/issues/10305
Proposed Changes
This PR ensures that if an older site has
wp-content/mu-plugins/sqlite-database-integration-maininstalled on a site, the plugin will be updated towp-content/mu-plugins/sqlite-database-integrationon app restart.Testing Instructions
Firstly, you would need to prepare a site to reproduce the issue:
mu-plugins/sqlite-database-integrationtomu-plugins/sqlite-database-integration-maindb.php:mu-pluginsfoldermu-plugins/sqlite-database-integration-maintomu-plugins/sqlite-database-integrationrsmu-pluginsfoldermu-plugins/sqlite-database-integrationandmainwas removed at the endPre-merge Checklist