From 134f1a1e61605a3c7c0d505a0a3ec3addc663a0f Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Sun, 22 May 2016 21:10:39 -0600 Subject: [PATCH 1/3] Fix APC for when internal key name is entry_name // Some APC modules changed the internal key name from key to entry_name, HHMV is one such case --- libraries/joomla/cache/storage/apc.php | 52 +++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/libraries/joomla/cache/storage/apc.php b/libraries/joomla/cache/storage/apc.php index 7b7097ad65e41..6a36221f0e49c 100644 --- a/libraries/joomla/cache/storage/apc.php +++ b/libraries/joomla/cache/storage/apc.php @@ -50,8 +50,22 @@ public function getAll() foreach ($keys as $key) { - // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info - $name = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info + $name = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APC modules changed the internal key name from key to entry_name, HHMV is one such case + $name = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $name = $key['key']; + } + $namearr = explode('-', $name); if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache') @@ -128,8 +142,21 @@ public function clean($group, $mode = null) foreach ($keys as $key) { - // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APC modules changed the internal key name from key to entry_name, HHMV is one such case + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-' . $group . '-') === 0 xor $mode != 'group') { @@ -155,8 +182,21 @@ public function gc() foreach ($keys as $key) { - // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // If APCu is being used for this adapter, the internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APC modules changed the internal key name from key to entry_name, HHMV is one such case + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-')) { From 80eafc49ad55946658c017564bd773dae9baacf1 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Mon, 23 May 2016 08:17:46 -0600 Subject: [PATCH 2/3] Fix comment typo --- libraries/joomla/cache/storage/apc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/joomla/cache/storage/apc.php b/libraries/joomla/cache/storage/apc.php index 6a36221f0e49c..47b5814f41242 100644 --- a/libraries/joomla/cache/storage/apc.php +++ b/libraries/joomla/cache/storage/apc.php @@ -57,7 +57,7 @@ public function getAll() } elseif (isset($key['entry_name'])) { - // Some APC modules changed the internal key name from key to entry_name, HHMV is one such case + // Some APC modules changed the internal key name from key to entry_name, HHVM is one such case $name = $key['entry_name']; } else @@ -149,7 +149,7 @@ public function clean($group, $mode = null) } elseif (isset($key['entry_name'])) { - // Some APC modules changed the internal key name from key to entry_name, HHMV is one such case + // Some APC modules changed the internal key name from key to entry_name, HHVM is one such case $internalKey = $key['entry_name']; } else @@ -189,7 +189,7 @@ public function gc() } elseif (isset($key['entry_name'])) { - // Some APC modules changed the internal key name from key to entry_name, HHMV is one such case + // Some APC modules changed the internal key name from key to entry_name, HHVM is one such case $internalKey = $key['entry_name']; } else From fb365e8c22043aacdc06cf8bc30dbf1a12dc6173 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Fri, 27 May 2016 09:51:02 -0600 Subject: [PATCH 3/3] Fix APCu for when internal key name is entry_name Some APCu modules may have changed the internal key name from `key` or `info` to `entry_name` --- libraries/joomla/cache/storage/apcu.php | 52 ++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/libraries/joomla/cache/storage/apcu.php b/libraries/joomla/cache/storage/apcu.php index b01fd8a7f15f8..e7a06e707d21d 100644 --- a/libraries/joomla/cache/storage/apcu.php +++ b/libraries/joomla/cache/storage/apcu.php @@ -50,8 +50,22 @@ public function getAll() foreach ($keys as $key) { - // The internal key name changed with APCu 4.0.7 from key to info - $name = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // The internal key name changed with APCu 4.0.7 from key to info + $name = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APCu modules changed the internal key name from key to entry_name + $name = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $name = $key['key']; + } + $namearr = explode('-', $name); if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache') @@ -136,8 +150,21 @@ public function clean($group, $mode = null) foreach ($keys as $key) { - // The internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // The internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APCu modules changed the internal key name from key to entry_name + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-' . $group . '-') === 0 xor $mode != 'group') { @@ -163,8 +190,21 @@ public function gc() foreach ($keys as $key) { - // The internal key name changed with APCu 4.0.7 from key to info - $internalKey = isset($key['info']) ? $key['info'] : $key['key']; + if (isset($key['info'])) + { + // The internal key name changed with APCu 4.0.7 from key to info + $internalKey = $key['info']; + } + elseif (isset($key['entry_name'])) + { + // Some APCu modules changed the internal key name from key to entry_name + $internalKey = $key['entry_name']; + } + else + { + // A fall back for the old internal key name + $internalKey = $key['key']; + } if (strpos($internalKey, $secret . '-cache-')) {