You are here

protected function UpdateChecklist::setSuccessfulByHook in Update helper 2.x

Same name and namespace in other branches
  1. 8 modules/update_helper_checklist/src/UpdateChecklist.php \Drupal\update_helper_checklist\UpdateChecklist::setSuccessfulByHook()

Set status for update keys.

Parameters

array $update_ids: Keys for update entries.

bool $status: Status that should be set.

Throws

\Drupal\Core\Entity\EntityStorageException

3 calls to UpdateChecklist::setSuccessfulByHook()
UpdateChecklist::markAllUpdates in modules/update_helper_checklist/src/UpdateChecklist.php
Marks a list of updates.
UpdateChecklist::markUpdatesFailed in modules/update_helper_checklist/src/UpdateChecklist.php
Marks a list of updates as failed.
UpdateChecklist::markUpdatesSuccessful in modules/update_helper_checklist/src/UpdateChecklist.php
Marks a list of updates as successful.

File

modules/update_helper_checklist/src/UpdateChecklist.php, line 151

Class

UpdateChecklist
Update checklist service.

Namespace

Drupal\update_helper_checklist

Code

protected function setSuccessfulByHook(array $update_ids, $status = TRUE) {
  foreach ($update_ids as $update_id) {
    if ($update = Update::load($update_id)) {
      $update
        ->setSuccessfulByHook($status);
      $update
        ->save();
    }
    else {
      Update::create([
        'id' => $update_id,
        'successful_by_hook' => $status,
      ])
        ->save();
    }
  }
}