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

Issue #3462780: The prefix used for cache items is build from a persistent...

Issue #3462780: The prefix used for cache items is build from a persistent variable which is never set
parent 9f0ab2cf
No related branches found
No related tags found
1 merge request!14Issue #3462780: The prefix used for cache items is build from a persistent variable which is never set
Pipeline #229677 passed
......@@ -100,33 +100,54 @@ class DrupalAPCCache implements DrupalCacheInterface {
* been set.
*/
protected static function getPrefixSettingForBin($bin) {
$prefixes = variable_get('cache_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', '');
}
if (is_string($prefixes)) {
// Variable can be a string, which then considered as a default behavior.
// $prefixes can be a string. In this case, the same prefix is used for
// all the cache bins.
return $prefixes;
}
if (isset($prefixes[$bin])) {
if (FALSE !== $prefixes[$bin]) {
// If entry is set and not FALSE, an explicit prefix is set for the bin.
return $prefixes[$bin];
if (is_array($prefixes)) {
if (isset($prefixes[$bin])) {
if ($prefixes[$bin] === FALSE) {
// If $prefixes[$bin] is FALSE, no prefix is used for that cache bin,
// whatever the default prefix is.
return '';
}
else {
// If $prefixes[$bin] is set and not FALSE, that value is used for the
// cache bin.
return $prefixes[$bin];
}
}
else {
// If we have an explicit false, it means no prefix whatever is the
// default configuration.
return '';
if (isset($prefixes['default'])) {
if ($prefixes['default'] === FALSE) {
// For $prefixes['default'], FALSE means no prefix is used.
return '';
}
elseif (is_string($prefixes['default'])) {
return $prefixes['default'];
}
else {
// Ignore any value which is neither a string nor a Boolean value.
return '';
}
}
else {
return '';
}
}
}
else {
// Key is not set, we can safely rely on default behavior.
if (isset($prefixes['default']) && FALSE !== $prefixes['default']) {
return $prefixes['default'];
}
else {
// When default is not set or an explicit FALSE, this means no prefix.
return '';
}
// Ignore any value which is neither a string nor an array.
return '';
}
}
......
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