? bug PR-4.3-dev Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
24 Apr 2023

Pull Request for Issue #40444 only the db schema part

Summary of Changes

alternative for #40461
added the same check as in index.php?option=com_installer&view=database

Testing Instructions

see #40444

Actual result BEFORE applying this Pull Request

Checks N/A

Expected result AFTER applying this Pull Request

Schema is checked and Update is not able to proceed if there is a database structure issue

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomla-cms-bot joomla-cms-bot - change - 24 Apr 2023
Category Libraries
avatar alikon alikon - open - 24 Apr 2023
avatar alikon alikon - change - 24 Apr 2023
Status New Pending
avatar richard67
richard67 - comment - 24 Apr 2023

@alikon To me it seems that you are checking the database not only for the core but also for 3rd party extensions because you are using the complete changeset here: https://github.com/joomla/joomla-cms/pull/40468/files#diff-a88763fd45c8c476369964c9857883558ccbe56672b2304d651f9a583225cc20R418

But for the pre-update check only the core shall be checked. Therefore it filters for the extension if of the core (joomla files) and then uses only the first element of the changesets araay here:

// Ensure we only get information for core
$model->setState('filter.extension_id', $coreExtensionInfo->extension_id);
// We're filtering by a single extension which must always exist - so can safely access this through
// element 0 of the array
$changeInformation = $model->getItems()[0];

You have to do it in the same way.

avatar richard67
richard67 - comment - 24 Apr 2023

@alikon P.S.: You can easily check that by installing a 3rd party extension which has update SQL scripts and then modify one of these scripts so it causes an error for that extension in the database checker. Your code here will report this as a schema error and block the update, the pre-update checker in the update component will not do that (as long as the schema check for the CMS core is ok).

avatar alikon alikon - change - 24 Apr 2023
Labels Added: PR-4.3-dev
890283e 24 Apr 2023 avatar alikon cs
avatar richard67 richard67 - test_item - 24 Apr 2023 - Tested successfully
avatar richard67
richard67 - comment - 24 Apr 2023

I have tested this item successfully on 922dcb3

I've successfully tested that this PR adds a check for database schema errors of the CMS to the cli updater which works the same way as the check for the database schema in the pre-update check of the Joomla Update component in the required settings part.

For testing I have added the following SQL to one of the core's update SQL scripts:

CREATE TABLE IF NOT EXISTS `#__foobar` (
  `id` int NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

And I have done the same but with a different table name with the update SQL script 4.0.0.sql of the patchtester.

Then I have patched the Version.php file so that an update was found, and then I have run the CLI core updater.

Result: The CLI updater reports the schema errors for the CMS but not for the Patchterster, and the update is refused.

Then I have fixed the database error for the core and run again the CLI updater.

Result: The update succeeded, the database schema errors of the Patchtester has been ignored like it should be.

I don't know if the way how the error messages are shown or some language strings need improvement. Maybe @brianteeman can have a look.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40468.
avatar alikon alikon - change - 17 Aug 2023
Labels Added: bug
avatar richard67 richard67 - alter_testresult - 22 Aug 2023 - richard67: Tested successfully
avatar ChrisHoefliger ChrisHoefliger - test_item - 26 Aug 2023 - Tested successfully
avatar ChrisHoefliger
ChrisHoefliger - comment - 26 Aug 2023

I have tested this item ✅ successfully on 9f07bb3

Tested on Joomla 4.3.4 @localhost PBF 2023


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40468.

avatar richard67
richard67 - comment - 26 Aug 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40468.

avatar richard67 richard67 - change - 26 Aug 2023
Status Pending Ready to Commit
avatar obuisard obuisard - change - 29 Aug 2023
Labels Added: ?
avatar obuisard obuisard - change - 29 Aug 2023
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-08-29 19:09:27
Closed_By obuisard
avatar obuisard obuisard - close - 29 Aug 2023
avatar obuisard obuisard - merge - 29 Aug 2023
avatar obuisard
obuisard - comment - 29 Aug 2023

Thanks Nicola @alikon for the PR

Add a Comment

Login with GitHub to post a comment