Bringing `theme-info` from #530780: drush commands to administer themes into drush `pm-info` and extending it to handle modules.
To obtain the type of the project I do SELECT type FROM {system} WHERE name = :name. is it safe? is there a better way?
possible additions:
themes:
1. all versions: show current global and specific settings: mission, logo, zen_wireframes, etc
2. for d7: parse regions to show: overlay, hidden and overlay_supplemental regions
modules:
3. data available in some versions but not printed by pm-info: weight(7), throtle (5,6), old_filename (5,6) datestamp (5,6,7)
4. some of this data can be obtained by querying the system table.
5. still figuring out how to obtain dependencies / dependants for d7
Any feedback welcome. Particularly on display ordering or a more elegant way to do select queries for d5-6,7.
pd. This patch also fixes drupal_get_themes() that is broken for d5 and d7 by replacing `_system_theme_data()` with `list_themes()`
=> _system_theme_data() is only for drupal 6. It is not available for d5 and d7.
=> list_themes() is available for all versions, use the database if possible and includes theme status (_system_theme_data() doesn't).
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 679832.patch | 7.05 KB | jonhattan |
| #9 | pm-info.patch | 9.57 KB | jonhattan |
| #7 | pm-info.patch | 9.48 KB | jonhattan |
| #4 | pm-info.patch | 6.7 KB | jonhattan |
| #2 | pm-info.patch | 6 KB | jonhattan |
Comments
Comment #1
moshe weitzman commentedquerying system table seems fine to me. i think we should show info from a couple more columns, especially schema_version.
i think you'd want to simply show the whole .info file for a module and theme. it is very common with themes in particular to add custom properties which are meaningful. see http://drupal.org/project/skinr.
Listing the dependencies from .info might be enough for modules. If we want to show the full dependency chain, call _module_build_dependencies() in D7.
Comment #2
jonhattanschema_version was already there.
I see a problem with showing .info files for themes: it can include default settings that are to be override via UI, ej:
settings[zen_block_editing] = 1.skinr info is available in the theme object we gather info from ($info->skinr). Perhaps it's a task for a skinr drush integration implementing `drush_skinr_post_pm_info()`.
More:
* Querying the system table is not realiable as recently downloaded projects are not still there is project's data has not been rebuild. Attached patch rely on `drush_get_modules()` and `drush_get_themes()`.
* we show module dependencies (as in .info) for all versions and also dependants for D6, as it is included in $info. I can put full dependency chain for D6,7 if you see it of interest. It is not hard but perhaps time consuming.
Comment #3
moshe weitzman commentedSome feedback on this output from D7:
Comment #4
jonhattanThis is how it looks now in d7 for for devel and garland:
I've split the code into three new functions. Now they are:
Known Issues:
1. d5 themes:
`[description] => themes/engines/phptemplate/phptemplate.engine` is printed as: `Engine : themes/engines/phptemplate/phptemplate.engine`
2. when no direct or reverse dependencies: ` Requires : none`. It can be changed to empty or the line completely removed.
3. which expresion should we use when schema_version = -1 ?
Comment #5
moshe weitzman commentedthat ouput is nicer ... have you considered output using tables. the wrapping would be better for something like Garland's Region line.
2. requires: none looks good to me
3. See constants at top of includes/install.inc
Comment #6
jonhattanis a pain to move this to an array for drush_table. I prefer to emulate it by indenting the 2nd column.
Comment #7
jonhattanChanges:
* messages for possible schema_version values:
* new function drush_sprint() in includes/drush.inc. This one return the string of each line in the form "key:value" ready to be printed. With custom wordwrap.
If you like it I can reroll this patch or open other issue using drush_sprint() for `status` command.
note: php's wordwrap() doesn't wrap html code
Comment #8
jonhattanComment #9
jonhattanPatch updated to latest HEAD.
A example of `drush_sprint`:
Comment #10
greg.1.anderson commentedI think I prefer Moshe's suggestion in #683942: provide an API to detect the drush version. If you convert pm-info from
$output _str.= stuff($key, $value);to$output_array[$key] = $value;and then operate on the array (likedrush statusdoes in the issue above), then it is easier to process the info list in other ways -- support different output formats, pass it to other code that might fiddle with it, etc.Comment #11
moshe weitzman commentedThanks for the example, jonhattan. That does work.
I also prefer the table approach as well. Just like pm-status, do:
drush_print_table(drush_key_value_to_array_table($output_array));Comment #12
jonhattanpatch updated to HEAD and changed to tables.
output for D5:
for D6:
D7:
Comment #13
moshe weitzman commentedCommitted. Thanks. Good stuff.