-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(dev/joomla#14) Joomla 4.0 compatibility fixes #52
(dev/joomla#14) Joomla 4.0 compatibility fixes #52
Conversation
Thanks so much for this, @andrewpthompson . @monishdeb please put this on your list for review/QA next week. |
10e9c32
to
684f135
Compare
684f135
to
cb86c66
Compare
Please disregard the accidental closing/deletion above! Ready for review when anybody is able to. |
From a code-review perspective, the changes look good.
edit: I had clicked on an email link and had not seen the summary, which was very detailed! Thank you! |
Thanks @mlutfy. |
Thanks @vingle and @seamuslee001 - appreciate you guys pushing this forward. |
Overview
This PR aims to do the minimum to get CiviCRM into a state where it can be successfully installed on Joomla 4.0.
Before
The CiviCRM installer fails on Joomla 4.0 due to multiple methods that have been deprecated.
After
The CiviCRM installer works on Joomla 4.0
Technical Details
configure.php
:Problem 1:
JArchive::Extract()
is deprecatedSolution 1: Use the
extract()
method of Joomla\Archive\Archive instead (available since Joomla 1.0)Ref: https://api.joomla.org/cms-3/classes/Joomla.Archive.Archive.html#method_extract
Problem 2:
JFile::read()
is deprecated. Two instances of this.Solution 2: Use PHP's native
file_get_contents()
insteadRef: https://api.joomla.org/cms-3/classes/JFile.html#method_read - advice is "Use the native file_get_contents() instead."
script.civicrm.php
:Problem 3:
get("manifest")
is deprecated in Joomla 4.0Solution 3: Use
getManifest()
instead. This method only exists from Joomla 3.4 so we need to use whichever of the two methods exist.Ref: https://api.joomla.org/cms-3/classes/Joomla.CMS.Installer.Adapter.PackageAdapter.html#method_getManifest
Problem 4:
query()
method ofJDatabaseDriver
is deprecated in Joomla 4.0. Two instances of this.Solution 4: Use
execute()
instead. This method exists in Joomla 3.0+ so we can just do a straight replacement.Ref: https://api.joomla.org/cms-3/classes/JDatabaseDriver.html#method_query
https://api.joomla.org/cms-3/classes/JDatabaseDriver.html#method_execute
admin/plugins/civicrm/civicrm.php
(CiviCRM User Management plugin)This is only evident after CiviCRM has been installed but is a showstopper because it's not possible to log in to the Joomla Administrator backend - nothing happens, whereas the other fixes above are all required for the installer.
Problem 5: The
JFactory::getApplication()->isAdmin()
method is deprecated in Joomla 4.0.Solution 5: Use
JFactory::getApplication()->isClient('administrator')
instead, but this only exists on Joomla 3.7+ so need to use whichever method is available.Comments
We only support Joomla 3.0+ now, as per https://docs.civicrm.org/sysadmin/en/latest/requirements/
Note that this PR will break the CiviCRM installer on earlier Joomla versions (2.5.x and earlier) due to the use of
JDatabaseDiver::execute()
. If people think that's undesirable we could add extra code to use whichever ofexecute()
andquery()
is available.Useful document here: https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4
There are some styling issues and the new CiviCRM menu doesn't get positioned nicely with Joomla 4.0 but those issues are out of scope for this PR.