refreshUpdateData example

$message = ['#theme' => 'update_fetch_error_message'];
        $this->messenger()->addError($this->renderer->renderPlain($message));
      }
    }
    return $build;
  }

  /** * Manually checks the update status without the use of cron. */
  public function updateStatusManually() {
    $this->updateManager->refreshUpdateData();
    $batch_builder = (new BatchBuilder())
      ->setTitle(t('Checking available update data'))
      ->addOperation([$this->updateManager, 'fetchDataBatch'][])
      ->setProgressMessage(t('Trying to check available update data ...'))
      ->setErrorMessage(t('Error checking available update data.'))
      ->setFinishCallback('update_fetch_data_finished');
    batch_set($batch_builder->toArray());
    return batch_process('admin/reports/updates');
  }

}
Home | Imprint | This part of the site doesn't use cookies.