I didn't see an option for Akeeba Panopticon, but I'm unable to add sites that are using JoomDonation for some reason. How can I fix this? Thanks.
Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Latest post by nicholas on Monday, 27 May 2024 01:03 CDT
I didn't see an option for Akeeba Panopticon, but I'm unable to add sites that are using JoomDonation for some reason. How can I fix this? Thanks.
I have seen other extensions by that developer having badly written plugins which break Joomla's API application.
If you could attach the extension's ZIP installation file in your next reply I could check. It's okay that this is a public ticket; attachments are always private, even in public tickets, meaning that only you and me will be able to download them.
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!
Thank You Nicholas, attached.
The attachment failed. I made this ticket private. Please upload the extension's ZIP file to Dropbox, OneDrive, or Google Drive and paste me a share link 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!
Here's a direct link: https://www.dropbox.com/scl/fi/1evzyi1y1hjwgbfy7iu0y/com_jdonation_5.10.4.zip?rlkey=y4mensf8dlyyr2ga9tb4g8xi4&dl=0
The problem is caused by the System - Joom Donation
plugin. When it is enabled, any access to the Joomla! API application (api/index.php
on your site) results in the error Class "DonationHelper" not found
.
This comes from plugins/system/jdonation/jdonation.php
line 56 which tries to load administrator/components/com_jdonation/loader.php
. In that file they use JLoader::registerPrefix
to register Donation
as a class prefix. However, they have made an important mistake on that line. They are using JPATH_ROOT
instead of JPATH_SITE
. This mistake is repeated further down that file.
There is a subtle difference between JPATH_ROOT and JPATH_SITE:
JPATH_ROOT
is the absolute path to the root of the current application. In the frontend and backend applications it's the root path to the site, e.g. /var/www/mysite
. In the API application it's the absolute path to the api
folder e.g. /var/www/mysite/api
.JPATH_SITE
on the contrary is always the absolute path to the site's root, e.g. /var/www/mysite
. That's what they wanted to use.I can see why they are confused. The difference between JPATH_SITE
and JPATH_ROOT
was never documented in Joomla. If you haven't tracked its development very closely you'd never know about it.
For what it's worth, JPATH_ROOT
being identical to JPATH_SITE
in the administrator application has always been wrong and the core maintainers knew it. However, this mistake was made early in the Joomla! 1.5 development and by the time Joomla! 1.6 was underway there was a lot of code written which would've broken if the mistake was fixed. Therefore, the wrong definition for JPATH_ROOT was left in the code. When Joomla! 4 added two more applications, api
and cli
, the new applications did not carry the mistake forward. Instead, the JPATH_ROOT
is now correctly set to the absolute path pointing to the root of each of these new Joomla! applications. Yeah, quite the mess.
If you edit the file administrator/components/com_jdonation/loader.php
and replace JPATH_ROOT
with JPATH_SITE
everything works. This change is backwards compatible all the way to Joomla! 3.0 released back in 2012.
Please copy this entire message to a ticket to the JoomDonation people so they can fix their code.
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!
Ah, on a similar note, there is another way to deal with that in plugins/system/jdonation/jdonation.php
itself.
In the __construct
method, right before calling parent::__construct
they can add the following code:
if (!\Joomla\CMS\Factory::getApplication()->isClient('administrator') && !\Joomla\CMS\Factory::getApplication()->isClient('site')) return;
I have explained the reasoning in detail in my blog post https://www.dionysopoulos.me/common-mistakes-writing-joomla-plugins.html under the heading "There is more to Joomla than the frontend and backend".
Please add that note to your ticket to the JoomDonation people.
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!
Looks like he's not gonna fix it:
In this case, i am afraid that we can't make the change, but you can make the change in that file in your Joom Donation to replace JPATH_ROOT by JPATH_BASE system and backup it for future installation.
Thanks
Dam
So, let me see if I get this straight.
The author of JoomDonation EXPLICITLY STATED that despite being notified about the exact way his plugin breaks the Joomla! API application and the Joomla! CLI application, and the one line he needs to add, he has decided to NOT fix his code? In other words, he explicitly stated that even though he knows his plugin breaks Joomla! he will not fix it?
Good. I'll report him to the Joomla! Extensions Directory. If he wants to be the asshole breaking sites he has no right to get traffic from the JED.
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!
LOL, I'm shaking my head. I don't get it either. Thank you for all you do!
I reported the extension. Let's see what happens :)
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!
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!