23

如何在admin/build/modules中获取 Drupal 中的模块列表?

4

6 回答 6

50

您可以使用drush pm-list --type=Module --status=enabled命令获取已安装模块的列表。

有关更多选项,请查看http://www.drupaltonight.com/drupal-articles/using-drush-get-list-enabled-modules

于 2012-01-08T08:06:42.980 回答
8

安装“ Drush ”(无论如何都是一个不错的选择,一旦你习惯了它,你就会爱上它)。它有一个内置命令来列出所有已安装的模块主题。

如果您需要查看模块列表以在其他地方显示它(这可能是一个安全问题!),您可以查看 drush 是如何做到的(pm.drush.inc:218)。

此外还有一个核心功能,但我不知道这是否是你想要的。

于 2010-11-20T10:55:41.123 回答
1

以下命令将起作用,输出所有可用模块的列表以及它们所在的包、状态和版本。

drush pm-list --type=Module --status=enabled
于 2015-05-01T07:18:21.507 回答
1

如果您想列出所有可用的模块,这应该适用于 Drupal 6 或 Drupal 7:

<?php
// include_once('.' . base_path() . drupal_get_path('module', 'system') . '/system.admin.inc');
// Above line was intentionally commented out (see below).
$drupal_version = (int) VERSION;
$list_modules_function = '';
if ($drupal_version >= 7 && $drupal_version < 8) {
  $list_modules_function = 'system_rebuild_module_data';
}
else if ($drupal_version >= 6 && $drupal_version < 7) {
  $list_modules_function = 'module_rebuild_cache';
}
if (empty($list_modules_function)) {
  $output = t('Oops... Looks like you are not using either version 6 or version 7 of Drupal');
}
else if (!function_exists($list_modules_function)) {
  $output = t('Oops... Unable to find the function !function(). Try uncommenting the top line of this code.', array('!function' => $list_modules_function));
}
else {
  $output = "<dl>\n";
  $list_modules = $list_modules_function();
  foreach ($list_modules as $module) {
    $output .= "<dt>" . check_plain($module->info["name"]) . "</dt>\n";
    $output .= "<dd>" . check_plain($module->info["description"]) . "</dd>\n";
  }
  $output .= "</dl>\n";
}
print $output;
?>
于 2013-04-29T08:44:45.817 回答
1
module_list($refresh = FALSE, $bootstrap_refresh = FALSE, $sort = FALSE, $fixed_list = NULL)

这里有更多细节。 http://api.drupal.org/api/drupal/includes!module.inc/function/module_list/7

于 2013-03-05T20:40:29.883 回答
1

您还可以使用以下命令搜索特定模块。如果您想从模块列表中仅列出商务模块,则

drush pml | grep commerce

在 Windows 机器上,您不能使用 grep。所以你必须使用 findstr

drush pml | findstr commerce
于 2015-04-01T06:06:49.037 回答