Пример #1
0
 /**
  * Constructor
  *
  * @param  array $options associative array of options
  * @throws IfwPsn_Vendor_Zend_Cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     if (!extension_loaded('wincache')) {
         IfwPsn_Vendor_Zend_Cache::throwException('The wincache extension must be loaded for using this backend !');
     }
     parent::__construct($options);
 }
Пример #2
0
 /**
  * Constructor
  *
  * @param  array $options Associative array of options
  * @throws IfwPsn_Vendor_Zend_cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if ($this->_options['cache_db_complete_path'] === null) {
         IfwPsn_Vendor_Zend_Cache::throwException('cache_db_complete_path option has to set');
     }
     if (!extension_loaded('sqlite')) {
         IfwPsn_Vendor_Zend_Cache::throwException("Cannot use SQLite storage because the 'sqlite' extension is not loaded in the current PHP environment");
     }
     $this->_getConnection();
 }
Пример #3
0
 /**
  * Constructor
  * Validate that the Zend Platform is loaded and licensed
  *
  * @param  array $options Associative array of options
  * @throws IfwPsn_Vendor_Zend_Cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     if (!function_exists('accelerator_license_info')) {
         IfwPsn_Vendor_Zend_Cache::throwException('The Zend Platform extension must be loaded for using this backend !');
     }
     if (!function_exists('accelerator_get_configuration')) {
         $licenseInfo = accelerator_license_info();
         IfwPsn_Vendor_Zend_Cache::throwException('The Zend Platform extension is not loaded correctly: ' . $licenseInfo['failure_reason']);
     }
     $accConf = accelerator_get_configuration();
     if (@(!$accConf['output_cache_licensed'])) {
         IfwPsn_Vendor_Zend_Cache::throwException('The Zend Platform extension does not have the proper license to use content caching features');
     }
     if (@(!$accConf['output_cache_enabled'])) {
         IfwPsn_Vendor_Zend_Cache::throwException('The Zend Platform content caching feature must be enabled for using this backend, set the \'zend_accelerator.output_cache_enabled\' directive to On !');
     }
     if (!is_writable($accConf['output_cache_dir'])) {
         IfwPsn_Vendor_Zend_Cache::throwException('The cache copies directory \'' . ini_get('zend_accelerator.output_cache_dir') . '\' must be writable !');
     }
     parent::__construct($options);
 }
Пример #4
0
 /**
  * Retrieve any option via interception of the parent's statically held
  * options including the local option for a tag cache.
  *
  * @param  string $name
  * @return mixed
  */
 public function getOption($name)
 {
     $name = strtolower($name);
     if ($name == 'tag_cache') {
         return $this->getInnerCache();
     }
     return parent::getOption($name);
 }
