Page MenuHomePhabricator

D17198.id41358.diff
No OneTemporary

D17198.id41358.diff

diff --git a/src/applications/cache/spec/PhabricatorDataCacheSpec.php b/src/applications/cache/spec/PhabricatorDataCacheSpec.php
--- a/src/applications/cache/spec/PhabricatorDataCacheSpec.php
+++ b/src/applications/cache/spec/PhabricatorDataCacheSpec.php
@@ -79,28 +79,40 @@
}
private function initAPCCommonSpec() {
- $mem = apc_sma_info();
- $this->setTotalMemory($mem['num_seg'] * $mem['seg_size']);
+ $state = array();
- $info = apc_cache_info('user');
- $this->setUsedMemory($info['mem_size']);
- $this->setEntryCount(count($info['cache_list']));
+ if (function_exists('apcu_sma_info')) {
+ $mem = apcu_sma_info();
+ $info = apcu_cache_info();
+ } else if (function_exists('apc_sma_info')) {
+ $mem = apc_sma_info();
+ $info = apc_cache_info('user');
+ } else {
+ $mem = null;
+ }
- $cache = $info['cache_list'];
- $state = array();
- foreach ($cache as $item) {
- $info = idx($item, 'info', '<unknown-key>');
- $key = self::getKeyPattern($info);
- if (empty($state[$key])) {
- $state[$key] = array(
- 'max' => 0,
- 'total' => 0,
- 'count' => 0,
- );
+ if ($mem) {
+ $this->setTotalMemory($mem['num_seg'] * $mem['seg_size']);
+
+ $this->setUsedMemory($info['mem_size']);
+ $this->setEntryCount(count($info['cache_list']));
+
+ $cache = $info['cache_list'];
+ $state = array();
+ foreach ($cache as $item) {
+ $info = idx($item, 'info', '<unknown-key>');
+ $key = self::getKeyPattern($info);
+ if (empty($state[$key])) {
+ $state[$key] = array(
+ 'max' => 0,
+ 'total' => 0,
+ 'count' => 0,
+ );
+ }
+ $state[$key]['max'] = max($state[$key]['max'], $item['mem_size']);
+ $state[$key]['total'] += $item['mem_size'];
+ $state[$key]['count']++;
}
- $state[$key]['max'] = max($state[$key]['max'], $item['mem_size']);
- $state[$key]['total'] += $item['mem_size'];
- $state[$key]['count']++;
}
$this->setCacheSummary($state);

File Metadata

Mime Type
text/plain
Expires
Mon, May 13, 7:28 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284564
Default Alt Text
D17198.id41358.diff (2 KB)

Event Timeline