public static function Modules::disable in Hook Update Deploy Tools 7
Same name and namespace in other branches
- 8 src/Modules.php \HookUpdateDeployTools\Modules::disable()
Disables an array of modules and checks to make sure they were disabled.
Parameters
array $modules: An array of module machine names to disable.
bool $disable_dependents: Switch to disable dependent modules. (default: TRUE)
Return value
string Messsage indicating the modules are disabled.
1 call to Modules::disable()
- Modules::disableAndUninstall in src/
Modules.php - Disables and Uninstalls an array of modules. Will not process dependents.
File
- src/
Modules.php, line 236
Class
- Modules
- Public method for enabling modules that verifies it was actually enabled.
Namespace
HookUpdateDeployToolsCode
public static function disable($modules = array(), $disable_dependents = TRUE) {
try {
$modules = (array) $modules;
$disable_dependents = !empty($disable_dependents) ? TRUE : FALSE;
module_disable($modules, $disable_dependents);
// Verify that the modules were disabled.
$success = self::checkDisabled($modules);
drupal_flush_all_caches();
$success .= Message::make("Caches cleared and Registry Rebuilt.", array(), WATCHDOG_INFO);
return $success;
} catch (\Exception $e) {
$vars['!error'] = method_exists($e, 'logMessage') ? $e
->logMessage() : $e
->getMessage();
if (!method_exists($e, 'logMessage')) {
// Not logged yet, so log it.
$message = 'Modules::disable failed because: !error';
Message::make($message, $vars, WATCHDOG_ERROR);
}
throw new HudtException('Update aborted! !error', $vars, WATCHDOG_ERROR, FALSE);
}
}