mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
using the domain cake_error for error messages.
These are error message for developers
This commit is contained in:
parent
b90939f659
commit
2fc8d88916
3 changed files with 25 additions and 25 deletions
|
@ -22,12 +22,12 @@ App::uses('Inflector', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache provides a consistent interface to Caching in your application. It allows you
|
* 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
|
* 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
|
* implementation. It also allows you to change out cache storage or configuration without effecting
|
||||||
* the rest of your application.
|
* the rest of your application.
|
||||||
*
|
*
|
||||||
* You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would
|
* You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would
|
||||||
* be
|
* be
|
||||||
*
|
*
|
||||||
* {{{
|
* {{{
|
||||||
* Cache::config('shared', array(
|
* 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
|
* 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
|
* general all Cache operations are supported by all cache engines. However, Cache::increment() and
|
||||||
* Cache::decrement() are not supported by File caching.
|
* Cache::decrement() are not supported by File caching.
|
||||||
*
|
*
|
||||||
|
@ -143,7 +143,7 @@ class Cache {
|
||||||
}
|
}
|
||||||
$cacheClass = $class . 'Engine';
|
$cacheClass = $class . 'Engine';
|
||||||
if (!is_subclass_of($cacheClass, 'CacheEngine')) {
|
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();
|
self::$_engines[$name] = new $cacheClass();
|
||||||
if (self::$_engines[$name]->init($config)) {
|
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
|
* 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
|
* 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
|
* use the modified settings. If `$settings` is empty, the settings will be reset to the
|
||||||
* original configuration.
|
* original configuration.
|
||||||
*
|
*
|
||||||
* Can be called with 2 or 3 parameters. To set multiple values at once.
|
* 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.
|
* Or to set one value.
|
||||||
*
|
*
|
||||||
|
@ -283,7 +283,7 @@ class Cache {
|
||||||
self::set(null, $config);
|
self::set(null, $config);
|
||||||
if ($success === false && $value !== '') {
|
if ($success === false && $value !== '') {
|
||||||
trigger_error(
|
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
|
E_USER_WARNING
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ class Cache {
|
||||||
*
|
*
|
||||||
* @param string $key Identifier for the data
|
* @param string $key Identifier for the data
|
||||||
* @param integer $offset How much to substract
|
* @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,
|
* @return mixed new value, or false if the data doesn't exist, is not integer,
|
||||||
* or if there was an error fetching it
|
* or if there was an error fetching it
|
||||||
*/
|
*/
|
||||||
|
@ -579,4 +579,4 @@ abstract class CacheEngine {
|
||||||
$key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key)));
|
$key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key)));
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -37,7 +37,7 @@ class FileEngine extends CacheEngine {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings
|
* Settings
|
||||||
*
|
*
|
||||||
* - path = absolute path to cache directory, default => CACHE
|
* - path = absolute path to cache directory, default => CACHE
|
||||||
* - prefix = string prefix for filename, default => cake_
|
* - prefix = string prefix for filename, default => cake_
|
||||||
* - lock = enable file locking on write, default => false
|
* - 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)) {
|
if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = '';
|
$data = '';
|
||||||
$this->_File->next();
|
$this->_File->next();
|
||||||
while ($this->_File->valid()) {
|
while ($this->_File->valid()) {
|
||||||
|
@ -251,7 +251,7 @@ class FileEngine extends CacheEngine {
|
||||||
* @throws CacheException
|
* @throws CacheException
|
||||||
*/
|
*/
|
||||||
public function decrement($key, $offset = 1) {
|
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
|
* @throws CacheException
|
||||||
*/
|
*/
|
||||||
public function increment($key, $offset = 1) {
|
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']);
|
$dir = new SplFileInfo($this->settings['path']);
|
||||||
if ($this->_init && !($dir->isDir() && $dir->isWritable())) {
|
if ($this->_init && !($dir->isDir() && $dir->isWritable())) {
|
||||||
$this->_init = false;
|
$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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
* control you have over expire times far in the future. See MemcacheEngine::write() for
|
||||||
* more information.
|
* more information.
|
||||||
*
|
*
|
||||||
|
@ -61,8 +61,8 @@ class MemcacheEngine extends CacheEngine {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
parent::init(array_merge(array(
|
parent::init(array_merge(array(
|
||||||
'engine'=> 'Memcache',
|
'engine'=> 'Memcache',
|
||||||
'prefix' => Inflector::slug(APP_DIR) . '_',
|
'prefix' => Inflector::slug(APP_DIR) . '_',
|
||||||
'servers' => array('127.0.0.1'),
|
'servers' => array('127.0.0.1'),
|
||||||
'compress'=> false
|
'compress'=> false
|
||||||
), $settings)
|
), $settings)
|
||||||
|
@ -115,7 +115,7 @@ class MemcacheEngine extends CacheEngine {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write data for key into cache. When using memcache as your cache engine
|
* 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.
|
* 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
|
* @param string $key Identifier for the data
|
||||||
|
@ -153,7 +153,7 @@ class MemcacheEngine extends CacheEngine {
|
||||||
public function increment($key, $offset = 1) {
|
public function increment($key, $offset = 1) {
|
||||||
if ($this->settings['compress']) {
|
if ($this->settings['compress']) {
|
||||||
throw new CacheException(
|
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);
|
return $this->_Memcache->increment($key, $offset);
|
||||||
|
@ -171,7 +171,7 @@ class MemcacheEngine extends CacheEngine {
|
||||||
public function decrement($key, $offset = 1) {
|
public function decrement($key, $offset = 1) {
|
||||||
if ($this->settings['compress']) {
|
if ($this->settings['compress']) {
|
||||||
throw new CacheException(
|
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);
|
return $this->_Memcache->decrement($key, $offset);
|
||||||
|
@ -212,4 +212,4 @@ class MemcacheEngine extends CacheEngine {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue