فهرست منبع

Throw an exception when APC is not loaded but cache is enabled in app config

Joseph Bielawski 14 سال پیش
والد
کامیت
ec3ea65819
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      src/Symfony/Component/Validator/Mapping/Cache/ApcCache.php

+ 5 - 1
src/Symfony/Component/Validator/Mapping/Cache/ApcCache.php

@@ -10,6 +10,10 @@ class ApcCache implements CacheInterface
 
     public function __construct($prefix)
     {
+        if (!extension_loaded('apc')) {
+            throw new \RuntimeException('First you need to enable APC extension in your php.ini. In meanwhile you can just remove "cache" option from application configuration.');
+        }
+
         $this->prefix = $prefix;
     }
 
@@ -27,4 +31,4 @@ class ApcCache implements CacheInterface
     {
         apc_store($this->prefix.$metadata->getClassName(), $metadata);
     }
-}
+}