For Drush, you can use drush pm-list
:
<?php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
header('Content-Type: text/plain');
$files = drupal_system_listing('\'/\.module$'module$/', 'modules', 'name', 0);
system_get_files_database($files, 'module');
ksort($files);
$core_installed = array();
$core_enabled = array();
$core_disabled = array();
$contrib_installed = array();
$contrib_enabled = array();
$contrib_disabled = array();
foreach ($files as $info) {
$filename = $info->filename;
$name = $info->name;
$status = $info->status;
$contrib = strpos($filename, "sites/all/modules/") === 0;
if ($contrib) {
$contrib_installed[] = $name;
if ($status) $contrib_enabled[] = $name;
else $contrib_disabled[] = $name;
} else {
$core_installed[] = $name;
if ($status) $core_enabled[] = $name;
else $core_disabled[] = $name;
}
}
print "Installed Core Modules: " . join(", ", $core_installed) . "\n\n";
print "Enabled Core Modules: " . join(", ", $core_enabled) . "\n\n";
print "Disabled Core Modules: " . join(", ", $core_disabled) . "\n\n";
print "Installed Contrib Modules: " . join(", ", $contrib_installed) . "\n\n";
print "Enabled Contrib Modules: " . join(", ", $contrib_enabled) . "\n\n";
print "Disabled Contrib Modules: " . join(", ", $contrib_disabled) . "\n\n";
This script can be called with drush using: drush scr modules.php