Пример #5
0
 /**
  * Constructor
  *
  * @param  array $options associative array of options
  * @throws IfwPsn_Vendor_Zend_Cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if ($this->_options['cache_dir'] !== null) {
         // particular case for this option
         $this->setCacheDir($this->_options['cache_dir']);
     } else {
         $this->setCacheDir(self::getTmpDir() . DIRECTORY_SEPARATOR, false);
     }
     if (isset($this->_options['file_name_prefix'])) {
         // particular case for this option
         if (!preg_match('~^[a-zA-Z0-9_]+$~D', $this->_options['file_name_prefix'])) {
             IfwPsn_Vendor_Zend_Cache::throwException('Invalid file_name_prefix : must use only [a-zA-Z0-9_]');
         }
     }
     if ($this->_options['metadatas_array_max_size'] < 10) {
         IfwPsn_Vendor_Zend_Cache::throwException('Invalid metadatas_array_max_size, must be > 10');
     }
     if (isset($options['hashed_directory_umask'])) {
         // See #ZF-12047
         trigger_error("'hashed_directory_umask' is deprecated -> please use 'hashed_directory_perm' instead", E_USER_NOTICE);
         if (!isset($options['hashed_directory_perm'])) {
             $options['hashed_directory_perm'] = $options['hashed_directory_umask'];
         }
     }
     if (isset($options['hashed_directory_perm']) && is_string($options['hashed_directory_perm'])) {
         // See #ZF-4422
         $this->_options['hashed_directory_perm'] = octdec($this->_options['hashed_directory_perm']);
     }
     if (isset($options['cache_file_umask'])) {
         // See #ZF-12047
         trigger_error("'cache_file_umask' is deprecated -> please use 'cache_file_perm' instead", E_USER_NOTICE);
         if (!isset($options['cache_file_perm'])) {
             $options['cache_file_perm'] = $options['cache_file_umask'];
         }
     }
     if (isset($options['cache_file_perm']) && is_string($options['cache_file_perm'])) {
         // See #ZF-4422
         $this->_options['cache_file_perm'] = octdec($this->_options['cache_file_perm']);
     }
 }
Пример #6
0
 /**
  * Set the frontend directives
  *
  * @param  array $directives Assoc of directives
  * @throws IfwPsn_Vendor_Zend_Cache_Exception
  * @return void
  */
 public function setDirectives($directives)
 {
     parent::setDirectives($directives);
     $lifetime = $this->getLifetime(false);
     if ($lifetime > 2592000) {
         // #ZF-3490 : For the memcached backend, there is a lifetime limit of 30 days (2592000 seconds)
         $this->_log('memcached backend has a limit of 30 days (2592000 seconds) for the lifetime');
     }
     if ($lifetime === null) {
         // #ZF-4614 : we tranform null to zero to get the maximal lifetime
         parent::setDirectives(array('lifetime' => 0));
     }
 }
Пример #7
0
 /**
  * Constructor
  *
  * @param  array $options Associative array of options
  * @throws IfwPsn_Vendor_Zend_Cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if ($this->_options['slow_backend'] === null) {
         IfwPsn_Vendor_Zend_Cache::throwException('slow_backend option has to set');
     } elseif ($this->_options['slow_backend'] instanceof IfwPsn_Vendor_Zend_Cache_Backend_ExtendedInterface) {
         $this->_slowBackend = $this->_options['slow_backend'];
     } else {
         $this->_slowBackend = IfwPsn_Vendor_Zend_Cache::_makeBackend($this->_options['slow_backend'], $this->_options['slow_backend_options'], $this->_options['slow_backend_custom_naming'], $this->_options['slow_backend_autoload']);
         if (!in_array('IfwPsn_Vendor_Zend_Cache_Backend_ExtendedInterface', class_implements($this->_slowBackend))) {
             IfwPsn_Vendor_Zend_Cache::throwException('slow_backend must implement the IfwPsn_Vendor_Zend_Cache_Backend_ExtendedInterface interface');
         }
     }
     if ($this->_options['fast_backend'] === null) {
         IfwPsn_Vendor_Zend_Cache::throwException('fast_backend option has to set');
     } elseif ($this->_options['fast_backend'] instanceof IfwPsn_Vendor_Zend_Cache_Backend_ExtendedInterface) {
         $this->_fastBackend = $this->_options['fast_backend'];
     } else {
         $this->_fastBackend = IfwPsn_Vendor_Zend_Cache::_makeBackend($this->_options['fast_backend'], $this->_options['fast_backend_options'], $this->_options['fast_backend_custom_naming'], $this->_options['fast_backend_autoload']);
         if (!in_array('IfwPsn_Vendor_Zend_Cache_Backend_ExtendedInterface', class_implements($this->_fastBackend))) {
             IfwPsn_Vendor_Zend_Cache::throwException('fast_backend must implement the IfwPsn_Vendor_Zend_Cache_Backend_ExtendedInterface interface');
         }
     }
     $this->_slowBackend->setDirectives($this->_directives);
     $this->_fastBackend->setDirectives($this->_directives);
 }