Issue #3058498 by fconnolly, yogeshmpawar, init90, leolando.tan, Berdir: Deprecate/Remove Apcu4Backend

merge-requests/55/head
catch 2019-07-23 20:55:37 +01:00
parent af4492f97c
commit fa4c517414
3 changed files with 9 additions and 13 deletions

View File

@ -2,10 +2,17 @@
namespace Drupal\Core\Cache; namespace Drupal\Core\Cache;
@trigger_error(__NAMESPACE__ . '\Apcu4Backend is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Cache\ApcuBackend instead. See https://www.drupal.org/node/3063510.', E_USER_DEPRECATED);
/** /**
* Stores cache items in the Alternative PHP Cache User Cache (APCu). * Stores cache items in the Alternative PHP Cache User Cache (APCu).
* *
* This class is used with APCu versions >= 4.0.0 and < 5.0.0. * This class is used with APCu versions >= 4.0.0 and < 5.0.0.
*
* @deprecated in drupal:8.8.0 and is removed from from drupal:9.0.0.
* Use \Drupal\Core\Cache\ApcuBackend instead.
*
* @see https://www.drupal.org/node/3063510
*/ */
class Apcu4Backend extends ApcuBackend { class Apcu4Backend extends ApcuBackend {

View File

@ -40,12 +40,7 @@ class ApcuBackendFactory implements CacheFactoryInterface {
public function __construct($root, $site_path, CacheTagsChecksumInterface $checksum_provider) { public function __construct($root, $site_path, CacheTagsChecksumInterface $checksum_provider) {
$this->sitePrefix = Settings::getApcuPrefix('apcu_backend', $root, $site_path); $this->sitePrefix = Settings::getApcuPrefix('apcu_backend', $root, $site_path);
$this->checksumProvider = $checksum_provider; $this->checksumProvider = $checksum_provider;
if (version_compare(phpversion('apcu'), '5.0.0', '>=')) { $this->backendClass = 'Drupal\Core\Cache\ApcuBackend';
$this->backendClass = 'Drupal\Core\Cache\ApcuBackend';
}
else {
$this->backendClass = 'Drupal\Core\Cache\Apcu4Backend';
}
} }
/** /**

View File

@ -2,7 +2,6 @@
namespace Drupal\KernelTests\Core\Cache; namespace Drupal\KernelTests\Core\Cache;
use Drupal\Core\Cache\Apcu4Backend;
use Drupal\Core\Cache\ApcuBackend; use Drupal\Core\Cache\ApcuBackend;
/** /**
@ -17,12 +16,7 @@ class ApcuBackendTest extends GenericCacheBackendUnitTestBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function createCacheBackend($bin) { protected function createCacheBackend($bin) {
if (version_compare(phpversion('apcu'), '5.0.0', '>=')) { return new ApcuBackend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'));
return new ApcuBackend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'));
}
else {
return new Apcu4Backend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'));
}
} }
/** /**