The site is in fact installed and works fine, but since the install task is reported as failed, you need to run Enable task to be able to use the site.

Full task log: https://gist.github.com/3794271

Comments

omega8cc’s picture

Priority: Normal » Critical

And the same with 4.2.2

Could you take a look?

omega8cc’s picture

StatusFileSize
new23.08 KB
new20.95 KB

I have tried to debug this by adding some extra messages:

    // Enable civicrm module before setting up civicron role,
    // as we need it to expose its permissions.
    drush_log(dt("CiviCRM: Enabling CiviCRM Module."), 'ok');
    //module_enable(array('civicrm'));
    drush_pm_enable('civicrm');

    drush_log(dt("CiviCRM: Creating CiviCron User."), 'ok');
    _provision_civicrm_create_civicron_user();

    // Fix some paths:
    drush_log(dt("CiviCRM: Fixing Resources URLs."), 'ok');
    _provision_civicrm_fixresourceurls();

    drush_log(dt("CiviCRM: Finished installation."), 'ok');
  }
}

The result is that the module_enable(array('civicrm')); is the point where it pseudo-fails.

Of course if when replaced with the old drush_pm_enable('civicrm'); it completes the install fine, but doesn't enable CiviCRM module - as known from the issue #1545902: Provisioning the site doesn't enable CiviCRM with any version - tested with Aegir 2.x based on 1.8

I'm attaching full install logs for reference.

The question is, how to silence this pseudo-error? Since in fact it does enable the module.

omega8cc’s picture

StatusFileSize
new2.03 KB

Found it! It is because drush en civicrm throws this error (see attached result).

omega8cc’s picture

Priority: Critical » Major
StatusFileSize
new1.9 KB

Turns out, there was unrelated extra problem, which is BOA-specific. We symlink platforms for better APC performance, so the civicrm_modulepath doesn't include/match drupal_basepath, and this causes all kinds of broken paths and related issues then.

CiviCRM: civicrm is in /data/all/001/civicrm-4.2.2-7.16.1/sites/all/modules/civicrm
CiviCRM: in _provision_civicrm_fixresourceurls()
CiviCRM: drupal_basepath is /data/disk/o1/distro/001/civicrm-4.2.2-7.16.1
CiviCRM: original civicrm_modulepath is /data/all/001/civicrm-4.2.2-7.16.1/sites/all/modules/civicrm
CiviCRM: substr-ed civicrm_modulepath is odules/civicrm
CiviCRM: before UPDATE: old val for userFrameworkResourceURL =
CiviCRM: updated userFrameworkResourceURL = http://crm422g.o1.linode.us.host8.biz/odules/civicrm

However, after fixing this with the trick shown below, the install fails with the same HTML-garbage-error.

The trick for BOA:


/**
 * Get the path where the CiviCRM module is installed
 * Ex: /var/aegir/platforms/[...]/sites/all/modules/civicrm
 */
function _provision_civicrm_get_package_path() {
  $module = _provision_civicrm_get_package_info();

  if ($module) {
    $drupal_basepath = drush_get_context('DRUSH_DRUPAL_ROOT');
    $local_civicrm_modulepath = "sites/all/modules/civicrm";
    $crmpath = $drupal_basepath . "/" . $local_civicrm_modulepath;
    if (file_exists($crmpath)) {
      drush_log(dt('CiviCRM: civicrm is in @path', array('@path' => $crmpath)));
      return $crmpath;
    }
  }

//   if ($module) {
//     // Get the parent directory of the module, which is in civicrm/drupal/civicrm.module
//     $crmpath = dirname(dirname($module['filename']));
//     drush_log(dt('CiviCRM: civicrm is in @path', array('@path' => $crmpath)));
//     return $crmpath;
//   }

  return FALSE;
}

Attached latest error which still breaks the task, even if the module is enabled.

omega8cc’s picture

Status: Active » Needs review

To get it working reliably with various versions tested, I had to copy some code from Drupal functions into install.provision.inc instead of call only module_enable(), so it looks like:

    // Enable civicrm module before setting up civicron role,
    // as we need it to expose its permissions.
    $this_module = "civicrm";
    drush_log(dt("CiviCRM: Enabling CiviCRM Module."), 'ok');
    $module = _provision_civicrm_get_package_info();
    if (drush_drupal_major_version() >= 7) {
      include_once DRUPAL_ROOT . '/includes/install.inc';
      drupal_load('module', $this_module);
      module_load_install($this_module);
      db_update('system')
        ->fields(array('status' => 1))
        ->condition('type', 'module')
        ->condition('name', $this_module)
        ->execute();
      system_list_reset();
      module_list(TRUE);
      module_implements('', FALSE, TRUE);
      _system_update_bootstrap_status();
      registry_update();
      drupal_get_schema(NULL, TRUE);
      drupal_theme_rebuild();
      entity_info_cache_clear();
      drupal_install_schema($this_module);
      module_invoke($this_module, 'install');
      module_invoke($this_module, 'enable');
    }
    else {
      module_load_install($this_module);
      db_query("UPDATE {system} SET status = %d, throttle = %d WHERE type = '%s' AND name = '%s'", 1, 0, 'module', $this_module);
      drupal_load('module', $this_module);
      module_list(TRUE, FALSE);
      module_implements('', FALSE, TRUE);
      module_invoke($this_module, 'enable');
    }

This code works for 3.4.8 on D6, 4.1.6 on D6 and D7 and 4.2.2 on D7.

bgm’s picture

Status: Needs review » Needs work

With the ClassLoader fix, are you still getting this error?

Tthe tests running these days are not reporting any issues with 4.2 or 4.3-alpha.

omega8cc’s picture

I didn't try that again with this extra code removed, just merged in latest head and everything works great, but I will try again with this patch reverted and will confirm if this workaround is still required.

omega8cc’s picture

Status: Needs work » Reviewed & tested by the community

I have removed this extra code and it still works for all CiviCRM version I have tested, so it is no longer a problem.

omega8cc’s picture

Status: Reviewed & tested by the community » Needs review

One of our clients just confirmed that all install attempts fail for CiviCRM 4.2.6 (with that pseudo-failed task), even if the site is installed, so my patch is still required to avoid that, at least on previous CiviCRM versions. Not sure why it worked on my own tests on a clean, new install, but indeed, the patch is still required.

bgm’s picture

Issue summary: View changes
Status: Needs review » Closed (cannot reproduce)

Closing this old issue, no activity for 2 years. There have been a lot of changes to cleanup provision_civicrm recently, and it seems to be working well with 4.2 D6/D7 to 4.5. Feel free to re-open if you still run into this issue. Thanks.