mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing cache setting when installing a fresh version on a Win box
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5078 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
338a8c8f4b
commit
4aa29a073d
1 changed files with 26 additions and 25 deletions
51
cake/libs/cache/file.php
vendored
51
cake/libs/cache/file.php
vendored
|
@ -25,6 +25,13 @@
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* Included libraries.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if (!class_exists('Folder')) {
|
||||||
|
uses ('folder');
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* File Storage engine for cache
|
* File Storage engine for cache
|
||||||
*
|
*
|
||||||
|
@ -34,21 +41,21 @@
|
||||||
*/
|
*/
|
||||||
class FileEngine extends CacheEngine {
|
class FileEngine extends CacheEngine {
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Cache directory
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_dir = '';
|
var $_dir = '';
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Cache filename prefix
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_prefix = '';
|
var $_prefix = '';
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Use locking
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
var $_lock = false;
|
var $_lock = false;
|
||||||
/**
|
/**
|
||||||
|
@ -65,22 +72,16 @@ class FileEngine extends CacheEngine {
|
||||||
$lock = false;
|
$lock = false;
|
||||||
extract($params);
|
extract($params);
|
||||||
$dir = trim($dir);
|
$dir = trim($dir);
|
||||||
|
$folder =& new Folder();
|
||||||
|
|
||||||
if(strlen($dir) < 1) {
|
if (!empty($dir)) {
|
||||||
|
$dir = $folder->slashTerm($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($dir) || !$folder->isAbsolute($dir) || !is_writable($dir)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($dir{0} != DS) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!is_writable($dir)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($dir{strlen($dir)-1} != DS) {
|
|
||||||
$dir .= DS;
|
|
||||||
}
|
|
||||||
$this->_dir = $dir;
|
$this->_dir = $dir;
|
||||||
$this->_prefix = strval($prefix);
|
$this->_prefix = strval($prefix);
|
||||||
$this->_lock = $lock;
|
$this->_lock = $lock;
|
||||||
|
@ -90,7 +91,7 @@ class FileEngine extends CacheEngine {
|
||||||
* Garbage collection
|
* Garbage collection
|
||||||
* Permanently remove all expired and deleted data
|
* Permanently remove all expired and deleted data
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean True if garbage collection was succesful, false on failure
|
||||||
*/
|
*/
|
||||||
function gc() {
|
function gc() {
|
||||||
return $this->clear(true);
|
return $this->clear(true);
|
||||||
|
@ -124,10 +125,10 @@ class FileEngine extends CacheEngine {
|
||||||
/**
|
/**
|
||||||
* write serialized data to a file
|
* write serialized data to a file
|
||||||
*
|
*
|
||||||
* @param unknown_type $filename
|
* @param string $filename
|
||||||
* @param unknown_type $value
|
* @param string $value
|
||||||
* @param unknown_type $expires
|
* @param integer $expires
|
||||||
* @return unknown
|
* @return boolean True on success, false on failure
|
||||||
*/
|
*/
|
||||||
function _writeCache(&$filename, &$value, &$expires) {
|
function _writeCache(&$filename, &$value, &$expires) {
|
||||||
$contents = $expires."\n".$value."\n";
|
$contents = $expires."\n".$value."\n";
|
||||||
|
@ -172,8 +173,8 @@ class FileEngine extends CacheEngine {
|
||||||
/**
|
/**
|
||||||
* Get the expiry time for a cache file
|
* Get the expiry time for a cache file
|
||||||
*
|
*
|
||||||
* @param unknown_type $filename
|
* @param string $filename
|
||||||
* @return unknown
|
* @return mixed Expiration timestamp, or false on failure
|
||||||
*/
|
*/
|
||||||
function _getExpiry($filename) {
|
function _getExpiry($filename) {
|
||||||
$fp = fopen($filename, 'r');
|
$fp = fopen($filename, 'r');
|
||||||
|
|
Loading…
Reference in a new issue