Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented Oct 3, 2017

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



public function getBasePath() {
// Setup the base path related constant.
return dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))));
Copy link
Contributor

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];

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

@mattwire mattwire force-pushed the CRM-21208_fix_paths_3_8_0 branch from afacbdd to df82f00 Compare October 7, 2017 20:14
@mattwire
Copy link
Contributor Author

Superseded by #11062

@mattwire mattwire closed this Oct 12, 2017
@mattwire mattwire deleted the CRM-21208_fix_paths_3_8_0 branch November 3, 2017 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants