Skip to content

Instantly share code, notes, and snippets.

@arpitr
Created June 13, 2017 21:49
Show Gist options
  • Save arpitr/082d686221be85623655a9d4c2bcf5f6 to your computer and use it in GitHub Desktop.
Save arpitr/082d686221be85623655a9d4c2bcf5f6 to your computer and use it in GitHub Desktop.
<?php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
header('Content-Type: text/plain');
function _get_module_count() {
$modules = system_list('module_enabled');
foreach ($modules as $module) {
if (strpos($module->filename, 'sites/all/modules/contrib') === 0) {
$contrib_module_installed[] = $module->name;
if ($module->status) {
$contrib_module_enabled[] = $module->name;
} else {
$contrib_module_disabled[] = $module->name;
}
}
if (strpos($module->filename, 'sites/all/modules/custom') === 0) {
$custom_module_installed[] = $module->name;
if ($module->status) {
$custom_module_enabled[] = $module->name;
} else {
$custom_module_disabled[] = $module->name;
}
} else {
$core_module_installed[] = $module->name;
if ($module->status) {
$core_module_enabled[] = $module->name;
} else {
$core_module_disabled[] = $module->name;
}
}
}
print "Installed Core Modules: " . count($core_module_installed) . "\n\n";
print "Enabled Core Modules: " . count($core_module_enabled) . "\n\n";
print "Disabled Core Modules: " . count($core_module_disabled) . "\n\n";
print "Installed Contrib Modules: " . count($contrib_module_installed). "\n\n";
print "Enabled Contrib Modules: " . count($contrib_module_enabled) . "\n\n";
print "Disabled Contrib Modules: " . count($contrib_module_disabled) . "\n\n";
print "Installed Custom Modules: " . count($custom_module_installed) . "\n\n";
print "Enabled Custom Modules: " . count($custom_module_enabled) . "\n\n";
print "Disabled Custom Modules: " . count($custom_module_disabled) . "\n\n";
}
_get_module_count();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment