Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix APC for when internal key name is entry_name #10600

Merged
merged 3 commits into from
Jul 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions libraries/joomla/cache/storage/apc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, HHVM 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')
Expand Down Expand Up @@ -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, HHVM 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')
{
Expand All @@ -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, HHVM 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-'))
{
Expand Down
52 changes: 46 additions & 6 deletions libraries/joomla/cache/storage/apcu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
{
Expand All @@ -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-'))
{
Expand Down