-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[4.1] Fix the upgrade path #36585
[4.1] Fix the upgrade path #36585
Conversation
@dgrammatiko There is no need to remove the statement from the update SQL script. It does not do any harm as long as it does not have any syntax errors (which it doesn't). Your proposed solution here is the fallback case that the SQL statement for some reason (SQL error in some other statement running in some other script before that one) has not been run. In such a case the backend is not usable, that's why we need the fallback. |
P.S.: So I suggest you revert the changes on the 2 update SQL scripts and adust the PR description accordingly. |
Done |
P.P.S.: Thanks for following my suggestion. I see my comment was not 100% right because the new fix runs before the update SQL scripts, so it is not really a fallback, but we should not change the old scripts if not necessary so the suggestion is still ok. But now I ask myself what happens when we update from 3.10 to 4.1. In this case with one of the early 4.0 update SQL scripts the atum and cassiopeia templates are added. Your new patch will run before that so it has nothing to update. So we again rely on the 4.1 update SQL to do that. I think you should move the call to your new function to after the SQL updates so it is really a fallback like I first thought before I have noticed the call order. |
If the SQL updates have some fatal error will the function run then? That was my point running it before the SQL part... |
Up to now I think it will be the case, and if in future some proper error handling will be added we have to make sure it is run also when the SQL updates have failed (i.e. are incomplete). |
I have tested this item ✅ successfully on 3bf7f17 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36585. |
@bembelimen consider this one as a release blocker |
{ | ||
$db = Factory::getDbo(); | ||
|
||
array_map( |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
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.
functional programming? No real reason, it's a bit shorter
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
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.
Don't believe everything you find on the internet :)
FWIW browsers (JS) are optimizing for these functions and I would expect PHP would be doing that as well but for PHP I don't have any data...
Edit: actually this comment aligns with what I wrote ;)
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
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.
Functional programming is very popular in the JS space and the reason is because React, Vue, Svelte, etc basically made the UI a function of the state UI = Fn(state)
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
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 hate that I can't use the spread operator yet...
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
I have tested this item ✅ successfully on ca3738f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36585. |
Unfortunately the new procedure added by this PR will not be executed if the update SQL scripts fail, and it is no solution to move the call to it to before the update SQL scripts run because then the statement in the new procedure will have no effect. I think it needs the changes from PR #36506 and then see if we still need the fix from here and where we can hook it in so it is also called when the update SQL scripts fail. |
@richard67 since the other PR was already merged is this one needed anymore? |
I will create the 2 packages tomorrow |
I am just on it. Waiting for drone to build the one with the PR. |
@dgrammatiko I have created the update packages:
|
Nice, I've updated the description, now we need couple brave testers |
8 tests if one has both kinds of databases MySQL and PostgreSQL. For each db type 4 tests:
|
@dgrammatiko Please update your testing instructions to make clear it needs to update from 3.10.x or 4.0.x. Updating from 4.1 (e.g. a previous beta) will not be affected by the change in this PR. |
The update tests from 4.0 with both kinds of database I just have finished with success. Now I have a short break, and then I make the tests from 3.10. |
@dgrammatiko I've pimped the testing instructions a bit, I hope that's ok. |
I can test but not until tomorrow pm |
I have tested this item ✅ successfully on 73b97af
When updating from 3.10 there was an additional problem with and without this PR applied, which I will describe more detailed in my next comment. But that's not related to this PR and has to be fixed with another PR. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36585. |
@dgrammatiko When updating from 3.10 there is an additional issue not related to your PR. But maybe you should mention it or link to this comment in the testing instructions so people will not count it as failed test. After the files have been updated (but I think before the database update starts), you get a blank page, and the page title shows an error message (full message in a tool tip when hovered): Then just refresh the page, and the update continues and then ends as described in the testing instructions. The database checker will show errors because the old update SQL scripts with versions from 2.5. to 3.x have not been deleted. When testing the update from 4.0, the blank page does not happen. There will also old files not be deleted, but because there are no old update SQl files to be deleted, there will not be such database checker errros like after an update from 3.10. But all that happens with and without your PR and so has to be fixed elsewhere. |
In all my original tests I never saw that blank page error |
@brianteeman I could just reproduce that several times when updating a current 3.10-dev to 4.1, using a "normal" update package without any SQL error, e.g. the last nightly build https://developer.joomla.org/nightlies/Joomla_4.1.0-dev-Development-Update_Package.zip or the custom update URL https://update.joomla.org/core/nightlies/next_minor_list.xml for that nightly. |
@richard67 @brianteeman isn't that the bug where an instance of |
Yes, was my PR #36733 ... but it was not in table but in redirect, and here I do not have redirects enabled. |
Actually the problem is different, in 3.10 the driver is $db = isset($config['dbo']) ? $config['dbo'] : \JFactory::getDbo(); In 4.1 it's $db = $config['dbo'] ?? Factory::getDbo(); In short, the alias is not yet established... BTW this raises some questions... |
Please post that also in the new issue #36833 . Thanks in advance. |
I have partially tested it with success as I had a branch from 4.0.6 with Didn't test the installer script. |
I have tested this item ✅ successfully on f77dfc4 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36585. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36585. |
Thx |
I guess I dont need to test this then |
Pull Request for Issue # .
Summary of Changes
script.php
that will run independently of the batch work of the db updates. The reason is that this particular db fix is essential so that the UI will not become broken if for any reason the update files fail somehowTesting Instructions
Using https://test5.richard-fath.de/Joomla_4.1.0-dev-Development-Update_Package_test-with-sql-error.zip try to
(these SHOULD FAIL leaving you with unstyled front/backend templates)
Using https://test5.richard-fath.de/Joomla_4.1.0-dev+pr.36585-Development-Update_Package_test-with-sql-error.zip try to
(these should show an SQL error at the end, but the backend is usable and the db fixer can be used)
Actual result BEFORE applying this Pull Request
When the database update fails before the update for child templates would have run, the UI is unusable.
Expected result AFTER applying this Pull Request
The UI is usable. An SQL error is shown, but the backend works, and the database fixer can be used.
Documentation Changes Required
@brianteeman @joeforjoomla could you test this one?
@richard67 I hope I didn't messed up here