Browse Source

using the domain cake_error for error messages.

These are error message for developers
AD7six 15 years ago
parent
commit
2fc8d88916

+ 12 - 12
lib/Cake/Cache/Cache.php

@@ -22,12 +22,12 @@ App::uses('Inflector', 'Utility');
 
 /**
  * Cache provides a consistent interface to Caching in your application. It allows you
- * to use several different Cache engines, without coupling your application to a specific 
- * implementation.  It also allows you to change out cache storage or configuration without effecting 
+ * to use several different Cache engines, without coupling your application to a specific
+ * implementation.  It also allows you to change out cache storage or configuration without effecting
  * the rest of your application.
  *
- * You can configure Cache engines in your application's `bootstrap.php` file.  A sample configuration would 
- * be 
+ * You can configure Cache engines in your application's `bootstrap.php` file.  A sample configuration would
+ * be
  *
  * {{{
  *	Cache::config('shared', array(
@@ -37,7 +37,7 @@ App::uses('Inflector', 'Utility');
  * }}}
  *
  * This would configure an APC cache engine to the 'shared' alias.  You could then read and write
- * to that cache alias by using it for the `$config` parameter in the various Cache methods.  In 
+ * to that cache alias by using it for the `$config` parameter in the various Cache methods.  In
  * general all Cache operations are supported by all cache engines.  However, Cache::increment() and
  * Cache::decrement() are not supported by File caching.
  *
@@ -143,7 +143,7 @@ class Cache {
 		}
 		$cacheClass = $class . 'Engine';
 		if (!is_subclass_of($cacheClass, 'CacheEngine')) {
-			throw new CacheException(__d('cake', 'Cache engines must use CacheEngine as a base class.'));
+			throw new CacheException(__d('cake_error', 'Cache engines must use CacheEngine as a base class.'));
 		}
 		self::$_engines[$name] = new $cacheClass();
 		if (self::$_engines[$name]->init($config)) {
@@ -182,13 +182,13 @@ class Cache {
 
 /**
  * Temporarily change the settings on a cache config.  The settings will persist for the next write
- * operation (write, decrement, increment, clear). Any reads that are done before the write, will 
- * use the modified settings. If `$settings` is empty, the settings will be reset to the 
+ * operation (write, decrement, increment, clear). Any reads that are done before the write, will
+ * use the modified settings. If `$settings` is empty, the settings will be reset to the
  * original configuration.
  *
  * Can be called with 2 or 3 parameters. To set multiple values at once.
  *
- * `Cache::set(array('duration' => '+30 minutes'), 'my_config');` 
+ * `Cache::set(array('duration' => '+30 minutes'), 'my_config');`
  *
  * Or to set one value.
  *
@@ -283,7 +283,7 @@ class Cache {
 		self::set(null, $config);
 		if ($success === false && $value !== '') {
 			trigger_error(
-				__d('cake', "%s cache was unable to write '%s' to cache", $config, $key),
+				__d('cake_error', "%s cache was unable to write '%s' to cache", $config, $key),
 				E_USER_WARNING
 			);
 		}
@@ -357,7 +357,7 @@ class Cache {
  *
  * @param string $key Identifier for the data
  * @param integer $offset How much to substract
- * @param string $config Optional string configuration name. Defaults to 'default' 
+ * @param string $config Optional string configuration name. Defaults to 'default'
  * @return mixed new value, or false if the data doesn't exist, is not integer,
  *   or if there was an error fetching it
  */
@@ -579,4 +579,4 @@ abstract class CacheEngine {
 		$key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key)));
 		return $key;
 	}
-}
+}

+ 6 - 6
lib/Cake/Cache/Engine/FileEngine.php

