Skip to content
This repository
Browse code

Xcache is not available for php-cli

  • Loading branch information...
commit d2ac734da6835ca7721cf9c05a2d663ea4de1f9a 1 parent 5270721
authored June 08, 2012

Showing 1 changed file with 11 additions and 8 deletions. Show diff stats Hide diff stats

  1. 19  lib/Cake/Cache/Engine/XcacheEngine.php
19  lib/Cake/Cache/Engine/XcacheEngine.php
@@ -45,14 +45,17 @@ class XcacheEngine extends CacheEngine {
45 45
  * @return boolean True if the engine has been successfully initialized, false if not
46 46
  */
47 47
 	public function init($settings = array()) {
48  
-		parent::init(array_merge(array(
49  
-			'engine' => 'Xcache',
50  
-			'prefix' => Inflector::slug(APP_DIR) . '_',
51  
-			'PHP_AUTH_USER' => 'user',
52  
-			'PHP_AUTH_PW' => 'password'
53  
-			), $settings)
54  
-		);
55  
-		return function_exists('xcache_info');
  48
+		if ( php_sapi_name() !== 'cli' ){
  49
+			parent::init(array_merge(array(
  50
+				'engine' => 'Xcache',
  51
+				'prefix' => Inflector::slug(APP_DIR) . '_',
  52
+				'PHP_AUTH_USER' => 'user',
  53
+				'PHP_AUTH_PW' => 'password'
  54
+				), $settings)
  55
+			);
  56
+			return function_exists('xcache_info');
  57
+		}
  58
+		return false;
56 59
 	}
57 60
 
58 61
 /**

0 notes on commit d2ac734

Please sign in to comment.
Something went wrong with that request. Please try again.