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

Allow CiviCRM to be run from profile/[PROFILE]/modules

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      This is similar to "The civicrm.config.php does not consider drupals possible configuration of a sites/all/modules/contrib folder" (http://issues.civicrm.org/jira/browse/CRM-9733). The difference is while sites/all/modules/contrib only adds another directory we need to step back from, profiles/[PROFILE NAME]/modules is bellow the sites directory so we need to get back to the Drupal root and then move forward to find the civicrm.settings.php file.

      I've outlined the issues and problems with an approach that uses conf_path() here http://drupal.org/node/1844558

      The attached patch only solves the problem when a single site is being run from the Profile's codebase and the civicrm.settings.php is in sites/default.

      I really think instead of pattern matching for all possible directory structures and then trying to move forward or back the correct number of directories, we should be determining whether the directory structure is Drupal, WordPress, or Joomla in civicrm_conf_init(). If it is Drupal, define DRUPAL_ROOT and require /includes/bootstrap.inc at that level and use conf_path() to determine the path to civicrm.settings.php from DRUPAL_ROOT.

      One issue I ran into with this approach was the use of module_exists('locale') in civicrm/CRM/Utils/System/Drupal.php on line 788. In addition to checking to see if the language_negotiation_get function exists, module_exists('locale') is also required. I don't really understand to goal of that. Language_negotiation_get is a D7 core function so it should always exist. Maybe?

      if (function_exists('variable_get') &&
      function_exists('module_exists') && module_exists('locale') &&
      function_exists('language_negotiation_get')
      )

      With that change and moving require_once $drupalbase . '/includes/bootstrap.inc'; into civicrm.config.php and removing it anywhere it appears downstream in files like Drupal.php, civicrm_conf_init() could be rewritten to allow civicrm to be placed in any directory.

      I didn't try to finish a patch with that approach because I don't know enough about using CiviCRM with multiple languages in Drupal or with WordPress and Joomla. I'm willing to put more time into this, but wanted to do a sanity check on the direction first.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mlutfy Mathieu Lutfy
                Reporter:
                kreynen Kevin Reynen
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: