Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.3.2
-
Fix Version/s: 3.4.alpha
-
Component/s: Drupal Integration Modules
-
Labels:None
Description
When installing CiviCRM via drush pm-enable (or via the drush civicrm-install command), the installation runs smoothly.
However, the userFrameworkResourceURL is entered in the civicrm_option_value table as: "srvprojectsdrupaldrupal-6websitesallmodulescivicrm" when I expect it to be "sites/all/civicrm".
The fundamental problem is in /CRM/Utils/System/Drupal.php. cmsRootPath() tries to discover the root Drupal path using $_SERVER["SCRIPT_FILENAME"]. However, when running drush, that variable returns the directory that drush is in, not the directory containing Drupal's index.php file. Therefore, it returns null because it can't find a valid root.
As a result CRM::Core::Config::setValues fails when converting $civicrm_root into a relatively directory because rather than replace "$cmsPath/" portion of $civicrm_root with an empty string, it replaces "/" with an empty string (since $cmsPath is empty). Hence, we get the $civicrm_root path without any slashes.
I've attached a patch that checks for the presence of the drush_get_context function and properly gets the Drupal root if the function exists.