Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.3.2
-
Fix Version/s: 3.4.alpha
-
Component/s: Drupal Integration Modules
-
Labels:None
Description
The function cmsRootPath in CRM/Utils/System/Drupal.php starts at the root path and stops as soon as it finds any directory that has a /includes directory. This means, if you have a setup like I have:
/var/www --> This is the root of my live site
/var/www/includes --> This is the Drupal includes directory of my live site
/var/www/test --> This is the root of my test site
/var/www/test/includes ---> This is the includes directory of my test site.
Then cmsRootPath returns /var/www for both the live site (correct) and the test site (incorrect... should be /var/www/test).
I see two options to fix this bug:
(1) Simply use $_SERVER['DOCUMENT_ROOT'] instead of the complicated traversing of the path in the script.
(2) If (1) is not an option for some reason (maybe non-Apache web servers?), then I have attached a patch that causes the function to traverse the tree the other direction. I am not a CiviCRM developer, so I cannot guarantee the quality of the patch. I have tested it on my installation (Apache / php 5.2) and it seems to work. I have not tested in a Windows environment.
Basically, cmsRootPath needs to work from the deepest levels up to search for /includes.