public function Update::execute in DRD Agent 8.3
Same name and namespace in other branches
- 4.0.x src/Agent/Action/Update.php \Drupal\drd_agent\Agent\Action\Update::execute()
Execute an action.
Return value
mixed The response of the action as an array which will be encrypted before returned to DRD.
Overrides Base::execute
File
- src/
Agent/ Action/ Update.php, line 13
Class
- Update
- Provides a 'Update' code.
Namespace
Drupal\drd_agent\Agent\ActionCode
public function execute() {
/** @noinspection PhpIncludeInspection */
require_once DRUPAL_ROOT . '/core/includes/install.inc';
/** @noinspection PhpIncludeInspection */
require_once DRUPAL_ROOT . '/core/includes/update.inc';
drupal_load_updates();
update_fix_compatibility();
// Pending hook_update_N() implementations.
$pending = update_get_update_list();
// Pending hook_post_update_X() implementations.
/** @noinspection NullPointerExceptionInspection */
$post_updates = $this->container
->get('update.post_update_registry')
->getPendingUpdateInformation();
$result = [];
$start = [];
if (count($pending) || count($post_updates)) {
foreach ([
'update',
'post_update',
] as $update_type) {
$updates = $update_type === 'update' ? $pending : $post_updates;
foreach ($updates as $module => $module_updates) {
if (isset($module_updates['start'])) {
$start[$module] = $module_updates['start'];
}
}
}
$result = $this
->batch($start);
}
return $result;
}