1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Improve compatibility of "Config > Cache Status" across APCu versions

Summary:
Ref T13164. See PHI790. Older versions of APCu reported cache keys as "key" from `apcu_cache_info()`. APC and newer APCu report it as "info".

Check both indexes for compatibility.

Test Plan:
  - Locally, with newer APCu, saw no behavioral change.
  - Will double check on `admin`, which has an older APCu with the "key" behavior.
  - (I hunted this down by dumping `apcu_cache_info()` on `admin` to see what was going on.)

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

Differential Revision: https://secure.phabricator.com/D19569
This commit is contained in:
epriestley 2018-08-08 11:26:34 -07:00
parent 3ca3f09a1a
commit df31405d64

View file

@ -106,8 +106,21 @@ final class PhabricatorDataCacheSpec extends PhabricatorCacheSpec {
$cache = $info['cache_list'];
$state = array();
foreach ($cache as $item) {
$info = idx($item, 'info', '<unknown-key>');
$key = self::getKeyPattern($info);
// Some older versions of APCu report the cachekey as "key", while
// newer APCu and APC report it as "info". Just check both indexes
// for commpatibility. See T13164 for details.
$info = idx($item, 'info');
if ($info === null) {
$info = idx($item, 'key');
}
if ($info === null) {
$key = '<unknown-key>';
} else {
$key = self::getKeyPattern($info);
}
if (empty($state[$key])) {
$state[$key] = array(
'max' => 0,