本文整理汇总了PHP中accelerator_get_configuration函数的典型用法代码示例。如果您正苦于以下问题:PHP accelerator_get_configuration函数的具体用法?PHP accelerator_get_configuration怎么用?PHP accelerator_get_configuration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了accelerator_get_configuration函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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);
}
}
示例2: collect
/**
* {@inheritDoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
// This is needed to support the PHP 5.5 opcache as well as the old ZendOptimizer+-extension.
if (function_exists('opcache_get_status')) {
$status = opcache_get_status();
$config = opcache_get_configuration();
$version = $config['version']['opcache_product_name'] . ' ' . $config['version']['version'];
$stats = $status['opcache_statistics'];
$hitrate = $stats['opcache_hit_rate'];
} elseif (function_exists('accelerator_get_status')) {
$status = accelerator_get_status();
$config = accelerator_get_configuration();
$version = $config['version']['accelerator_product_name'] . ' ' . $config['version']['version'];
$stats = $status['accelerator_statistics'];
$hitrate = $stats['accelerator_hit_rate'];
}
$filelist = array();
if ($this->showFilelist) {
foreach ($status['scripts'] as $key => $data) {
$filelist[$key] = $data;
$filelist[$key]['name'] = basename($key);
}
}
// unset unneeded filelist to lower memory-usage
unset($status['scripts']);
$this->data = array('version' => $version, 'ini' => $config['directives'], 'filelist' => $filelist, 'status' => $status, 'stats' => $stats, 'hitrate' => $hitrate);
}
示例3: __construct
/**
* 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;
}