Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
`drush statusmodules` displays a list of all module's name, status and description. If `--pipe` option is given it will list the names of enabled modules.
A better approach could be to a option like this `--status=enabled|disabled` and make --pipe behave the same as no pipe.
Comment | File | Size | Author |
---|---|---|---|
#10 | 679020.patch | 7.19 KB | jonhattan |
#5 | 679020.patch | 7.11 KB | jonhattan |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedpeople wanted a form that they can easily parse and reuse - thus the space delimited in --pipe. i do think enabled/disabled/uninstalled are helpful.
Comment #2
jonhattanSo the proposal here could be to use the new name for statusmodules (pm-status or pm-list as suggested in #678574-12: Add "pm-" namespace to all of the pm commands) extending it to list themes (code already here #530780: drush commands to administer themes) and perhaps profiles AND add a two new options:
* --project-type=modules|themes|profiles
* --status=any|enabled|disabled|uninstalled (some choices not applicable depending on the project-type).
* make --pipe work in concordance with --status
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedi think we should provide filters to the extent that grep is not a sufficient solution. i'm willing to relax that, if people think explicit options is significantly more friendly.
Comment #4
jonhattanChanging title.
Several issues involved in `statusmodules`at present. Waiting for #654682: drush statusmodule --package: Package column and grouping for the statusmodules list and #677894: untangle pm_module_manage() a bit.
Comment #5
jonhattanpatch with options proposed in #2.
Internals:
1. new function drush_get_projects(). Used by pm-list and pm-info. To be used by pm-enable/disable.
2. new function drush_get_project_status() returns enabled/disabled/uninstalled. Used by both pm-list and pm-info. Can be easily extended to support "missing" with naught101's code in #496008: More useful info in statusmodules.
Feature request: provide options for module packages. not applicable for themes... or use base theme as package info¿?. related: #654682: drush statusmodule --package: Package column and grouping for the statusmodules list.
ps. patch also fix minor things for pm-info
Comment #6
jonhattannew patch with a fix for --pipe.
note the listings don't have a column for given filter options.
screenshots:
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedCode looks good.
On drupal 7, there are 'hidden' projects which should not appear in pm-list.
I think Uninstalled is pretty confusing for projects you never installed. If we can't distinguish, I guess we should say nothing. Sorry about that.
I'd like some more input about these filters. I guess I am OK with them. I do note that you can pretty easily accomplish both filters with grep.
Comment #8
jonhattanFrom a developer viewpoint perhaps hidden should appear in the listing. I have no preferences here.
Uninstalled status is a mix of enabled=0 and schema_version=-1. There's no way to differentiate uninstalled / never installed beyond some heuristics (weight != 0 or other garbage in system table --not always available). The message can be "not installed". I think it is of interest because a disabled module is still a installed one. Although it can be confusing for a end user. No special preferences neither.
filters and grep: filters are user friendly and of special interest in conjunction with --pipe. Think of
filters can also be easily extended to support more than one option: --status=disabled|uninstalled.
Comment #9
moshe weitzman CreditAttribution: moshe weitzman commentedOK, lets keep the filters and remove hidden from D7. I think very few devs want to see those hidden modules. drupal core ships with a boatload of them.
The uninstall page in drupal seems to unambigously know what modules are eligible for uninstall. Thats pretty related to distinguishing never installed from uninstalled.
Comment #10
jonhattanModules pending uninstall are those with enabled=0 and schema_version > -1 and define hook_uninstall. Once uninstalled, no way to know if it was installed any time in the past or is a pristine one afaics. I've changed uninstalled to not installed.
Also hidden modules are out in this patch.
Comment #11
jonhattanComment #12
moshe weitzman CreditAttribution: moshe weitzman commentedCommitted. Thanks.