Provision ACL ignores civicrm.settings.php:

ergonlogic@ceres:/var/aegir/clients/cl-cbpq/cbpq.qc.ca$ drush status
WD php: Warning: include_once(sites/cbpq.qc.ca/civicrm.settings.php): failed to open stream: No such file or directory in civicrm_initialize() [error]
(line 252 of /srv/aegir/platforms/civicrm-3.3.5-pressflow-6.20.97-1.3-production/sites/all/modules/civicrm/drupal/civicrm.module).
WD php: Warning: include_once(): Failed opening 'sites/cbpq.qc.ca/civicrm.settings.php' for inclusion [error]
(include_path='.:/usr/share/php:/usr/share/pear') in civicrm_initialize() (line 252 of
/srv/aegir/platforms/civicrm-3.3.5-pressflow-6.20.97-1.3-production/sites/all/modules/civicrm/drupal/civicrm.module).
include_once(sites/cbpq.qc.ca/civicrm.settings.php): failed to open stream: No such file or directory in civicrm_initialize() (line 252 of [warning]
/srv/aegir/platforms/civicrm-3.3.5-pressflow-6.20.97-1.3-production/sites/all/modules/civicrm/drupal/civicrm.module).
include_once(): Failed opening 'sites/cbpq.qc.ca/civicrm.settings.php' for inclusion [warning]
(include_path='.:/usr/share/php:/usr/share/pear') in civicrm_initialize() (line 252 of
/srv/aegir/platforms/civicrm-3.3.5-pressflow-6.20.97-1.3-production/sites/all/modules/civicrm/drupal/civicrm.module).
Oops! - The CiviCRM settings file (civicrm.settings.php) was not found in the expected location (sites/cbpq.qc.ca/civicrm.settings.php). Please [status]
review the Drupal Installation Guide and the Trouble-shooting page for assistance. If you still need help installing, you can often find solutions
to your issue by searching for the error message in the installation support section of the community forum.
Drupal version : 6.20
Site URI : http://cbpq.qc.ca
Database driver : mysqli
Database hostname : sqlcivic.koumbit.net
[... snip]

The file it's complaining about not finding (sites/cbpq.qc.ca/civicrm.settings.php) is indeed there:

ergonlogic@ceres:/var/aegir/platforms/civicrm-3.3.5-pressflow-6.20.97-1.3-production/sites/cbpq.qc.ca$ ll
 total 620
drwxr-xr-x 8 aegir aegir 4096 jui 14 14:38 ./
drwxrwxr-x 7 aegir aegir 4096 jui 14 22:21 ../
-rw-r----- 1 aegir www-data 10352 jui 14 22:21 civicrm.settings.php
-rwxr-xr-x 1 aegir aegir 8874 avr 5 21:43 civicrm.settings.php.bck*
-r--r-----+ 1 aegir aegir 562978 jui 14 22:21 drushrc.php
drwxrwx---+ 24 aegir www-data 4096 jui 8 09:21 files/
drwxrwxr-x+ 6 aegir aegir 4096 jun 30 22:06 libraries/
drwxrwxr-x+ 6 aegir aegir 4096 jun 24 12:35 modules/
drwxrwx---+ 4 aegir www-data 4096 oct 7 2010 private/
drwxr-xr-x 2 aegir aegir 4096 jui 15 2010 scripts/
-r--r-----+ 1 aegir www-data 4948 jui 14 22:21 settings.php
drwxrwxr-x+ 5 aegir aegir 4096 jun 23 16:48 themes/
CommentFileSizeAuthor
#2 Add-files-for-acl-1222772-2.patch1.17 KBsfyn

Comments

bgm’s picture

subscribe

sfyn’s picture

StatusFileSize
new1.17 KB

I've patched for this in the provision_civicrm queue: #1328464: provisionacl support for civicrm

Attached is a patch that is meant to provide an example.

With this patch modules would just have to call drush_set_option, in a pre_verify hook for instance. An example for civicrm:

if (d()->type == 'site') {
  // Retrieve the settings files for acl
  $settings_files = drush_get_option('provisionacl_settings_files', array());

  // Add our file
  $settings_files[] = d()->site_path . '/' . 'civicrm.settings.php';

  // Send it back to drush
  drush_set_option('provisionacl_settings_files', $settings_files, 'site');
}
anarcat’s picture

Status: Active » Needs work

Please mark as needs review when attaching a patch.

Shouldn't this be a hook instead? If we rely only on an option, it means only one contrib module can add files to the array. As an example, maybe instead of hardcoding those:

+++ b/provisionacl.drush.incundefined
@@ -155,7 +155,11 @@ function provisionacl_settings_acls($group, $context) {
+  $acl_files[] = $drushrc->filename();

... maybe that should be done through a hook. Take a look at how provision does this for inspiration, e.g.:

./platform/provision_drupal.drush.inc:    $this->data['extra_config'] .= join("\n", drush_command_invoke_all('provision_drupal_config', d()->uri, $this->data));
sfyn’s picture

Maybe this is a larger issue of provision - I am thinking it would be cool for provision to have some kind of registry of settings files, that module writers can then use to perform operations on all settings files for a given drupal instance...

anarcat’s picture

Status: Needs work » Closed (won't fix)

I think we could just close this - not sure we actually need a hook, the current API seems sufficient for now.

anarcat’s picture

Title: Support CiviCRM » API for easily adding files to add ACLs to (was: Support CiviCRM)
Status: Closed (won't fix) » Needs work

After talking with sfyn about this, it does seem like the patch in #1328464: provisionacl support for civicrm is overly complex and error-prone. We *should* provide an API for this.

I am not sure a registry is the right thing though. Maybe we could just simplify the API here. Working on a patch.

anarcat’s picture

Status: Needs work » Needs review

Alright, I committed a bunch of changes that will break the API for the people out there using anything else but provision_set_acl().

The changes can be reviewed here, i'll leave this needs review until i can get another pair of eyes on it (although I already have sfyn's go on it and it won't break current provision_civicrm patches).

http://drupalcode.org/project/provisionacl.git/blobdiff/49e24ed5f8361ea3...

anarcat’s picture

Title: API for easily adding files to add ACLs to (was: Support CiviCRM) » API for easily setting common ACLs on files (was: Support CiviCRM)

make the title clearer.

anarcat’s picture

Status: Needs review » Fixed

i got a second pair of eyes (thanks mvc!) and will ship with the API, improved with the suggestions..

chrisschaub’s picture

Status: Fixed » Needs work

Moved comment to its own issue.

chrisschaub’s picture

Status: Needs work » Fixed

Putting back to fixed, sorry.

Status: Fixed » Closed (fixed)

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