public static function Modules::checkDisabled in Hook Update Deploy Tools 8
Same name and namespace in other branches
- 7 src/Modules.php \HookUpdateDeployTools\Modules::checkDisabled()
Check to see if modules are actually disabled.
Parameters
array $modules: An array of module machine names to check for being disabled.
Return value
string Messsage indicating the modules are disabled
Throws
\HudtException Calls the update a failure, preventing it from registering the update_N.
1 call to Modules::checkDisabled()
- Modules::disable in src/
Modules.php - Disables an array of modules and checks to make sure they were disabled.
File
- src/
Modules.php, line 21
Class
- Modules
- Public method for enabling modules that verifies it was actually enabled.
Namespace
HookUpdateDeployToolsCode
public static function checkDisabled($modules = array()) {
$modules = (array) $modules;
$enabled_modules = array();
$t = get_t();
// Check to see if each module is disabled.
foreach ($modules as $module) {
if (module_exists($module)) {
// This module is enabled, throw an exception.
$message = 'The module @module was supposed to be disabled by this update, but was not. Please investigate the problem and re-run this update.';
$variables = array(
'@module' => $module,
);
Message::make($message, $variables, WATCHDOG_ERROR);
throw new HudtException($message, $variables, WATCHDOG_ERROR, FALSE);
}
}
$module_list = implode(', ', $modules);
$message = "The modules @disabled are disabled.";
$variables = array(
'@disabled' => $module_list,
);
return Message::make($message, $variables, WATCHDOG_INFO);
}