You are here

public function InitSubscriber::onKernelController in Acquia Connector 8.2

Same name and namespace in other branches
  1. 8 src/EventSubscriber/InitSubscriber.php \Drupal\acquia_connector\EventSubscriber\InitSubscriber::onKernelController()
  2. 3.x src/EventSubscriber/InitSubscriber.php \Drupal\acquia_connector\EventSubscriber\InitSubscriber::onKernelController()

Refresh subscription information.

Parameters

\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event: Event.

File

src/EventSubscriber/InitSubscriber.php, line 109

Class

InitSubscriber
Class InitSubscriber.

Namespace

Drupal\acquia_connector\EventSubscriber

Code

public function onKernelController(FilterControllerEvent $event) {
  if ($event
    ->getRequest()->attributes
    ->get('_route') != 'update.manual_status') {
    return;
  }
  $controller = $event
    ->getController();

  /*
   * $controller passed can be either a class or a Closure.
   * This is not usual in Symfony but it may happen.
   * If it is a class, it comes in array format
   */
  if (!is_array($controller)) {
    return;
  }
  if ($controller[0] instanceof UpdateController) {

    // Refresh subscription information, so we are sure about our update
    // status. We send a heartbeat here so that all of our status information
    // gets updated locally via the return data.
    $subscription = new Subscription();
    $subscription
      ->update();
  }
}