From d2ac734da6835ca7721cf9c05a2d663ea4de1f9a Mon Sep 17 00:00:00 2001 From: fiblan Date: Fri, 8 Jun 2012 11:14:22 +0200 Subject: [PATCH] Xcache is not available for php-cli --- lib/Cake/Cache/Engine/XcacheEngine.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/Cake/Cache/Engine/XcacheEngine.php b/lib/Cake/Cache/Engine/XcacheEngine.php index d41cfdb6d..b35bd4590 100644 --- a/lib/Cake/Cache/Engine/XcacheEngine.php +++ b/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; } /**