... is the computer readable name of one of the installed modules.\nAfter enabling, you still have to configure the modules through the modules administration page\n\n"); case 'drush:mm disable': return t("Warning: do not disable required core modules!!!\n\nUsage: drush [options] mm disable ... is the computer readable name of one of the modules to install.\n\n"); case 'drush:mm uninstall': return t("Warning: do not uninstall required core modules!!!\n\nUsage: drush [options] mm uninstall ... is the computer readable name of one of the modules to uninstall.\n\n"); case 'drush:mm dot': return t("Usage: drush [options] mm dot ... generated a graphviz dot file for further processing.\n\n"); } } /** * Implementation of hook_drush_command(). */ function drush_mm_drush_command() { $items['mm list'] = array( 'callback' => 'drush_mm_list_modules', 'description' => 'Lists the available modules' ); $items['mm enable'] = array( 'callback' => 'drush_mm_enable_module', 'description' => 'Enables (and if necessary installs) the given modules and depend' ); $items['mm disable'] = array( 'callback' => 'drush_mm_disable_module', 'description' => 'Disable the given modules and reverse dependants' ); $items['mm uninstall'] = array( 'callback' => 'drush_mm_uninstall_module', 'description' => 'Uninstalls the given modules and reverse dependants' ); $items['mm dot'] = array( 'callback' => 'drush_mm_dot', 'description' => 'Generates a dot file of all modules' ); return $items; } function drush_mm_list_modules() { require_once "drush_mm.inc"; global $_drush_mm_module_info; _drush_mm_get_modules_info(); _drush_mm_list_modules($_drush_mm_module_info); } function drush_mm_dot() { require_once "drush_mm.inc"; global $_drush_mm_module_info; _drush_mm_get_modules_info(); _drush_mm_generate_dot($_drush_mm_module_info); } /** * enables the given modules * * If all modules are present the are enabled */ function drush_mm_enable_module() { $modules = func_get_args(); _drush_mm_endis_module( TRUE, $modules); } function drush_mm_uninstall_module() { $modules = func_get_args(); if (empty($modules)) { drush_die(t("No modules specified.\n\nRun drush help mm uninstall for more information.")); } drush_verbose( t("First disabling modules ...")); call_user_func_array( 'drush_mm_disable_module', $modules); drush_verbose( t("Now uninstalling modules ...")); $enable= FALSE; require_once "drush_mm.inc"; $result= _drush_mm_get_module_list( $modules, $enable); foreach ($result as $module) { if (!DRUSH_SIMULATE) { include_once './includes/install.inc'; drush_verbose( t("Uninstalling module $module")); drupal_uninstall_module( $module); } } } function _drush_mm_endis_module( $enable, $modules) { if (empty($modules)) { if ($enable) { drush_die(t("No modules specified.\n\nRun drush help mm enable for more information.")); } else { drush_die(t("No modules specified.\n\nRun drush help mm disable for more information.")); } } drush_verbose(t("Given module names: '!modules'" , array( "!modules" => implode( ", ", $modules)))); require_once "drush_mm.inc"; $result= _drush_mm_get_module_list( $modules, $enable); if ($enable) { drush_verbose(t("The following modules will be enabled: '!modules'" , array( "!modules" => implode( ", ", $result)))); //module_enable( $result); include_once './includes/install.inc'; drush_verbose( t("Installing modules")); foreach ($result as $module) { drush_verbose( t("Enabling (and maybe installing) module: $module")); if (!DRUSH_SIMULATE) { // only FRESH installed modules gets enabled drupal_install_modules( array($module)); // enable for sure // TODO: this will not solve the 'failed install' scenario module_enable( array($module)); } } } else { drush_verbose(t("The following modules will be disabled: '!modules'" , array( "!modules" => implode( ", ", $result)))); foreach ($result as $module) { drush_verbose( t("Disabling module: $module")); if (!DRUSH_SIMULATE) { module_disable( $result); } } } } function drush_mm_disable_module() { $modules = func_get_args(); _drush_mm_endis_module( FALSE, $modules); }