You are here

protected function CdnFarfuturePathProcessor::processLegacyFarFuture in CDN 8.3

Process the path for the deprecated far future controller.

@todo Remove in 4.x.

Parameters

string $path: The path.

\Symfony\Component\HttpFoundation\Request $request: The request.

Return value

string The processed path.

1 call to CdnFarfuturePathProcessor::processLegacyFarFuture()
CdnFarfuturePathProcessor::processInbound in src/PathProcessor/CdnFarfuturePathProcessor.php
Processes the inbound path.

File

src/PathProcessor/CdnFarfuturePathProcessor.php, line 73

Class

CdnFarfuturePathProcessor
Defines a path processor to rewrite CDN farfuture URLs.

Namespace

Drupal\cdn\PathProcessor

Code

protected function processLegacyFarFuture($path, Request $request) {
  $tail = substr($path, strlen('/cdn/farfuture/'));
  list($security_token, $mtime, $root_relative_file_url) = explode('/', $tail, 3);
  $returnPath = "/cdn/farfuture/{$security_token}/{$mtime}";

  // Set the root-relative file URL as query parameter.
  $request->query
    ->set('root_relative_file_url', '/' . UrlHelper::encodePath($root_relative_file_url));

  // Return the same path, but without the trailing file.
  return $returnPath;
}