Skip to content
Extraits de code Groupes Projets
Valider f752716d rédigé par robocoder's avatar robocoder
Parcourir les fichiers

fixes #2282

git-svn-id: http://dev.piwik.org/svn/trunk@4368 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 5a07cbff
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* @subpackage Zend_Cache_Backend * @subpackage Zend_Cache_Backend
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Backend.php 23775 2011-03-01 17:25:24Z ralph $ * @version $Id: Backend.php 23800 2011-03-10 20:52:08Z mabe $
*/ */
...@@ -237,7 +237,9 @@ class Zend_Cache_Backend ...@@ -237,7 +237,9 @@ class Zend_Cache_Backend
// Create a default logger to the standard output stream // Create a default logger to the standard output stream
// require_once 'Zend/Log.php'; // require_once 'Zend/Log.php';
// require_once 'Zend/Log/Writer/Stream.php'; // require_once 'Zend/Log/Writer/Stream.php';
// require_once 'Zend/Log/Filter/Priority.php';
$logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output')); $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
$logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<='));
$this->_directives['logger'] = $logger; $this->_directives['logger'] = $logger;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* @package Zend_Cache * @package Zend_Cache
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Core.php 23775 2011-03-01 17:25:24Z ralph $ * @version $Id: Core.php 23800 2011-03-10 20:52:08Z mabe $
*/ */
...@@ -300,6 +300,8 @@ class Zend_Cache_Core ...@@ -300,6 +300,8 @@ class Zend_Cache_Core
$id = $this->_id($id); // cache id may need prefix $id = $this->_id($id); // cache id may need prefix
$this->_lastId = $id; $this->_lastId = $id;
self::_validateIdOrTag($id); self::_validateIdOrTag($id);
$this->_log("Zend_Cache_Core: load item '{$id}'", 7);
$data = $this->_backend->load($id, $doNotTestCacheValidity); $data = $this->_backend->load($id, $doNotTestCacheValidity);
if ($data===false) { if ($data===false) {
// no cache available // no cache available
...@@ -326,6 +328,8 @@ class Zend_Cache_Core ...@@ -326,6 +328,8 @@ class Zend_Cache_Core
$id = $this->_id($id); // cache id may need prefix $id = $this->_id($id); // cache id may need prefix
self::_validateIdOrTag($id); self::_validateIdOrTag($id);
$this->_lastId = $id; $this->_lastId = $id;
$this->_log("Zend_Cache_Core: test item '{$id}'", 7);
return $this->_backend->test($id); return $this->_backend->test($id);
} }
...@@ -360,27 +364,22 @@ class Zend_Cache_Core ...@@ -360,27 +364,22 @@ class Zend_Cache_Core
Zend_Cache::throwException("Datas must be string or set automatic_serialization = true"); Zend_Cache::throwException("Datas must be string or set automatic_serialization = true");
} }
} }
// automatic cleaning // automatic cleaning
if ($this->_options['automatic_cleaning_factor'] > 0) { if ($this->_options['automatic_cleaning_factor'] > 0) {
$rand = rand(1, $this->_options['automatic_cleaning_factor']); $rand = rand(1, $this->_options['automatic_cleaning_factor']);
if ($rand==1) { if ($rand==1) {
if ($this->_extendedBackend) { // new way || deprecated way
// New way if ($this->_extendedBackend || method_exists($this->_backend, 'isAutomaticCleaningAvailable')) {
if ($this->_backendCapabilities['automatic_cleaning']) { $this->_log("Zend_Cache_Core::save(): automatic cleaning running", 7);
$this->clean(Zend_Cache::CLEANING_MODE_OLD); $this->clean(Zend_Cache::CLEANING_MODE_OLD);
} else {
$this->_log('Zend_Cache_Core::save() / automatic cleaning is not available/necessary with this backend');
}
} else { } else {
// Deprecated way (will be removed in next major version) $this->_log("Zend_Cache_Core::save(): automatic cleaning is not available/necessary with current backend", 4);
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 item '{$id}'", 7);
if ($this->_options['ignore_user_abort']) { if ($this->_options['ignore_user_abort']) {
$abort = ignore_user_abort(true); $abort = ignore_user_abort(true);
} }
...@@ -392,22 +391,23 @@ class Zend_Cache_Core ...@@ -392,22 +391,23 @@ class Zend_Cache_Core
if ($this->_options['ignore_user_abort']) { if ($this->_options['ignore_user_abort']) {
ignore_user_abort($abort); ignore_user_abort($abort);
} }
if (!$result) { if (!$result) {
// maybe the cache is corrupted, so we remove it ! // maybe the cache is corrupted, so we remove it !
if ($this->_options['logging']) { $this->_log("Zend_Cache_Core::save(): failed to save item '{$id}' -> removing it", 4);
$this->_log("Zend_Cache_Core::save() : impossible to save cache (id=$id)");
}
$this->_backend->remove($id); $this->_backend->remove($id);
return false; return false;
} }
if ($this->_options['write_control']) { if ($this->_options['write_control']) {
$data2 = $this->_backend->load($id, true); $data2 = $this->_backend->load($id, true);
if ($data!=$data2) { 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); $this->_backend->remove($id);
return false; return false;
} }
} }
return true; return true;
} }
...@@ -424,6 +424,8 @@ class Zend_Cache_Core ...@@ -424,6 +424,8 @@ class Zend_Cache_Core
} }
$id = $this->_id($id); // cache id may need prefix $id = $this->_id($id); // cache id may need prefix
self::_validateIdOrTag($id); self::_validateIdOrTag($id);
$this->_log("Zend_Cache_Core: remove item '{$id}'", 7);
return $this->_backend->remove($id); return $this->_backend->remove($id);
} }
...@@ -458,6 +460,7 @@ class Zend_Cache_Core ...@@ -458,6 +460,7 @@ class Zend_Cache_Core
Zend_Cache::throwException('Invalid cleaning mode'); Zend_Cache::throwException('Invalid cleaning mode');
} }
self::_validateTagsArray($tags); self::_validateTagsArray($tags);
return $this->_backend->clean($mode, $tags); return $this->_backend->clean($mode, $tags);
} }
...@@ -649,6 +652,8 @@ class Zend_Cache_Core ...@@ -649,6 +652,8 @@ class Zend_Cache_Core
Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
} }
$id = $this->_id($id); // cache id may need prefix $id = $this->_id($id); // cache id may need prefix
$this->_log("Zend_Cache_Core: touch item '{$id}'", 7);
return $this->_backend->touch($id, $extraLifetime); return $this->_backend->touch($id, $extraLifetime);
} }
...@@ -713,9 +718,11 @@ class Zend_Cache_Core ...@@ -713,9 +718,11 @@ class Zend_Cache_Core
} }
// Create a default logger to the standard output stream // Create a default logger to the standard output stream
// require_once 'Zend/Log/Writer/Stream.php';
// require_once 'Zend/Log.php'; // require_once 'Zend/Log.php';
// require_once 'Zend/Log/Writer/Stream.php';
// require_once 'Zend/Log/Filter/Priority.php';
$logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output')); $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; $this->_options['logger'] = $logger;
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* @subpackage Zend_Cache_Frontend * @subpackage Zend_Cache_Frontend
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: File.php 23775 2011-03-01 17:25:24Z ralph $ * @version $Id: File.php 23793 2011-03-02 22:31:05Z mabe $
*/ */
...@@ -110,7 +110,11 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core ...@@ -110,7 +110,11 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
clearstatcache(); clearstatcache();
$i = 0; $i = 0;
foreach ($masterFiles as $masterFile) { foreach ($masterFiles as $masterFile) {
$mtime = @filemtime($masterFile); if (file_exists($masterFile)) {
$mtime = filemtime($masterFile);
} else {
$mtime = false;
}
if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) { if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) {
Zend_Cache::throwException('Unable to read master_file : ' . $masterFile); Zend_Cache::throwException('Unable to read master_file : ' . $masterFile);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* @package Zend_Config * @package Zend_Config
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Yaml.php 23775 2011-03-01 17:25:24Z ralph $ * @version $Id: Yaml.php 23808 2011-03-16 21:26:56Z matthew $
*/ */
/** /**
...@@ -284,7 +284,7 @@ class Zend_Config_Yaml extends Zend_Config ...@@ -284,7 +284,7 @@ class Zend_Config_Yaml extends Zend_Config
$config = array(); $config = array();
$inIndent = false; $inIndent = false;
while (list($n, $line) = each($lines)) { while (list($n, $line) = each($lines)) {
$lineno = $n+1; $lineno = $n + 1;
if (strlen($line) == 0) { if (strlen($line) == 0) {
continue; continue;
} }
...@@ -313,7 +313,7 @@ class Zend_Config_Yaml extends Zend_Config ...@@ -313,7 +313,7 @@ class Zend_Config_Yaml extends Zend_Config
if (preg_match("/(\w+):\s*(.*)/", $line, $m)) { if (preg_match("/(\w+):\s*(.*)/", $line, $m)) {
// key: value // key: value
if ($m[2]) { if (strlen($m[2])) {
// simple key: value // simple key: value
$value = $m[2]; $value = $m[2];
// Check for booleans and constants // Check for booleans and constants
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* @package Zend_Version * @package Zend_Version
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Version.php 23780 2011-03-01 21:23:36Z matthew $ * @version $Id: Version.php 23849 2011-04-06 15:23:21Z matthew $
*/ */
/** /**
...@@ -32,7 +32,7 @@ final class Zend_Version ...@@ -32,7 +32,7 @@ final class Zend_Version
/** /**
* Zend Framework version identification - see compareVersion() * Zend Framework version identification - see compareVersion()
*/ */
const VERSION = '1.11.4'; const VERSION = '1.11.5';
/** /**
* The latest stable version Zend Framework available * The latest stable version Zend Framework available
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter