/** * Constructor * Validate that the Zend Platform is loaded and licensed * * @param array $options associative array of options */ public function __construct($options = array()) { if (!function_exists('accelerator_license_info')) { Zend_Cache::throwException('The Zend Platform extension must be loaded for using this backend !'); } if (!function_exists('accelerator_get_configuration')) { $licenseInfo = accelerator_license_info(); Zend_Cache::throwException('The Zend Platform extension is not loaded correctly: ' . $licenseInfo['failure_reason']); } $accConf = accelerator_get_configuration(); if (@(!$accConf['output_cache_licensed'])) { Zend_Cache::throwException('The Zend Platform extension does not have the proper license to use content caching features'); } if (@(!$accConf['output_cache_enabled'])) { 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'])) { Zend_Cache::throwException('The cache copies directory \'' . ini_get('zend_accelerator.output_cache_dir') . '\' must be writable !'); } if (!is_array($options)) { Zend_Cache::throwException('Options parameter must be an array'); } while (list($name, $value) = each($options)) { $this->setOption($name, $value); } }
/** * Check if Zend Platform is available and good to go. * * @return bool */ protected function zendPlatformAvailable() { if (!function_exists('accelerator_license_info')) { Tools::atkdebug('Zend Platform was not detected'); return false; } if (!function_exists('accelerator_get_configuration')) { $licenseInfo = accelerator_license_info(); Tools::atkdebug('The Zend Platform extension is not loaded correctly: ' . $licenseInfo['failure_reason']); return false; } if (!function_exists('monitor_custom_event')) { Tools::atkdebug('Zend Platform seems to be there, but the function \'monitor_custom_event\' could not be found'); return false; } return true; }
/** * Validate that the Zend Platform is loaded and licensed. * * @param array $parameters Parameters. * @return void * @throws \Hoa\Cache\Exception */ public function __construct(array $parameters = []) { if (!function_exists('accelerator_license_info')) { throw new Cache\Exception('The Zend Platform extension must be loaded to use this backend.', 0); } if (!function_exists('accelerator_get_configuration')) { $licenseInfos = accelerator_license_info(); throw new Cache\Exception('The Zend Platform extension is not loaded correctly: %s.', 1, $licenseInfos['failure_reason']); } $configurations = accelerator_get_configuration(); if (@(!$configurations['output_cache_licensed'])) { throw new Cache\Exception('The Zend Platform extension does not have the proper license ' . 'to use content caching features.', 2); } if (@(!$configurations['output_cache_enabled'])) { throw new Cache\Exception('The Zend Platform content caching feature must be enabled to ' . 'use this backend, set the ' . 'zend_accelerator.output_cache_enabled directive to on.', 3); } if (!is_writable($configuration['output_cache_dir'])) { throw new Cache\Exception('The cache copies directory %s must be writable.', 4, $configuration['output_cache_dir']); } parent::__construct($parameters); return; }