[TASK] Detect APC and APCu correctly 71/19471/2
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 31 Mar 2013 18:02:01 +0000 (20:02 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 31 Mar 2013 19:12:41 +0000 (21:12 +0200)
APCu is just the user-data part of APC,
providing the same API.

If installed it currently identifies itself
as both "apcu" and "apc" (for compatibility).
Thus if "apcu" shows up, we actually have an APC
without opcache-support.

Resolves: #46821
Releases: 4.5, 4.7, 6.0, 6.1
Change-Id: Ia62e06c5fdaab1e836f02020277ca0fb17bf118d
Reviewed-on: https://review.typo3.org/19471
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php
tests/t3lib/cache/backend/t3lib_cache_backend_apcbackendTest.php

index b0fa256..c042022 100644 (file)
@@ -87,7 +87,7 @@ class t3lib_cache_backend_ApcBackend extends t3lib_cache_backend_AbstractBackend
        public function __construct(array $options = array()) {
                if (!extension_loaded('apc')) {
                        throw new t3lib_cache_Exception(
-                               'The PHP extension "apc" must be installed and loaded in order to use the APC backend.',
+                               'The PHP extension "apc" or "apcu" must be installed and loaded in order to use the APC backend.',
                                1232985414
                        );
                }
index 09f891e..b3d0963 100644 (file)
@@ -45,8 +45,9 @@ class t3lib_cache_backend_ApcBackendTest extends tx_phpunit_testcase {
         * @author Ingo Renner <ingo@typo3.org>
         */
        public function setUp() {
+               // Currently APCu identifies itself both as "apcu" and "apc" (for compatibility) although it doesn't provide the APC-opcache functionality
                if (!extension_loaded('apc')) {
-                       $this->markTestSkipped('APC extension was not available');
+                       $this->markTestSkipped('APC/APCu extension was not available');
                }
 
                if (ini_get('apc.slam_defense') == 1) {