@@ -37,7 +37,7 @@ class FileEngine extends CacheEngine {
 
 /**
  * Settings
- * 
+ *
  * - path = absolute path to cache directory, default => CACHE
  * - prefix = string prefix for filename, default => cake_
  * - lock = enable file locking on write, default => false
@@ -162,7 +162,7 @@ class FileEngine extends CacheEngine {
 		if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
 			return false;
 		}
-		
+
 		$data = '';
 		$this->_File->next();
 		while ($this->_File->valid()) {
@@ -251,7 +251,7 @@ class FileEngine extends CacheEngine {
  * @throws CacheException
  */
 	public function decrement($key, $offset = 1) {
-		throw new CacheException(__d('cake', 'Files cannot be atomically decremented.'));
+		throw new CacheException(__d('cake_error', 'Files cannot be atomically decremented.'));
 	}
 
 /**
@@ -261,7 +261,7 @@ class FileEngine extends CacheEngine {
  * @throws CacheException
  */
 	public function increment($key, $offset = 1) {
-		throw new CacheException(__d('cake', 'Files cannot be atomically incremented.'));
+		throw new CacheException(__d('cake_error', 'Files cannot be atomically incremented.'));
 	}
 
 /**
@@ -297,9 +297,9 @@ class FileEngine extends CacheEngine {
 		$dir = new SplFileInfo($this->settings['path']);
 		if ($this->_init && !($dir->isDir() && $dir->isWritable())) {
 			$this->_init = false;
-			trigger_error(__d('cake', '%s is not writable', $this->settings['path']), E_USER_WARNING);
+			trigger_error(__d('cake_error', '%s is not writable', $this->settings['path']), E_USER_WARNING);
 			return false;
 		}
 		return true;
 	}
-}
+}

+ 7 - 7
lib/Cake/Cache/Engine/MemcacheEngine.php

@@ -19,7 +19,7 @@
  */
 
 /**
- * Memcache storage engine for cache.  Memcache has some limitations in the amount of 
+ * Memcache storage engine for cache.  Memcache has some limitations in the amount of
  * control you have over expire times far in the future.  See MemcacheEngine::write() for
  * more information.
  *
@@ -61,8 +61,8 @@ class MemcacheEngine extends CacheEngine {
 			return false;
 		}
 		parent::init(array_merge(array(
-			'engine'=> 'Memcache', 
-			'prefix' => Inflector::slug(APP_DIR) . '_', 
+			'engine'=> 'Memcache',
+			'prefix' => Inflector::slug(APP_DIR) . '_',
 			'servers' => array('127.0.0.1'),
 			'compress'=> false
 			), $settings)
@@ -115,7 +115,7 @@ class MemcacheEngine extends CacheEngine {
 
 /**
  * Write data for key into cache.  When using memcache as your cache engine
- * remember that the Memcache pecl extension does not support cache expiry times greater 
+ * remember that the Memcache pecl extension does not support cache expiry times greater
  * than 30 days in the future. Any duration greater than 30 days will be treated as never expiring.
  *
  * @param string $key Identifier for the data
@@ -153,7 +153,7 @@ class MemcacheEngine extends CacheEngine {
 	public function increment($key, $offset = 1) {
 		if ($this->settings['compress']) {
 			throw new CacheException(
-				__d('cake', 'Method increment() not implemented for compressed cache in %s', __CLASS__)
+				__d('cake_error', 'Method increment() not implemented for compressed cache in %s', __CLASS__)
 			);
 		}
 		return $this->_Memcache->increment($key, $offset);
@@ -171,7 +171,7 @@ class MemcacheEngine extends CacheEngine {
 	public function decrement($key, $offset = 1) {
 		if ($this->settings['compress']) {
 			throw new CacheException(
-				__d('cake', 'Method decrement() not implemented for compressed cache in %s', __CLASS__)
+				__d('cake_error', 'Method decrement() not implemented for compressed cache in %s', __CLASS__)
 			);
 		}
 		return $this->_Memcache->decrement($key, $offset);
@@ -212,4 +212,4 @@ class MemcacheEngine extends CacheEngine {
 		}
 		return true;
 	}
-}
+}