Support

Admin Tools

#39659 Class admintools not found on joomla 5.0

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
PHP version
8.2
Admin Tools version
7.4.3

Latest post by activha on Monday, 30 October 2023 04:42 CDT

activha

Hi

Seems like a bug on admintools plugin when it's activated :

Une erreur s'est produite
0 Class "Akeeba\Plugin\System\AdminTools\Extension\AdminTools" not found 
Call Stack #FunctionLocation 1  ()  JROOT/plugins/system/admintools/services/provider.php:40  2  Joomla\DI\ServiceProviderInterface@anonymous/var/www/vhosts/cercle.business/devel.cercle.business/plugins/system/admintools/services/provider.php:20$0->{closure}()  JROOT/libraries/vendor/joomla/di/src/ContainerResource.php:172  3  Joomla\DI\ContainerResource->getInstance()  JROOT/libraries/vendor/joomla/di/src/Container.php:95  4  Joomla\DI\Container->get()  JROOT/libraries/src/Extension/ExtensionManagerTrait.php:177  5  Joomla\CMS\Application\CMSApplication->loadExtension()  JROOT/libraries/src/Extension/ExtensionManagerTrait.php:99  6  Joomla\CMS\Application\CMSApplication->bootPlugin()  JROOT/libraries/src/Plugin/PluginHelper.php:232  7  Joomla\CMS\Plugin\PluginHelper::import()  JROOT/libraries/src/Plugin/PluginHelper.php:192  8  Joomla\CMS\Plugin\PluginHelper::importPlugin()  JROOT/libraries/src/Application/CMSApplication.php:765  9  Joomla\CMS\Application\CMSApplication->initialiseApp()  JROOT/libraries/src/Application/AdministratorApplication.php:321  10  Joomla\CMS\Application\AdministratorApplication->initialiseApp()  JROOT/libraries/src/Application/AdministratorApplication.php:174  11  Joomla\CMS\Application\AdministratorApplication->doExecute()  JROOT/libraries/src/Application/CMSApplication.php:306  12  Joomla\CMS\Application\CMSApplication->execute()  JROOT/administrator/includes/app.php:58  13  require_once()

Dont know where to dig...

Any idea ?

Regards

Jean

 

tampe125
Akeeba Staff

Hello,

most likely during the upgrade Joomla didn't delete the autoloader file, where all the classes are declared. Please manually delete the file autoload_psr4.php in the folder administrator/cache .

Joomla will recreate it and that should fix your issue.

Davide Tampellini

Developer and Support Staff

🇮🇹Italian: native 🇬🇧English: good • 🕐 My time zone is Europe / Rome (UTC +1)
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

activha

Something must miss somewhere ;-)

I deleted the file but the new generated one still miss the correct path Akeeba\Plugin\System\AdminTools\Extension\AdminTools

I have all others :

'Akeeba\\Component\\AdminTools\\Administrator\\' => [JPATH_ADMINISTRATOR . '/components/com_admintools/src'],
'Akeeba\\Component\\AdminTools\\Site\\' => [JPATH_SITE . '/components/com_admintools/src'],
'Akeeba\\Component\\AkeebaBackup\\Administrator\\' => [JPATH_ADMINISTRATOR . '/components/com_akeebabackup/src'],
'Akeeba\\Component\\AkeebaBackup\\Api\\' => [JPATH_API . '/components/com_akeebabackup/src'],
'Akeeba\\Component\\AkeebaBackup\\Site\\' => [JPATH_SITE . '/components/com_akeebabackup/src'],
'Akeeba\\Plugin\\ActionLog\\AkeebaBackup\\' => [JPATH_PLUGINS . '/actionlog/akeebabackup/src'],
'Akeeba\\Plugin\\Actionlog\\AdminTools\\' => [JPATH_PLUGINS . '/actionlog/admintools/src'],
'Akeeba\\Plugin\\Console\\AdminTools\\' => [JPATH_PLUGINS . '/console/admintools/src'],
'Akeeba\\Plugin\\Console\\AkeebaBackup\\' => [JPATH_PLUGINS . '/console/akeebabackup/src'],
'Akeeba\\Plugin\\QuickIcon\\AkeebaBackup\\' => [JPATH_PLUGINS . '/quickicon/akeebabackup/src'],
'Akeeba\\Plugin\\System\\BackupOnUpdate\\' => [JPATH_PLUGINS . '/system/backuponupdate/src'],
'Akeeba\\Plugin\\Task\\AdminTools\\' => [JPATH_PLUGINS . '/task/admintools/src'],
'Akeeba\\Plugin\\Task\\AkeebaBackup\\' => [JPATH_PLUGINS . '/task/akeebabackup/src'],
'Akeeba\\Plugin\\WebServices\\AkeebaBackup\\' => [JPATH_PLUGINS . '/webservices/akeebabackup/src'],

