You are here

function _thunder_mark_update_checklist in Thunder 8.4

Same name and namespace in other branches
  1. 8.5 thunder.install \_thunder_mark_update_checklist()
  2. 8.2 thunder.install \_thunder_mark_update_checklist()
  3. 8.3 thunder.install \_thunder_mark_update_checklist()
  4. 6.2.x thunder.install \_thunder_mark_update_checklist()
  5. 6.0.x thunder.install \_thunder_mark_update_checklist()
  6. 6.1.x thunder.install \_thunder_mark_update_checklist()

Helper function for direct use of update helper checklist service.

Parameters

string $update_id: Identifier of update in checklist.

bool $successful: The success or failure of update.

\Drupal\update_helper\UpdateLogger $updateLogger: Used update logger service in update hook.

File

./thunder.install, line 75
Install, update and uninstall functions for the thunder installation profile.

Code

function _thunder_mark_update_checklist($update_id, $successful, UpdateLogger $updateLogger) {
  try {

    /** @var \Drupal\update_helper_checklist\UpdateChecklist $update_checklist */
    $update_checklist = \Drupal::service('update_helper_checklist.update_checklist');
    if ($successful) {
      $update_checklist
        ->markUpdatesSuccessful([
        'thunder' => [
          $update_id,
        ],
      ]);
    }
    else {
      $update_checklist
        ->markUpdatesFailed([
        'thunder' => [
          $update_id,
        ],
      ]);
    }
  } catch (EntityStorageException $ee) {
    $updateLogger
      ->warning(t('Unable to mark update in checklist.'));
  } catch (ServiceNotFoundException $se) {

    // If service is not available, we will just ignore it.
  }
}