--- a/web/lib/Zend/Cache/Core.php Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Cache/Core.php Thu Mar 21 19:50:53 2013 +0100
@@ -14,15 +14,15 @@
*
* @category Zend
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Core.php 22651 2010-07-21 04:19:44Z ramon $
+ * @version $Id: Core.php 24989 2012-06-21 07:24:13Z mabe $
*/
/**
* @package Zend_Cache
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Core
@@ -211,7 +211,7 @@
public function setOption($name, $value)
{
if (!is_string($name)) {
- Zend_Cache::throwException("Incorrect option name : $name");
+ Zend_Cache::throwException("Incorrect option name!");
}
$name = strtolower($name);
if (array_key_exists($name, $this->_options)) {
@@ -235,17 +235,18 @@
*/
public function getOption($name)
{
- if (is_string($name)) {
- $name = strtolower($name);
- if (array_key_exists($name, $this->_options)) {
- // This is a Core option
- return $this->_options[$name];
- }
- if (array_key_exists($name, $this->_specificOptions)) {
- // This a specic option of this frontend
- return $this->_specificOptions[$name];
- }
+ $name = strtolower($name);
+
+ if (array_key_exists($name, $this->_options)) {
+ // This is a Core option
+ return $this->_options[$name];
}
+
+ if (array_key_exists($name, $this->_specificOptions)) {
+ // This a specic option of this frontend
+ return $this->_specificOptions[$name];
+ }
+
Zend_Cache::throwException("Incorrect option name : $name");
}
@@ -300,6 +301,8 @@
$id = $this->_id($id); // cache id may need prefix
$this->_lastId = $id;
self::_validateIdOrTag($id);
+
+ $this->_log("Zend_Cache_Core: load item '{$id}'", 7);
$data = $this->_backend->load($id, $doNotTestCacheValidity);
if ($data===false) {
// no cache available
@@ -326,6 +329,8 @@
$id = $this->_id($id); // cache id may need prefix
self::_validateIdOrTag($id);
$this->_lastId = $id;
+
+ $this->_log("Zend_Cache_Core: test item '{$id}'", 7);
return $this->_backend->test($id);
}
@@ -360,27 +365,22 @@
Zend_Cache::throwException("Datas must be string or set automatic_serialization = true");
}
}
+
// automatic cleaning
if ($this->_options['automatic_cleaning_factor'] > 0) {
$rand = rand(1, $this->_options['automatic_cleaning_factor']);
if ($rand==1) {
- if ($this->_extendedBackend) {
- // New way
- if ($this->_backendCapabilities['automatic_cleaning']) {
- $this->clean(Zend_Cache::CLEANING_MODE_OLD);
- } else {
- $this->_log('Zend_Cache_Core::save() / automatic cleaning is not available/necessary with this backend');
- }
+ // new way || deprecated way
+ if ($this->_extendedBackend || method_exists($this->_backend, 'isAutomaticCleaningAvailable')) {
+ $this->_log("Zend_Cache_Core::save(): automatic cleaning running", 7);
+ $this->clean(Zend_Cache::CLEANING_MODE_OLD);
} else {
- // Deprecated way (will be removed in next major version)
- if (method_exists($this->_backend, 'isAutomaticCleaningAvailable') && ($this->_backend->isAutomaticCleaningAvailable())) {
- $this->clean(Zend_Cache::CLEANING_MODE_OLD);
- } else {
- $this->_log('Zend_Cache_Core::save() / automatic cleaning is not available/necessary with this backend');
- }
+ $this->_log("Zend_Cache_Core::save(): automatic cleaning is not available/necessary with current backend", 4);
}
}
}
+
+ $this->_log("Zend_Cache_Core: save item '{$id}'", 7);
if ($this->_options['ignore_user_abort']) {
$abort = ignore_user_abort(true);
}
@@ -392,22 +392,23 @@
if ($this->_options['ignore_user_abort']) {
ignore_user_abort($abort);
}
+
if (!$result) {
// maybe the cache is corrupted, so we remove it !
- if ($this->_options['logging']) {
- $this->_log("Zend_Cache_Core::save() : impossible to save cache (id=$id)");
- }
- $this->remove($id);
+ $this->_log("Zend_Cache_Core::save(): failed to save item '{$id}' -> removing it", 4);
+ $this->_backend->remove($id);
return false;
}
+
if ($this->_options['write_control']) {
$data2 = $this->_backend->load($id, true);
if ($data!=$data2) {
- $this->_log('Zend_Cache_Core::save() / write_control : written and read data do not match');
+ $this->_log("Zend_Cache_Core::save(): write control of item '{$id}' failed -> removing it", 4);
$this->_backend->remove($id);
return false;
}
}
+
return true;
}
@@ -424,6 +425,8 @@
}
$id = $this->_id($id); // cache id may need prefix
self::_validateIdOrTag($id);
+
+ $this->_log("Zend_Cache_Core: remove item '{$id}'", 7);
return $this->_backend->remove($id);
}
@@ -458,6 +461,7 @@
Zend_Cache::throwException('Invalid cleaning mode');
}
self::_validateTagsArray($tags);
+
return $this->_backend->clean($mode, $tags);
}
@@ -649,6 +653,8 @@
Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
$id = $this->_id($id); // cache id may need prefix
+
+ $this->_log("Zend_Cache_Core: touch item '{$id}'", 7);
return $this->_backend->touch($id, $extraLifetime);
}
@@ -713,9 +719,11 @@
}
// Create a default logger to the standard output stream
+ require_once 'Zend/Log.php';
require_once 'Zend/Log/Writer/Stream.php';
- require_once 'Zend/Log.php';
+ require_once 'Zend/Log/Filter/Priority.php';
$logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
+ $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<='));
$this->_options['logger'] = $logger;
}