CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Allow customization of civicrm.config.php or refactor open.php/url.php
Pages: [1]

Author Topic: Allow customization of civicrm.config.php or refactor open.php/url.php  (Read 3357 times)

pirog

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5+
  • PHP version: 5.3+
Allow customization of civicrm.config.php or refactor open.php/url.php
May 07, 2012, 10:24:08 am
I have kind of an interesting 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.

pirog

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5+
  • PHP version: 5.3+
Re: Allow customization of civicrm.config.php or refactor open.php/url.php
May 30, 2012, 02:09:21 pm
Anyone interested in working with me on this issue?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Allow customization of civicrm.config.php or refactor open.php/url.php
May 30, 2012, 10:57:55 pm

Might want to ping and ask folks on IRC if anyone else is interested. In general might be easier if you take first crack at it and then ask people to test / comment on the patch :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

pirog

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5+
  • PHP version: 5.3+
Re: Allow customization of civicrm.config.php or refactor open.php/url.php
May 31, 2012, 11:57:23 am
thanks for the advice!

as soon as i have some free time i'll look into the issue and see what i can do.  i'm a little worried about the scope but we'll see.

also, are you guys going to be at the SF meetup on June 12? we were thinking about showing up.

micheas

  • I’m new here
  • *
  • Posts: 14
  • Karma: 1
    • Green Campaigns
Re: Allow customization of civicrm.config.php or refactor open.php/url.php
June 10, 2012, 04:55:31 pm
Why not use the following?

Code: [Select]
$civicrm_root = '/srv/bindings/' . $pantheon_conf['pantheon_binding'] . '/code/sites/default/modules/civicrm/' ;

Or will $pantheon_conf also need loaded?

Further complicating this is that when I have tried calling drupal_bootstrap(); on pantheon I have had to define DRUPAL_ROOT before calling drupal_bootstrap();

I am sure I am missing several issues.

Edit: fixed typo.
« Last Edit: June 10, 2012, 05:56:23 pm by micheas »

pirog

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5+
  • PHP version: 5.3+
Re: Allow customization of civicrm.config.php or refactor open.php/url.php
June 12, 2012, 04:28:17 pm
yes, you can definitely do that and that is what i meant by:

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.

the question is whether it is desirable to have a way for the variable to be dynamic or not via. if it is not desirable then your solution is QED if it is desirable then i think you need to look at some of the options in 2 and 3.

sonicthoughts

  • Ask me questions
  • ****
  • Posts: 498
  • Karma: 10
Re: Allow customization of civicrm.config.php or refactor open.php/url.php
August 03, 2012, 01:54:09 pm
I'm working with Pantheon and ran into the same issue - I think it's generally an issue with migrating from dev to production.  Not sure why it NEEDS to be absolute path...

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Allow customization of civicrm.config.php or refactor open.php/url.php

This forum was archived on 2017-11-26.