Support

Admin Tools

#11988 Override MySQLI causes exception with AdminTools in the call stack

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
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Saturday, 14 April 2012 13:55 CDT

agnamr
Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? scanned
Have I searched the tickets before posting? Yes
Have I read the documentation before posting (which pages?)? No
Joomla! version: 2.5.4
PHP version: 5.3.8
MySQL version: (unknown)
Host: pair.com
Admin Tools version: 2.2.5
Description of my issue:
We are trying to override the MySqli class to use MySql prepared statements for certain db queries. We added a php file, defining a class which overrides mysqli, to the libraries/joomla/database/database directory, and added our new class type (mysqlix) to the configuration file. The override mechanism works correctly for a regular Joomla 2.5.4 site, but when I have AdminTools installed, I get the following error:
Fatal error: Uncaught exception 'Exception' with message 'FrameworkOnFramework does not support the mysqlix database driver yet' in (webroot)/libraries/fof/query.abstract.php:137 Stack trace:
#0 (webroot)/administrator/components/com_admintools/models/storage.php(46): FOFQueryAbstract::getNew(Object(JDatabaseMySQLix))
#1 (webroot)/administrator/components/com_admintools/models/storage.php(29): AdmintoolsModelStorage->load()
#2 (webroot)/plugins/system/admintools/admintools/core.php(78): AdmintoolsModelStorage->getValue('combinecache', NULL)
#3 (webroot)/website_a1/plugins/system/admintools/admintools/main.php(48): plgSystemAdmintoolsCore->__construct(Object(JDispatcher), Array)
#4 (webroot)/libraries/joomla/plugin/helper.php(194): plgSystemAdmi in (webroot)/libraries/fof/query.abstract.php on line 137

The exception is thrown here in query.abstract.php
// -- Some sites use a mysqlcached or some other funky mysql driver
$type = strtolower($db->name);
if(strpos($type, 'mysql') && !in_array($type, array('mysql','mysqli'))) $type = 'mysql';

if(!array_key_exists($type, $classNames)) {
$cname = 'FOFQuery'.ucfirst($type);
if(!class_exists($cname, true)) {
throw new Exception("FrameworkOnFramework does not support the $type database driver yet");
}
$classNames[$type] = $cname;
}
I wondered if you had any insight on why the new database class might not be accessible when AdminTools is in the loop? I haven't found anything in the configuration that would indicate an issue. Disabling AdminTools and removing the custom .htaccess file did not remove the problem, and as I said, the only solution was to uninstall AdminTools.

Any suggestions appreciated.

Thanks

Mary Rogan

nicholas
Akeeba Staff
Manager
You are using a non-standard database driver called "mysqlix" (note the "x" at the end). This is not one of the database drivers provided by Joomla!, it is your custom driver. Our framework currently doesn't support arbitrary database driver names. This will be addressed in a future version of our software.

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!

nicholas
Akeeba Staff
Manager
Hm, maybe the fix is very simple. Please open that file and change line 132 from
if(strpos($type, 'mysql') && !in_array($type, array('mysql','mysqli'))) $type = 'mysql';
to
if(strpos($type, 'mysql') !== false && !in_array($type, array('mysql','mysqli'))) $type = 'mysql';

I think that should successfully map your custom mysqlix driver to the mysql query builder in our framework and allow Admin Tools to work with it.

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!

agnamr
Thanks! works like a charm.
Mary Rogan

nicholas
Akeeba Staff
Manager
Thank you for the feedback! I will include that fix in the next release of our software.

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!