public static function Modules::enable in Hook Update Deploy Tools 8
Same name and namespace in other branches
- 7 src/Modules.php \HookUpdateDeployTools\Modules::enable()
Enables an array of modules and checks to make sure they were enabled.
Parameters
array $modules: An array of module machine names to check for being enabled.
Return value
string Messsage indicating the modules are enabled.
Throws
\HudtException Calls the update a failure, preventing it from registering the update_N.
File
- src/
Modules.php, line 88
Class
- Modules
- Public method for enabling modules that verifies it was actually enabled.
Namespace
HookUpdateDeployToolsCode
public static function enable($modules = array()) {
$modules = (array) $modules;
$enable_good = module_enable($modules);
if (!$enable_good) {
// Enable command failed.
$module_list = implode(', ', $modules);
$t = get_t();
$message = 'The requested modules @modules to be enabled by this update, were not, because one of them does not exist in the codebase. Please investigate the problem and re-run this update.';
$variables = array(
'@modules' => $module_list,
);
Message::make($message, $variables, WATCHDOG_ERROR);
throw new HudtException($message, $variables, WATCHDOG_ERROR, FALSE);
}
$success = self::checkEnabled($modules);
return $success;
}