3 namespace Drupal\update\Controller;
5 use Drupal\update\UpdateManagerInterface;
6 use Symfony\Component\DependencyInjection\ContainerInterface;
7 use Drupal\Core\Controller\ControllerBase;
10 * Controller routines for update routes.
12 class UpdateController extends ControllerBase {
15 * Update manager service.
17 * @var \Drupal\update\UpdateManagerInterface
19 protected $updateManager;
22 * Constructs update status data.
24 * @param \Drupal\update\UpdateManagerInterface $update_manager
25 * Update Manager Service.
27 public function __construct(UpdateManagerInterface $update_manager) {
28 $this->updateManager = $update_manager;
34 public static function create(ContainerInterface $container) {
36 $container->get('update.manager')
41 * Returns a page about the update status of projects.
44 * A build array with the update status of projects.
46 public function updateStatus() {
48 '#theme' => 'update_report'
50 if ($available = update_get_available(TRUE)) {
51 $this->moduleHandler()->loadInclude('update', 'compare.inc');
52 $build['#data'] = update_calculate_project_data($available);
58 * Manually checks the update status without the use of cron.
60 public function updateStatusManually() {
61 $this->updateManager->refreshUpdateData();
64 [[$this->updateManager, 'fetchDataBatch'], []],
66 'finished' => 'update_fetch_data_finished',
67 'title' => t('Checking available update data'),
68 'progress_message' => t('Trying to check available update data ...'),
69 'error_message' => t('Error checking available update data.'),
72 return batch_process('admin/reports/updates');