Permalink
Browse files

Merge pull request #687 from fiblan/xcache_cli

Xcache is not available for php-cli
  • Loading branch information...
2 parents 111a232 + d2ac734 commit 56b2b8a8da1c732e6ede7356883c46eb4c6e6cf2 @lorenzo lorenzo committed Jun 8, 2012
Showing with 11 additions and 8 deletions.
  1. +11 −8 lib/Cake/Cache/Engine/XcacheEngine.php
@@ -45,14 +45,17 @@ class XcacheEngine extends CacheEngine {
* @return boolean True if the engine has been successfully initialized, false if not
*/
public function init($settings = array()) {
- parent::init(array_merge(array(
- 'engine' => 'Xcache',
- 'prefix' => Inflector::slug(APP_DIR) . '_',
- 'PHP_AUTH_USER' => 'user',
- 'PHP_AUTH_PW' => 'password'
- ), $settings)
- );
- return function_exists('xcache_info');
+ if ( php_sapi_name() !== 'cli' ){
+ parent::init(array_merge(array(
+ 'engine' => 'Xcache',
+ 'prefix' => Inflector::slug(APP_DIR) . '_',
+ 'PHP_AUTH_USER' => 'user',
+ 'PHP_AUTH_PW' => 'password'
+ ), $settings)
+ );
+ return function_exists('xcache_info');
+ }
+ return false;
}
/**

0 comments on commit 56b2b8a

Please sign in to comment.