Could not load the settings file at: [path to profile]/civicrm_starterkit.7/profiles/civicrm_starterkit/modules/civicrm/../..//default/civicrm.settings.php

The problem is that civicrm.config.php assumes civicrm is being called from sites/all/modules or sites/all/modules/crontib and works backwards X number of directories to the Drupal root.

Comments

kreynen’s picture

StatusFileSize
new2.11 KB

This patch works, but only for the default site by hard coding sites/default. I was thinking that we'd be able to simply bootstrap Drupal to load the location of the conf directory using something like...

  $drupalbase = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'; 
  define('DRUPAL_ROOT', $drupalbase);
  require_once $drupalbase . '/includes/bootstrap.inc';

But that results in a Fatal error: Call to undefined function module_exists() in civicrm/CRM/Utils/System/Drupal.php on line 788

Commenting out the //module_exists('locale') and relying only on function_exists('language_negotiation_get') seems to work, but I'm not sure why we are checking to see if the module_exists('locale') exists. Then we can use...

$confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . conf_path();

This works, but generated Notice: Constant DRUPAL_ROOT already defined in civicrm/CRM/Utils/System/Drupal.php on line 612. That can also be commented out since the include and variable are now defined earlier in civicrm.config.php. I think this whole function should be rewritten to first determine if CiviCRM is in ANY of the directory paths Drupal scans for modules, then load the bootstap and use conf_path() to determine the location of the civicrm.settings.php

http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/conf_...

For now the patch only works with a single site when CiviCRM is being loaded from profiles/[PROFILE-NAME]/modules/civicrm.

kreynen’s picture

The original patch was reversed.

kreynen’s picture

Status: Active » Needs review

Added the patch to the .makes for civicrm_starterkit and cm_starterkit_moderate. Unlike the other patches that fix issues in a way that updating CiviCRM after using a starterkit to intall will simply replace the patched file with an equally usable file, this patch must be reapllied until the fix is made in CiviCRM. The issue has been cross posted.

kreynen’s picture

second part of the more aggressive patch modifying CRM/Utils/System/Drupal.php

kreynen’s picture

kreynen’s picture

#5 failed to apply using drush make. Adding ending line and removed time stamp on files to see it that is the issue.

kreynen’s picture

grr... still isn't applying. would really save a lot of time if I could run the patches locally. Still waiting on #840540: Specify a patch from local file system

kreynen’s picture

removed .org's

kreynen’s picture

back to separate patches

kreynen’s picture

This patch works locally... trying in the .make again.

kreynen’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

emilyf’s picture

Status: Closed (fixed) » Needs work

@kreynen
patch in #10 works but generates error mentioned in #1. patch for the drupal path fails - manually patched which gets that error to go away but I now still get another seemingly random error when I try to run a civi cron:

Fatal error: require_once(): Failed opening required 'profiles/cm_starterkit_moderate/modules/contrib/creativecommons/creativecommons.class.php' (include_path='.:/var/www/ecat_live/profiles/cm_starterkit_moderate/modules/civicrm/:/var/www/ecat_live/profiles/cm_starterkit_moderate/modules/civicrm//packages:.:/usr/share/php:/usr/share/pear') in /var/www/ecat_live/profiles/cm_starterkit_moderate/modules/contrib/creativecommons/creativecommons.module on line 37

kreynen’s picture

Project: CiviCRM Starter Kit » Creative Commons
Version: » 7.x-1.x-dev
Status: Needs work » Closed (fixed)

I don't think this has anything to do with this patch... other than they are both related to CiviCRM's cron. The required file is creativecommons.class.php being called from creativecommons.module on line 37. I don't know why CiviCRM's cron is triggering this, but it's most likely triggering a node_load that is calling the Creative Commons module. See #1558096: D7 Roadmap

kreynen’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs review
kreynen’s picture

libkuman’s picture

Status: Needs review » Needs work

This patch no longer applies to civicrm 4.4.5

kreynen’s picture

Project: Creative Commons » CiviCRM Starter Kit
Version: 7.x-1.x-dev » 7.x-4.x-dev
Component: Code » Installing

  • kreynen committed 59419cc on 7.x-5.x
    fix for #1844558
    
  • kreynen committed 3f63fae on 7.x-5.x
    updating fix for #1844558 to work in profiles/PROFILE-NAME/modules,...
  • kreynen committed 583fea6 on 7.x-5.x
    Change in #1844558 were included in 4.2.7, so that patch is no longer...
nubeli’s picture

StatusFileSize
new669 bytes

Previous patches were problematic for cron, IPN, and anything which wasn't bootstrapping Drupal. So to avoid relying on Drupal to find the settings file CiviCRM allows us to create a settings_location.php file so that's what this patch does. It's being used on Pantheon.

nubeli’s picture

Assigned: Unassigned » nubeli
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.