[TASK] Detect APC and APCu correctly 62/19462/4
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 31 Mar 2013 16:35:19 +0000 (18:35 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 31 Mar 2013 16:52:40 +0000 (18:52 +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: Ie046fa21102c5c7eb6b5b8a9cf54b20252c30cd9
Reviewed-on: https://review.typo3.org/19462
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
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index b0838a2..4dd3d4e 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 90abb4d..c3c5a63 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');
index 728eb48..c87d255 100644 (file)
@@ -669,9 +669,10 @@ class Check {
         */
        protected function checkSomePhpOpcodeCacheIsLoaded() {
                if (
+                       // Currently APCu identifies itself both as "apcu" and "apc" (for compatibility) although it doesn't provide the APC-opcache functionality
                        extension_loaded('eaccelerator')
                        || extension_loaded('xcache')
-                       || extension_loaded('apc')
+                       || (extension_loaded('apc') && !extension_loaded('apcu'))
                        || extension_loaded('Zend Optimizer+')
                        || extension_loaded('Zend OPcache')
                        || extension_loaded('wincache')