Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit b4593b8

Browse files
committed
Merge pull request #93 from rebuy-de/apcu-compatibility
Add apcu compatibility Conflicts: CHANGELOG.md
2 parents f42cd86 + a57ebf9 commit b4593b8

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ env:
1616
global:
1717
- COMPOSER_ARGS="--no-interaction"
1818
- COVERAGE_DEPS="php-coveralls/php-coveralls"
19+
- TESTS_ZEND_DIAGNOSTICS_APCU_ENABLED=true
1920
- TESTS_ZEND_DIAGNOSTICS_MONGO_ENABLED=true
2021
- TESTS_ZEND_DIAGNOSTICS_RABBITMQ_ENABLED=true
2122
- TESTS_ZEND_DIAGNOSTICS_REDIS_ENABLED=true
@@ -26,19 +27,22 @@ matrix:
2627
env:
2728
- DEPS=lowest
2829
- MONGO_LEGACY=true
30+
- TESTS_ZEND_DIAGNOSTICS_APCU_ENABLED=false
2931
- TESTS_ZEND_DIAGNOSTICS_MEMCACHE_ENABLED=true
3032
- TESTS_ZEND_DIAGNOSTICS_MEMCACHED_ENABLED=false
3133
- php: 5.6
3234
env:
3335
- DEPS=locked
3436
- MONGO_LEGACY=true
3537
- LEGACY_DEPS="phpunit/phpunit"
38+
- TESTS_ZEND_DIAGNOSTICS_APCU_ENABLED=false
3639
- TESTS_ZEND_DIAGNOSTICS_MEMCACHE_ENABLED=true
3740
- TESTS_ZEND_DIAGNOSTICS_MEMCACHED_ENABLED=false
3841
- php: 5.6
3942
env:
4043
- DEPS=latest
4144
- MONGO_LEGACY=true
45+
- TESTS_ZEND_DIAGNOSTICS_APCU_ENABLED=false
4246
- TESTS_ZEND_DIAGNOSTICS_MEMCACHE_ENABLED=true
4347
- TESTS_ZEND_DIAGNOSTICS_MEMCACHED_ENABLED=false
4448
- php: 7
@@ -83,6 +87,7 @@ matrix:
8387

8488
before_install:
8589
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
90+
- if [[ $TESTS_ZEND_DIAGNOSTICS_APCU_ENABLED == 'true' ]]; then echo "extension = apcu.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi
8691
- if [[ $TESTS_ZEND_DIAGNOSTICS_MEMCACHE_ENABLED == 'true' ]]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi
8792
- if [[ $TESTS_ZEND_DIAGNOSTICS_MEMCACHED_ENABLED == 'true' ]]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi
8893
- if [[ $MONGO_LEGACY == 'true' ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ Releases prior to 1.2.0 did not have entries.
88

99
### Added
1010

11+
- [#93](https://github.com/zendframework/zenddiagnostics/pull/93) adds compatibility for apcu
12+
13+
### Changed
14+
15+
- Nothing.
16+
17+
### Deprecated
18+
19+
- Nothing.
20+
21+
### Removed
22+
23+
- Nothing.
24+
25+
### Fixed
26+
27+
- Nothing.
28+
29+
## 1.2.1 - TBD
30+
31+
### Added
32+
1133
- Nothing.
1234

1335
### Changed

src/Check/ApcFragmentation.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use ZendDiagnostics\Result\Warning;
1515

1616
/**
17-
* Checks to see if the APC fragmentation is below warning/critical thresholds
17+
* Checks to see if the APCu fragmentation is below warning/critical thresholds
1818
*
19-
* APC memory logic borrowed from APC project:
19+
* APCu memory logic borrowed from APC project:
2020
*
2121
* https://github.com/php/pecl-caching-apc/blob/master/apc.php
2222
* authors: Ralf Becker <[email protected]>, Rasmus Lerdorf <[email protected]>, Ilia Alshanetsky <[email protected]>
@@ -90,11 +90,11 @@ public function check()
9090
return new Skip('APC has not been enabled in CLI.');
9191
}
9292

93-
if (! function_exists('apc_sma_info')) {
94-
return new Warning('APC extension is not available');
93+
if (! function_exists('apcu_sma_info')) {
94+
return new Warning('APCu extension is not available');
9595
}
9696

97-
if (! $info = apc_sma_info()) {
97+
if (! $info = apcu_sma_info()) {
9898
return new Warning('Unable to retrieve APC memory status information.');
9999
}
100100

src/Check/ApcMemory.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
use ZendDiagnostics\Result\Warning;
1414

1515
/**
16-
* Checks to see if the APC memory usage is below warning/critical thresholds
16+
* Checks to see if the APCu memory usage is below warning/critical thresholds
1717
*
18-
* APC memory logic borrowed from APC project:
18+
* APCu memory logic borrowed from APC project:
1919
* https://github.com/php/pecl-caching-apc/blob/master/apc.php
2020
* authors: Ralf Becker <[email protected]>, Rasmus Lerdorf <[email protected]>, Ilia Alshanetsky <[email protected]>
2121
* license: The PHP License, version 3.01
@@ -46,11 +46,14 @@ public function check()
4646
return new Skip('APC has not been enabled in CLI.');
4747
}
4848

49-
if (! function_exists('apc_sma_info')) {
50-
return new Warning('APC extension is not available');
49+
if (! function_exists('apcu_sma_info')) {
50+
return new Warning(sprintf(
51+
'%s extension is not available',
52+
PHP_VERSION_ID < 70000 ? 'APC' : 'APCu'
53+
));
5154
}
5255

53-
if (! $this->apcInfo = apc_sma_info()) {
56+
if (! $this->apcInfo = apcu_sma_info()) {
5457
return new Warning('Unable to retrieve APC memory status information.');
5558
}
5659

0 commit comments

Comments
 (0)