I have some problems enabling some modules which depends on others, for example iframe, which depends on content module.

When I try to enable iframe using drush, I get:

$ sudo drush en iframe
Module iframe doesn't meet the requirements to be enabled.                                              [error]
CCK module "content" required.                                                                                             [error]
The following extensions will be enabled: content
Do you really want to continue? (y/n): y
content was enabled successfully.                                                                                           [ok]
An error occurred at function : drush_pm_enable                                                                   [error]

Instead of, for example, with data module:

$ sudo drush en date
The following extensions will be enabled: content, date
Do you really want to continue? (y/n): y
date was enabled successfully.                                                                                             [ok]
content was enabled successfully.                                                                                          [ok]

In the first example, only content is activated. In the second, content and data are activated.

The most important is that this bug also affects features: I'm not able to create a feature with iframe and content modules because is it not possible to activate both at same time.

Comments

greg.1.anderson’s picture

Assigned: Unassigned » jonhattan

That error message comes from the iframe module:

function iframe_requirements($phase) {
  $requirements = array();
  // Ensure translations don't break at install time
  $t = get_t();
  if (!module_exists('content') || !function_exists('content_notify')) {
    $requirements['iframe'] = array(
      'title' => $t('CCK needed'),
      'description' => $t("CCK module \"content\" required."),
      'severity' => REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}

I would expect that it would not be necessary for iframe to test module_exists('content'), since it also has this in iframe.info:

dependencies[] = content

Of course, pm-enable iframe works just fine if you enable content first, but I understand you need them to be enablable together for features to work right.. I am tempted to just move this issue over to the iframe queue and ask them to remove the cck check in their requirements menu, but first I will ask if druhs pm-enable might insure that all of the dependencies are fully enabled before going on and calling the install functions.

The issue, I am sure, is that the dependencies were not around during the bootstrap operation, so even though they are now enabled, their code files have not been included, so module_exists is going to fail. We would have to complete the bootstrap for each enabled module as we stepped through, enabling them. Would this be easy enough to do?

jonhattan’s picture

Exactly the same occur via web. So enabling features via web should also fail.

The workflow in pm_enable is
0. ...
1. add dependencies to list of requested modules.
2. check requirements and discard modules.
3. inform the user. ask for confirmation.
4. enable all modules.
5. submit modules form.

I think unrolling 4 to include 2 as a substep is doable and 5 can still be done after modules pass the check-enable loop, so it isn't a big performance hit... but I'm not very convinced to rework this for an edge case also present in drupal core. I suppose this case neither work for an install profile.

Well, I've seen that the workflow is not exactly the same as in drupal, although it has proved itself to be pretty equivalent
http://api.drupal.org/api/drupal/modules--system--system.admin.inc/funct...

I'll take other look at it tomorrow.

greg.1.anderson’s picture

Maybe we should just move this to the iframe queue and suggest they remove the explicit check from iframe_requirements. It seems to me that the only benefit is that they can tell the user that cck = content (but iframe is already part of the CCK package, so...). Since this code is breaking features, seems it would be better to remove it.

azuledu’s picture

Version: All-versions-4.0-rc3 »

I've just post an issue about this in the iframe module queue (http://drupal.org/node/1002502).

azuledu’s picture

Version: » All-versions-4.0-rc3
jonhattan’s picture

Status: Active » Closed (works as designed)

to depend on content module is enough as both drupal and drush will enable content and then iframe, so content_notify() is always available.