Made the ApcCacheSource compatible with Debian Squeeze
authorRouL <roul@codingcorner.info>
Thu, 14 Jul 2011 19:40:54 +0000 (21:40 +0200)
committerRouL <roul@codingcorner.info>
Thu, 14 Jul 2011 19:40:54 +0000 (21:40 +0200)
Debian still uses APC 3.1.3-pl2, "apc_exists" was introduced in 3.1.4,
so i made a workaround with apc_fetch (returns false if nothing found).

wcfsetup/install/files/lib/system/cache/source/ApcCacheSource.class.php

index adc3bec53bdbc0c37c887ea98dfe13533e5d3237..518e541ee58d8bf3753e920cd9de6ad02323cac7 100644 (file)
@@ -18,7 +18,7 @@ class ApcCacheSource implements CacheSource {
         * Creates a new ApcCacheSource object.
         */
        public function __construct() {
-               if (!function_exists('apc_exists')) {
+               if (!function_exists('apc_store')) {
                        throw new SystemException('APC support is not enabled.');
                }
        }
@@ -27,11 +27,11 @@ class ApcCacheSource implements CacheSource {
         * @see CacheSource::get()
         */
        public function get($cacheResource) {
-               if (!apc_exists($cacheResource['file'])) {
+               if (false === $data = apc_fetch($cacheResource['file'])) {
                        return null;
                }
                
-               return apc_fetch($cacheResource['file']);
+               return $data;
        }
        
        /**