[TASK] Detect APC and APCu correctly 69/19469/2
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 31 Mar 2013 17:54:41 +0000 (19:54 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 31 Mar 2013 19:12:01 +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: Id61bcf9277295915a6e204eabab7c65159e98764
Reviewed-on: https://review.typo3.org/19469
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php
typo3/sysext/core/Tests/Unit/Cache/Backend/ApcBackendTest.php

index 7f45fca..df7feb6 100644 (file)
@@ -87,7 +87,7 @@ class ApcBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend implement
         */
        public function __construct($context, array $options = array()) {
                if (!extension_loaded('apc')) {
-                       throw new \TYPO3\CMS\Core\Cache\Exception('The PHP extension "apc" must be installed and loaded in order to use the APC backend.', 1232985414);
+                       throw new \TYPO3\CMS\Core\Cache\Exception('The PHP extension "apc" or "apcu" must be installed and loaded in order to use the APC backend.', 1232985414);
                }
                parent::__construct($context, $options);
        }
index 9cd43bc..c67bf14 100644 (file)
@@ -42,8 +42,9 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @return void
         */
        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) {
                        $this->markTestSkipped('This testcase can only be executed with apc.slam_defense = Off');