Support

Admin Tools

#40008 Database Error After Admin Tools Pro Update To 7.4.5

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
5.0.1
PHP version
8.1.26
Admin Tools version
7.4.5

Latest post by nicholas on Tuesday, 26 December 2023 02:24 CST

enclavecoa

Tonight, I updated Admin Tools Pro from 7.4.4 to 7.4.5 and I noticed that I'm getting a Db error on Admin Tools. I didn't have this error when I was on 7.4.4. Can you tell me what I need to do to resolve this error? Here is a link to a screencast of the Db error: https://www.awesomescreenshot.com/video/23400874?key=0a1674e39760e5a546fd42550e92bf4d .

nicholas
Akeeba Staff
Manager

There is no need to worry. This is a cosmetic Joomla! issue.

This is Joomla failing to understand what our update SQL code does, thereby WRONGLY inferring that the database is not updated. As far as I know, this is a known issue with ENUM fields and we've certainly seen it before (in Akeeba Ticket System, a few months ago). It's not causing any problem other than it being annoying, and us having to tell people that yeah, this is Joomla dropping the ball, nothing to see here.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

enclavecoa

Nicholas:

Tonight, I installed Admin Tools Pro 7.4.6 on my Joomla 5.0.1 site. It appears that the work around you stated in your release notes did not totally solve the Db issue. I'm providing a link to a new screencast that shows the issue. Link to screencast: https://www.awesomescreenshot.com/video/23465092?key=0d5c0bdf5294d069df52ce7fb3dacae5

nicholas
Akeeba Staff
Manager

All we can do is delete the administrator/components/com_admintools/sql/updates/mysql/7.1.1-20220209.sql file. This removes the problem. This is tried, tested, and then tested again manually removing the file.

This is what we did in 7.4.6. The file was removed from the package and we are trying to delete it if it still exists within our post-installation code (administrator/components/com_admintools/src/Model/UpgradeModel.php).

There are, of course, two fine points.

1. Did Joomla! delete the file? Please check that for me. On my test and live sites, it does. Depending on server configuration and file and directory permissions it might not happen.

2. The finicky, utterly wrong way Joomla is going about this is to check the whole field definition returned by the MySQL database server against the exact content of the SQL file, including lower/uppercase and spaces. Have I mentioned that MySQL may return the definition of the database table column in a slightly different way when it comes to the use of spaces and lower/uppercase letters for SQL keywords? Yeah. So, no matter how exactly we write the update SQL, Joomla! will complain for some people.

Of course, if you have read so far you will have noticed that there are two trivial fixes to be made in Joomla:

1. If the same database table column is referenced in two or more SQL update files, Joomla! should only ever keep the latest one. It already determines which is the latest SQL update file using version_compare() on the filenames to write this information in the #__schemas table. Why does it not do the same when detecting "problems"? Obvious bug and obvious fix.

2. Since the database server will return the structure of the column with varying character case and spaces, it stands to reason that Joomla! could squash spaces and convert everything to lowercase before doing the comparison between what the database server returns and what's in the file, therefore sidestepping all those issues. It's literally adding this: preg_replace('#\s+#i', '', strtolower(...)). This is also obvious to anyone who's worked with databases for more than a couple of days.

I reckon a half-competent developer could implement those fixes within half an hour. This stuff is broken for about a decade. Nobody found half an hour in this decade, do they not understand how their software works, or do they just not care? I am wondering.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

enclavecoa

1. Did Joomla! delete the file? Please check that for me. On my test and live sites, it does. Depending on server configuration and file and directory permissions it might not happen.

No, I don't believe that Joomla deleted the file you intended. I'm attaching 2 screenshots to this end.

nicholas
Akeeba Staff
Manager

Please delete that file. Then go to System, Maintenance, Database. There is still a warning. Select Admin Tools, click on the button to update the database, and now it should show no warnings. Can you please confirm that for me?

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

enclavecoa

Hi Nicholas:

The deletion of the SQL file you requested has solved the problem. I created a screen cast of the steps that I took to resolve it which can be viewed at: https://www.awesomescreenshot.com/video/23518854?key=6035a732a8940681929cdf2db28f30ae Thanks again for your help.

P.S. This may be something that other users may need to perform as well.

nicholas
Akeeba Staff
Manager

Thank you for the feedback! I will try to see why this file is not deleted. Joomla! should, supposedly, delete it by itself. Stupid me, trusting Joomla to do something right during an extension update…

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!