diff -u b/core/core.services.yml b/core/core.services.yml --- b/core/core.services.yml +++ b/core/core.services.yml @@ -66,7 +66,7 @@ arguments: ['@database', '@cache_tags.invalidator.checksum'] cache.backend.apcu: class: Drupal\Core\Cache\ApcuBackendFactory - arguments: ['@app.root', '@kernel', '@cache_tags.invalidator.checksum'] + arguments: ['@app.root', '@cache_tags.invalidator.checksum'] cache.backend.php: class: Drupal\Core\Cache\PhpBackendFactory arguments: ['@cache_tags.invalidator.checksum'] @@ -136,7 +136,7 @@ arguments: ['@database', '@cache_tags.invalidator.checksum'] cache.backend.apcu: class: Drupal\Core\Cache\ApcuBackendFactory - arguments: ['@app.root', '@cache_tags.invalidator.checksum'] + arguments: ['@app.root', '@site.path', '@cache_tags.invalidator.checksum'] cache.backend.php: class: Drupal\Core\Cache\PhpBackendFactory arguments: ['@cache_tags.invalidator.checksum'] @@ -542,6 +542,16 @@ class: Drupal\Core\AppRootFactory arguments: ['@kernel'] public: false + site.path: + class: SplString + factory_service: 'site.path.factory' + factory_method: 'get' + tags: + - { name: parameter_service } + site.path.factory: + class: Drupal\Core\SitePathFactory + arguments: ['@kernel'] + public: false controller_resolver: class: Drupal\Core\Controller\ControllerResolver arguments: ['@class_resolver'] diff -u b/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php b/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php --- b/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php +++ b/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php @@ -20,13 +20,6 @@ protected $sitePrefix; /** - * The Drupal kernel. - * - * @var \Drupal\Core\DrupalKernelInterface - */ - protected $kernel; - - /** * The cache tags checksum provider. * * @var \Drupal\Core\Cache\CacheTagsChecksumInterface @@ -38,13 +31,13 @@ * * @param string $root * The app root. - * @param \Drupal\Core\DrupalKernelInterface $kernel - * The Drupal kernel. + * @param string $site_path + * The site path. * @param \Drupal\Core\Cache\CacheTagsChecksumInterface $checksum_provider * The cache tags checksum provider. */ - public function __construct($root, DrupalKernelInterface $kernel, CacheTagsChecksumInterface $checksum_provider) { - $this->sitePrefix = Crypt::hashBase64($root . '/' . $kernel->getSitePath()); + public function __construct($root, $site_path, CacheTagsChecksumInterface $checksum_provider) { + $this->sitePrefix = Crypt::hashBase64($root . '/' . $site_path); $this->checksumProvider = $checksum_provider; } only in patch2: unchanged: --- /dev/null +++ b/core/lib/Drupal/Core/SitePathFactory.php @@ -0,0 +1,43 @@ +drupalKernel = $drupal_kernel; + } + + /** + * Gets the site path. + * + * @return string + * The site path. + */ + public function get() { + return $this->drupalKernel->getSitePath(); + } + +} +