Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-7429

cmsRootPath does correctly determine root path if an "includes" directory exists at higher levels

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.4.alpha
    • 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.

        Attachments

          Activity

            People

            • Assignee:
              kiran.jagtap Kiran Jagtap
              Reporter:
              jkounis John Kounis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: