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

Allow customization of civicrm.config.php

    Details

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

      Description

      I have kind of a weird use case here and i think i have identified at least a general way to approach it but i thought i would submit it as well.

      I'm running 4.1.1 on a Drupal 6 site. The site is on the Pantheon hosting platform. This platform is built specifically for Drupal and it spins up three environments for you so you can leverage the traditional dev-test-live deployment model. It handles pushing and pulling code commits between the three environments so all three environments use essentially the same code base. This means that the settings.php file in Drupal now needs to dynamically assign configuration variables based on which environment you are using. Pantheon handles this process on its end. I have followed a similar method for the civicrm.settings.php file because i need a single file that works on three different environments. This approach works well generally but it seems to fail from extern/open.php and extern/url.php when they attempt to load up my civicrm.settings.php file via civicrm.config.php. The line that fails is:

      $civicrm_root = '/srv/bindings/' . $pantheon_conf['pantheon_binding'] . '/code/' . str_replace('drupal', '', drupal_get_path('module', 'civicrm'));

      With drupal_get_path not being found as a function.

      I presume that this happens because drupal isn't bootstrapped when open.php and url.php are used, which makes sense. I can see a couple of low-impact approaches to getting this to work:

      1. dont include drupal_get_path in civicrm.settings.php and assume that the civicrm folder will always be in a certain spot relative to the drupal root.
      2. provide a function similar to drupal_get_path in the settings file and use that so you dont have to bootstrap drupal
      3. provide a check_exist then include line in civicrm.config.php to some sort of custom.config.php file where a developer could, for example. minimally bootstrap drupal, among other things.

      I am not really that excited about any of these approaches so i wanted to see if there were additional ideas out there besides hacking or substantially refactoring code.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pirog Michael Pirog
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: