public function CommandHelper::varbaseApplyUpdate in Varbase Core 8.7
Same name and namespace in other branches
- 8.8 src/Utility/CommandHelper.php \Drupal\varbase_core\Utility\CommandHelper::varbaseApplyUpdate()
- 8.6 src/Utility/CommandHelper.php \Drupal\varbase_core\Utility\CommandHelper::varbaseApplyUpdate()
- 9.0.x src/Utility/CommandHelper.php \Drupal\varbase_core\Utility\CommandHelper::varbaseApplyUpdate()
Applying an (optional) update hook (function) from module install file.
Parameters
string $module: Drupal module name.
string $update_hook: Name of update_hook to apply.
bool $force: Force the update.
File
- src/
Utility/ CommandHelper.php, line 32
Class
- CommandHelper
- Command Helper.
Namespace
Drupal\varbase_core\UtilityCode
public function varbaseApplyUpdate($module = '', $update_hook = '', $force = FALSE) {
if (!$update_hook || !$module) {
$this->logger
->info(dt('Please provide a module name and an update hook. Example: drush varbase-up <module> <update_hook>'));
return;
}
module_load_install($module);
if (function_exists($update_hook)) {
call_user_func($update_hook, $force);
}
else {
$this->logger
->error(dt("Couldn't find an update hook: !update_hook. Please verify the update hook name.", [
"!update_hook" => $update_hook,
]));
}
}