public static function Modules::checkEnabled in Hook Update Deploy Tools 8
Same name and namespace in other branches
- 7 src/Modules.php \HookUpdateDeployTools\Modules::checkEnabled()
Check to see if the modules are actually 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.
1 call to Modules::checkEnabled()
- Modules::enable in src/
Modules.php - Enables an array of modules and checks to make sure they were enabled.
File
- src/
Modules.php, line 54
Class
- Modules
- Public method for enabling modules that verifies it was actually enabled.
Namespace
HookUpdateDeployToolsCode
public static function checkEnabled($modules = array()) {
$modules = (array) $modules;
$enabled_modules = array();
$t = get_t();
// Check to see if each module is enabled.
foreach ($modules as $module) {
if (!module_exists($module)) {
// This module is not enabled, throw an exception.
$message = 'The module @module was supposed to be enabled 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 @enabled were enabled successfully.";
$variables = array(
'@enabled' => $module_list,
);
return Message::make($message, $variables, WATCHDOG_INFO);
}