import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -15,8 +15,9 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: File.php 17029 2009-07-24 11:57:49Z matthew $
*/
/**
@ -33,7 +34,7 @@ require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@ -103,7 +104,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
*
* @var array
*/
private $_metadatasArray = array();
protected $_metadatasArray = array();
/**
@ -280,7 +281,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
*/
public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
// We use this private method to hide the recursive stuff
// We use this protected method to hide the recursive stuff
clearstatcache();
return $this->_clean($this->_options['cache_dir'], $mode, $tags);
}
@ -468,7 +469,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $id Cache id
* @return array|false Associative array of metadatas
*/
private function _getMetadatas($id)
protected function _getMetadatas($id)
{
if (isset($this->_metadatasArray[$id])) {
return $this->_metadatasArray[$id];
@ -490,7 +491,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param boolean $save optional pass false to disable saving to file
* @return boolean True if no problem
*/
private function _setMetadatas($id, $metadatas, $save = true)
protected function _setMetadatas($id, $metadatas, $save = true)
{
if (count($this->_metadatasArray) >= $this->_options['metadatas_array_max_size']) {
$n = (int) ($this->_options['metadatas_array_max_size'] / 10);
@ -512,7 +513,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $id Cache id
* @return boolean True if no problem
*/
private function _delMetadatas($id)
protected function _delMetadatas($id)
{
if (isset($this->_metadatasArray[$id])) {
unset($this->_metadatasArray[$id]);
@ -526,7 +527,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
*
* @return void
*/
private function _cleanMetadatas()
protected function _cleanMetadatas()
{
$this->_metadatasArray = array();
}
@ -537,7 +538,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $id Cache id
* @return array|false Metadatas associative array
*/
private function _loadMetadatas($id)
protected function _loadMetadatas($id)
{
$file = $this->_metadatasFile($id);
$result = $this->_fileGetContents($file);
@ -555,7 +556,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param array $metadatas Associative array
* @return boolean True if no problem
*/
private function _saveMetadatas($id, $metadatas)
protected function _saveMetadatas($id, $metadatas)
{
$file = $this->_metadatasFile($id);
$result = $this->_filePutContents($file, serialize($metadatas));
@ -571,7 +572,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $id Cache id
* @return string Metadatas file name (with path)
*/
private function _metadatasFile($id)
protected function _metadatasFile($id)
{
$path = $this->_path($id);
$fileName = $this->_idToFileName('internal-metadatas---' . $id);
@ -584,7 +585,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $fileName File name
* @return boolean True if it's a metadatas one
*/
private function _isMetadatasFile($fileName)
protected function _isMetadatasFile($fileName)
{
$id = $this->_fileNameToId($fileName);
if (substr($id, 0, 21) == 'internal-metadatas---') {
@ -603,7 +604,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $file Complete file path
* @return boolean True if ok
*/
private function _remove($file)
protected function _remove($file)
{
if (!is_file($file)) {
return false;
@ -617,7 +618,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
}
/**
* Clean some cache records (private method used for recursive stuff)
* Clean some cache records (protected method used for recursive stuff)
*
* Available modes are :
* Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
@ -635,7 +636,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @throws Zend_Cache_Exception
* @return boolean True if no problem
*/
private function _clean($dir, $mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
protected function _clean($dir, $mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
if (!is_dir($dir)) {
return false;
@ -727,7 +728,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
return $result;
}
private function _get($dir, $mode, $tags = array())
protected function _get($dir, $mode, $tags = array())
{
if (!is_dir($dir)) {
return false;
@ -810,7 +811,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
*
* @return int expire time (unix timestamp)
*/
private function _expireTime($lifetime)
protected function _expireTime($lifetime)
{
if ($lifetime === null) {
return 9999999999;
@ -826,7 +827,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @throws Zend_Cache_Exception
* @return string Control key
*/
private function _hash($data, $controlType)
protected function _hash($data, $controlType)
{
switch ($controlType) {
case 'md5':
@ -848,7 +849,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $id Cache id
* @return string File name
*/
private function _idToFileName($id)
protected function _idToFileName($id)
{
$prefix = $this->_options['file_name_prefix'];
$result = $prefix . '---' . $id;
@ -861,7 +862,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $id Cache id
* @return string File name (with path)
*/
private function _file($id)
protected function _file($id)
{
$path = $this->_path($id);
$fileName = $this->_idToFileName($id);
@ -875,7 +876,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param boolean $parts if true, returns array of directory parts instead of single string
* @return string Complete directory path
*/
private function _path($id, $parts = false)
protected function _path($id, $parts = false)
{
$partsArray = array();
$root = $this->_options['cache_dir'];
@ -900,7 +901,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $id cache id
* @return boolean true
*/
private function _recursiveMkdirAndChmod($id)
protected function _recursiveMkdirAndChmod($id)
{
if ($this->_options['hashed_directory_level'] <=0) {
return true;
@ -922,7 +923,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
* @return boolean|mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
*/
private function _test($id, $doNotTestCacheValidity)
protected function _test($id, $doNotTestCacheValidity)
{
$metadatas = $this->_getMetadatas($id);
if (!$metadatas) {
@ -940,16 +941,12 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $file File complete path
* @return string File content (or false if problem)
*/
private function _fileGetContents($file)
protected function _fileGetContents($file)
{
$result = false;
if (!is_file($file)) {
return false;
}
if (function_exists('get_magic_quotes_runtime')) {
$mqr = @get_magic_quotes_runtime();
@set_magic_quotes_runtime(0);
}
$f = @fopen($file, 'rb');
if ($f) {
if ($this->_options['file_locking']) @flock($f, LOCK_SH);
@ -957,9 +954,6 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
if ($this->_options['file_locking']) @flock($f, LOCK_UN);
@fclose($f);
}
if (function_exists('set_magic_quotes_runtime')) {
@set_magic_quotes_runtime($mqr);
}
return $result;
}
@ -970,7 +964,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $string String to put in file
* @return boolean true if no problem
*/
private function _filePutContents($file, $string)
protected function _filePutContents($file, $string)
{
$result = false;
$f = @fopen($file, 'ab+');
@ -994,7 +988,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
* @param string $fileName File name
* @return string Cache id
*/
private function _fileNameToId($fileName)
protected function _fileNameToId($fileName)
{
$prefix = $this->_options['file_name_prefix'];
return preg_replace('~^' . $prefix . '---(.*)$~', '$1', $fileName);