import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Cache_Backend
|
||||
* @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: Backend.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Backend.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -140,77 +140,77 @@ class Zend_Cache_Backend
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine system TMP directory and detect if we have read access
|
||||
*
|
||||
* inspired from Zend_File_Transfer_Adapter_Abstract
|
||||
* inspired from Zend_File_Transfer_Adapter_Abstract
|
||||
*
|
||||
* @return string
|
||||
* @throws Zend_Cache_Exception if unable to determine directory
|
||||
*/
|
||||
public function getTmpDir()
|
||||
{
|
||||
$tmpdir = array();
|
||||
$tmpdir = array();
|
||||
foreach (array($_ENV, $_SERVER) as $tab) {
|
||||
foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
|
||||
if (isset($tab[$key])) {
|
||||
if (($key == 'windir') or ($key == 'SystemRoot')) {
|
||||
foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
|
||||
if (isset($tab[$key])) {
|
||||
if (($key == 'windir') or ($key == 'SystemRoot')) {
|
||||
$dir = realpath($tab[$key] . '\\temp');
|
||||
} else {
|
||||
$dir = realpath($tab[$key]);
|
||||
$dir = realpath($tab[$key]);
|
||||
}
|
||||
if ($this->_isGoodTmpDir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->_isGoodTmpDir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$upload = ini_get('upload_tmp_dir');
|
||||
if ($upload) {
|
||||
$dir = realpath($upload);
|
||||
if ($this->_isGoodTmpDir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
if ($this->_isGoodTmpDir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
if (function_exists('sys_get_temp_dir')) {
|
||||
$dir = sys_get_temp_dir();
|
||||
if ($this->_isGoodTmpDir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
if ($this->_isGoodTmpDir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
// Attemp to detect by creating a temporary file
|
||||
$tempFile = tempnam(md5(uniqid(rand(), TRUE)), '');
|
||||
if ($tempFile) {
|
||||
$dir = realpath(dirname($tempFile));
|
||||
$dir = realpath(dirname($tempFile));
|
||||
unlink($tempFile);
|
||||
if ($this->_isGoodTmpDir($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
if ($this->_isGoodTmpDir('/tmp')) {
|
||||
return '/tmp';
|
||||
return '/tmp';
|
||||
}
|
||||
if ($this->_isGoodTmpDir('\\temp')) {
|
||||
return '\\temp';
|
||||
return '\\temp';
|
||||
}
|
||||
Zend_Cache::throwException('Could not determine temp directory, please specify a cache_dir manually');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verify if the given temporary directory is readable and writable
|
||||
*
|
||||
*
|
||||
* @param $dir temporary directory
|
||||
* @return boolean true if the directory is ok
|
||||
*/
|
||||
protected function _isGoodTmpDir($dir)
|
||||
{
|
||||
if (is_readable($dir)) {
|
||||
if (is_writable($dir)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (is_readable($dir)) {
|
||||
if (is_writable($dir)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,7 +261,7 @@ class Zend_Cache_Backend
|
||||
}
|
||||
|
||||
if (!isset($this->_directives['logger'])) {
|
||||
Zend_Cache::throwException('Logging is enabled but logger is not set.');
|
||||
Zend_Cache::throwException('Logging is enabled but logger is not set.');
|
||||
}
|
||||
$logger = $this->_directives['logger'];
|
||||
if (!$logger instanceof Zend_Log) {
|
||||
|
Reference in New Issue
Block a user