nicholas
Akeeba Staff
Manager

It looks like Joomla! screwed something up. It's either managed to lose the XML manifest file of our plugin, or the database record for this plugin has gotten stuck.

Delete the plugins/system/admintools folder.

Delete the administrator/cache/autoload_psr4.php file.

Log into your site's backend.

Install the latest version of Admin Tools twice in a row, without uninstalling it before or in between.

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!

activha

Yep fixed on the dev website.

Maybe worth to have a deeper look if it happens on others also ?

Thanks a lot

nicholas
Akeeba Staff
Manager

I have seen that before and I know exactly what it is. This is nothing related to our software, or anything we can do about. It's the result of a Joomla! bug I have been reporting since 2014.

Just to give you some context, using namespace for Joomla! 4 components was my idea, taken from my work with FOF 3, and written in the original handwritten Joomla! 4 roadmap with my own handwriting. I am the one person who knows best how this entire thing was intended to work, and how it's actually working (since I didn't do the implementation myself).

For the autoloader_psr4.php file to be updated the extension's XML file needs to have a <namespace> tag. Our extensions already do. 

This tag tells Joomla! two things: the namespace, and the relative path of the folder in the extension's folder that holds the namespaced files following the PSR-4 standard. We already do that, as you can see in plugins/system/admintools/admintools.xml:

<namespace path="src">Akeeba\Plugin\System\AdminTools</namespace>

When the autoload_psr4.php file is missing from the cache folder defined with the constant JPATH_CACHE in Joomla's defines.php file (therefore: administrator/cache/autoload_psr4.php for most Joomla! installations) Joomla's libraries/namespacemap.php file kicks in and regenerates it using its create() method. As you can see, this is a very simple method which looks for the XML manifest files of each extension discovered by going through the folder structure.

This file has no reason to be removed, and it's put back if it's missing when (re)installing or updating the extension.

This is where things get a bit salty.

I have found out that in a very small number of sites Joomla! fails to copy all files of the installed extension when you update an extension. I have been reporting this issue to the Joomla! project since 2014. Last time I did that was back in March, and they told me that I am a flat out liar, a bad developer, and I should not be allowed to file bug reports which was… rather bloody insane, considering that a good third of Joomla! itself is written by yours truly. But I digress. The bug has also been reproduced by David Jardin, the JSST team leader, in February 2021 with an extension that has absolutely nothing to do with us. So, joke's on them. I have been telling them for over 9 years and the bug still exists 🤷🏽‍♂️

The thing is, if that bug happens it ends up removing the XML manifest file (admintools.xml) without replacing it when you update the extension. As a result, Joomla cannot update the autoload_psr4.php file correctly anymore. You will not notice it until you update another extension, or Joomla! itself, in which case Joomla! tries to regenerate this file. That's why this issue only happened to you upon updating to Joomla! 5.

Installing the package twice in a row, for a reason I don't fully understand, seems to always work around this Joomla! bug.

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!

activha

Thanks a lot for this explanation.

I am glad you developed it and understand it.

Don't know if I can be of some help but if you want me to file a bug report or testify for you about this I would be ready to.

For now your solution solved our issues and I can confirm that this bug occurred both on the production website AND on the development website.

Best regards

Jean

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!