public function AggregatorController::feedRefresh

Refreshes a feed, then redirects to the overview page.

Parameters

\Drupal\aggregator\FeedInterface $aggregator_feed: An object describing the feed to be refreshed.

\Symfony\Component\HttpFoundation\Request $request: The current request object containing the search string.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirection to the admin overview page.

Throws

\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException If the query token is missing or invalid.

1 string reference to 'AggregatorController::feedRefresh'
aggregator.routing.yml in drupal/core/modules/aggregator/aggregator.routing.yml
drupal/core/modules/aggregator/aggregator.routing.yml

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php, line 117
Contains \Drupal\aggregator\Controller\AggregatorController.

Class

AggregatorController
Returns responses for aggregator module routes.

Namespace

Drupal\aggregator\Controller

Code

public function feedRefresh(FeedInterface $aggregator_feed, Request $request) {

  // @todo CSRF tokens are validated in page callbacks rather than access
  //   callbacks, because access callbacks are also invoked during menu link
  //   generation. Add token support to routing: http://drupal.org/node/755584.
  $token = $request->query
    ->get('token');
  if (!isset($token) || !drupal_valid_token($token, 'aggregator/update/' . $aggregator_feed
    ->id())) {
    throw new AccessDeniedHttpException();
  }

  // @todo after https://drupal.org/node/1972246 find a new place for it.
  aggregator_refresh($aggregator_feed);
  return new RedirectResponse(url('admin/config/services/aggregator', array(
    'absolute' => TRUE,
  )));
}