-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
CRM-21208 Fix version check on Joomla 3.8 #11061
Conversation
CRM/Utils/System/Joomla.php
Outdated
|
||
public function getBasePath() { | ||
// Setup the base path related constant. | ||
return dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for getting Joomla base path , dirname not work properly when civicrm as soft link
e.g /var/www/html/joomla/administrator/components/com_civicrm/civicrm -> /var/www/html/civicrm
instead we can use $civicrm_root variable
global $civicrm_root;
$joomlaPath = explode('/administrator', $civicrm_root);
$joomlaBase = $joomlaPath[0];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the dirname either - it was there in 2 places. All I have done is break it into it's own function so that it can be replaced with something better more easily. As this is my first time using Joomla with CiviCRM I'm not too familiar with it.
@sunilpawar Are you happy that $civicrm_root will be defined in all cases? Eg. when run from cli.php etc.? If you can be certain I will add your change to my PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattwire civicrm.settings.php always loaded first, $civicrm_root is defined in that file. so it always present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunilpawar Thankyou. I've updated this on the other PR #11062 I created which also includes these changes - could you comment on the changes in that other PR for me?
afacbdd
to
df82f00
Compare
Superseded by #11062 |
The Administer > System Settings > Directories page fails to load on Joomla 3.8 installations.
An error is logged:
RuntimeException: Cannot resolve path using "cms.root.path" in /var/www/html/membership/administrator/components/com_civicrm/civicrm/Civi/Core/Paths.php on line 104
The problem lies in the cmsRootPath() function in CRM/Utils/System/Joomla.php. This code was added by CRM-18058 and as part of determining the Joomla root path it tests for the existence of a particular file, $siteRoot/libraries/cms/version/version.php.
$includePath = "$siteRoot/libraries/cms/version";
if (file_exists("$includePath/version.php")
In Joomla 3.8.0 that file doesn't exist; it's been moved to $siteRoot/libraries/src/Version.php