When running drush dis [module] on a module that has been enabled by a profile, the profile will be disabled with the module as it formally depends on the module. I understand that this is a conceptual problem with how profiles are handled in Drupal 7 - mixing dependencies and module enabling leads to this behavior. But shouldn't we just leave the profile enabled if we disable a specific module with drush dis?

CommentFileSizeAuthor
#6 drush-898768.patch3.64 KBjonhattan
#3 drush-898768.patch2.08 KBjonhattan

Comments

alex_b’s picture

Title: drush dis [module] can disable profile » D7: drush dis [module] can disable profile
moshe weitzman’s picture

Component: Code » PM (dl, en, up ...)
Assigned: Unassigned » jonhattan

I've seen the message about 'standard' module being disabled many times but I never thought we actually did that!

I'm OK if we solve with a core patch to module_enable() or a fix in drush.

Assigning to our newest drush maintainer - jonhattan who will look after pm commands.

jonhattan’s picture

StatusFileSize
new2.08 KB

as I've seen, in D7 profiles are hidden modules. We did talk about not showing hidden modules and themes in pm-list command months ago.

drush_pm_list() does:

    if (($major_version >= 7) and (isset($project->info['hidden']))) {
      continue;
    }

I don't know how much we should hide hidden modules/themes in drush. We can move the discarding of hidden projects up to drush_get_modules() so there're will be no chance at all to do anything with hidden projects.

---

The other thing I see is that D7 provides two mismatching dependencies list:

dependencies/dependents and requires/required by. Consider this information for color module:

stdClass Object
(
    [uri] => modules/color/color.module
    [filename] => modules/color/color.module
    [name] => color
    [info] => Array
        (
            [name] => Color
            [description] => Allows administrators to change the color scheme of compatible themes.
            [package] => Core
            [version] => 7.0-dev
            [core] => 7.x
            [files] => Array
                (
                    [0] => color.module
                    [1] => color.install
                    [2] => color.test
                )
            [dependencies] => Array
                (
                )
            [dependents] => Array
                (
                )
            [php] => 5.2.0
            [bootstrap] => 0
        )
    [type] => module
    [status] => 1
    [schema_version] => 0
    [weight] => 0
    [required_by] => Array
        (
            [standard] => Array
                (
                    [name] => color
                )
        )
    [requires] => Array
        (
        )
    [sort] => -1
)

we are using requires/required_by instead of dependencies/dependents in environment_7.inc. I can't remember why we choose that. {snip} well we use it because dependencies is the .info array and requires is that array processed. Example:

dependencies[] = color (1.x)

    [requires] => Array(
            [color] => Array
                (
                    [name] => color
                    [original_version] =>  (1.x)
                    [versions] => Array
                        (
                            [0] => Array
                                (
                                    [op] => <
                                    [version] => 2.x
                                )
                            [1] => Array
                                (
                                    [op] => >=
                                    [version] => 1.x
                                )
                        )
                )

btw, it seems to me the mismatching is because dependents is never used in D7. If filled an issue for that #908578: dependents array key not used in any place across the code

attached a patch that discard hidden projects. It seems to be enough to fix this issue.

jonhattan’s picture

Status: Active » Needs review
moshe weitzman’s picture

We have to preserve the ability to enable and disable hidden modules and themes. So we can't act like these don't exist.

jonhattan’s picture

StatusFileSize
new3.64 KB

Install profile is added to the list of modules in _system_rebuild_module_data() as required and hidden.

Alternate solution and fix for a wider bug in drush: required modules can't be disabled.

btw, I've realized that D6 has also the notion of hidden modules.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks like a terrific solution to me. Feel free to commit this, or I will do it in a couple days.

jonhattan’s picture

Status: Reviewed & tested by the community » Fixed

Commited.

jonhattan’s picture

Status: Fixed » Patch (to be ported)

I think this is to be backported to 3.x

moshe weitzman’s picture

Status: Patch (to be ported) » Fixed

3.x gets security fixes only.

Status: Fixed » Closed (fixed)

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