Skip to content

[4.0] [RFC] Add update SQL script for admin modules parameters#33370

Closed
richard67 wants to merge 2 commits intojoomla:4.0-devfrom
richard67:4.0-dev-add-update-sql-for-backend-modules-bootstrap
Closed

[4.0] [RFC] Add update SQL script for admin modules parameters#33370
richard67 wants to merge 2 commits intojoomla:4.0-devfrom
richard67:4.0-dev-add-update-sql-for-backend-modules-bootstrap

Conversation

@richard67
Copy link
Copy Markdown
Member

@richard67 richard67 commented Apr 27, 2021

Pull Request for Issue #33314 .

Summary of Changes

This pull request (PR) adds an update SQL script (one for each db type) to fix the bootstrap size and header tag parameters of those admin modules touched by PR #33045 when updating from 4.0 Beta 7 or a previous 4.0 Beta.

In opposite to past cases when we had to manipulate JSON parameters with update SQL scripts, this script here uses JSON functions.

The reason for this is that

  1. it is safer if you make sure that you are running the JSON functions only on a valid JSON string, and
  2. in some case it was not only a value change to be made but a missing property to be added, and this would be at least complicated if not risky with a normal REPLACE for strings.

The requirement for point 1. is achieved by including the condition params LIKE '{%}' into the WHEREclause of the update statement before extracting the JSON values in subsequent conditions.

Beside this, the WHERE clause of the update statement is made as precise as necessary in order to update only the desired modules.

Request For Comments

Unfortunately this PR can't be merged right now as the minimum version requirements of Joomla 4 for databases are lower than what is needed to support JSON functions.

  • Minimum version requirement for MySQL is 5.6, but the JSON functions have been added with version 5.7.
  • Minimum version requirement for MariaDB is 10.1, but the JSON functions have been added with version 10.2.3.
  • PostgreSQL is no problem, there the JSON functions have been added with version 9.5 (or earlier), and J4 requires 11.0 or later.

=> Ping @wilsonge : One more reason to raise the version requirement for MySQL to 5.7 and for MariaDB to 10.2.3 in Joomla 4.

Testing Instructions

Requirements

This PR needs to be tested for all supported database types (MySQL, MariaDB and PostgreSQL). In case of MySQL or MariaDB, if you can use both the "MySQLi" and the "MySQL (PDO)" database driver, test with both.

All testers please report back which database and driver types you have tested so it can be properly recorded.

The PR cannot be tested with patchtester because it needs to test database updates. It has to be tested as described below with use of update packages or custom update URL's.

  1. Have an installation of Joomla 4.0 Beta 7 or earlier (but not before Beta 4) with clean admin control panel modules, i.e. you haven't modified them, or make a new installation of 4.0 Beta 7 if you don't have that.

  2. In Global Configuration, switch on "Debug System" and set "Error Reporting" to "Maximum" to be sure to get notice of any PHP or SQL errors.

  3. Update to the latest 4.0 nightly build.

  4. Check the admin control panel.

Result: See section "Actual result BEFORE applying this Pull Request" below. The modules look weird.

  1. Using a tool like e.g. phpMyAdmin or phpPgAdmin (depending on your database type), export the content of table #__modules (Replace #__ by your table prefix).

  2. Update to the update package built by Drone for this PR.

  3. Check again the admin control panel.

Result: See section "Expected result AFTER applying this Pull Request" below. The modules look as they should.

  1. Export again the content of table #__modules into a different file than the one used in step 5.

  2. Compare the file created in step 8 with the one created in step 5, and compare the differences you can see with the differences shown in PR [4.0] Admin modules bootstrap #33045 for the base.sql file for your database type..

Result:

  • The records of table #__modules which have been modified in file base.sql with PR [4.0] Admin modules bootstrap #33045 have also been modified when updating to the update package of this PR.
  • Other records of table #__modules have not been modified during the update.
  • The JSON changes done by the update are the same as shown for the base.sql file in PR [4.0] Admin modules bootstrap #33045 .
  • In addition, the JSON properties are alphabetically sorted and code-styled in the updated records.
    This can't be avoided when using JSON functions for the update.
    But only the bootstrap_size and the header_tag properties have been changed or have been added where missing in the same way as in the base.sql file in PR [4.0] Admin modules bootstrap #33045 for new installations.
    All other properties remain unchanged.

Actual result BEFORE applying this Pull Request

See issue #33314.

After updating a Joomla 4.0 Beta 7 (or previous 4.0 Beta) to latest nightly build:

grafik

Expected result AFTER applying this Pull Request

After updating a Joomla 4.0 Beta 7 (or previous 4.0 Beta) to the update package built by drone for this PR, the admin dashboard looks the same as after a new installation of current 4.0-dev or latest nightly without this PR applied.

2021-04-27_2

Documentation Changes Required

None.

@richard67 richard67 changed the title [4.0] [WiP] Add update SQL script for admin modules parameters [4.0] Add update SQL script for admin modules parameters Apr 27, 2021
@richard67 richard67 changed the title [4.0] Add update SQL script for admin modules parameters [4.0] [WiP] Add update SQL script for admin modules parameters Apr 27, 2021
@richard67 richard67 changed the title [4.0] [WiP] Add update SQL script for admin modules parameters [4.0] Add update SQL script for admin modules parameters Apr 27, 2021
@richard67 richard67 marked this pull request as ready for review April 27, 2021 14:39
@richard67 richard67 changed the title [4.0] Add update SQL script for admin modules parameters [4.0] [RFC] Add update SQL script for admin modules parameters Apr 27, 2021
@joomla-cms-bot joomla-cms-bot added the RFC Request for Comment label Apr 27, 2021
@richard67 richard67 marked this pull request as draft April 27, 2021 14:55
@richard67
Copy link
Copy Markdown
Member Author

Closing in favour of #33375 .

@richard67 richard67 closed this Apr 27, 2021
@richard67 richard67 deleted the 4.0-dev-add-update-sql-for-backend-modules-bootstrap branch May 25, 2021 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFC Request for Comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants