Skip to content
Snippets Groups Projects
Commit ac755b59 authored by Alberto Paderno's avatar Alberto Paderno
Browse files

Issue #3468900: Remove the code that writes and reads apc_cache::default_prefix from APCu

parent 7acc9dd9
No related branches found
No related tags found
1 merge request!68Issue #3468900: Remove the code that writes and reads apc_cache::default_prefix from APCu
Pipeline #258101 passed
......@@ -67,27 +67,11 @@ protected function binaryToHex($data) {
* Sets the one of the strings used for the APCu storage key.
*/
protected function setBinPrefix() {
$default_empty_prefix = '';
if (extension_loaded('apcu') && apcu_enabled()) {
$default_empty_prefix = apcu_fetch('apc_cache::default_prefix', $success);
if (!$success) {
$default_empty_prefix = drupal_random_bytes(8);
if (!apcu_store('apc_cache::default_prefix', $default_empty_prefix)) {
// Since it was not possible to store the value to use instead of the
// empty string, set $default_empty_prefix back to an empty string.
$default_empty_prefix = '';
}
}
}
$prefixes = variable_get('apc_cache_prefix', $default_empty_prefix);
$prefixes = variable_get('apc_cache_prefix', '');
// @todo Remove the following lines in the 7.x-2.x branch.
if (empty($prefixes)) {
$prefixes = variable_get('cache_prefix', $default_empty_prefix);
$prefixes = variable_get('cache_prefix', '');
}
if (is_string($prefixes) && !empty($prefixes)) {
......@@ -127,22 +111,6 @@ protected function setBinPrefix() {
protected function setDatabasePrefix() {
global $databases;
$default_empty_prefix = '';
if (extension_loaded('apcu') && apcu_enabled()) {
$default_empty_prefix = apcu_fetch('apc_cache::default_prefix', $success);
if (!$success) {
$default_empty_prefix = drupal_random_bytes(8);
if (!apcu_store('apc_cache::default_prefix', $default_empty_prefix)) {
// Since it was not possible to store the value to use instead of the
// empty string, set $default_empty_prefix back to an empty string.
$default_empty_prefix = '';
}
}
}
if (isset($databases) && is_array($databases)) {
$data = array();
......@@ -167,7 +135,7 @@ protected function setDatabasePrefix() {
$this->prefixes[1] = $this->binaryToHex($test_prefix);
}
else {
$this->prefixes[1] = $this->binaryToHex($default_empty_prefix);
$this->prefixes[1] = $this->binaryToHex('');
}
}
......@@ -192,10 +160,10 @@ public function __construct($bin) {
* The key which can be used in APC calls to avoid conflicts with other
* keys.
*/
protected function keyName($cid = NULL) {
protected function keyName($cid = '') {
$key_name = $this->modulePrefix . '::' . $this->binPrefix . '::';
if (!is_null($cid) && $cid != '') {
if ($cid != '') {
$key_name .= $this->binaryToHex($cid);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment