From 0b48dd40db6a9ddb1382c9e6a1eededf76182dfb Mon Sep 17 00:00:00 2001 From: Burak Erdem Date: Mon, 6 Feb 2012 17:28:33 +0200 Subject: Filesystem cache metadata function return correct TTL now. --- system/libraries/Cache/drivers/Cache_file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 4a81b0422..ff8895724 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -167,13 +167,13 @@ class CI_Cache_file extends CI_Driver { { $mtime = filemtime($this->_cache_path.$id); - if ( ! isset($data['data']['ttl'])) + if ( ! isset($data['ttl'])) { return FALSE; } return array( - 'expire' => $mtime + $data['data']['ttl'], + 'expire' => $mtime + $data['ttl'], 'mtime' => $mtime ); } -- cgit v1.2.3-24-g4f1b From 0688ac9ad88a03f1c56cfcd9e3c475b83301344d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 20 Apr 2012 10:25:04 -0400 Subject: Start comment cleanup of libraries --- system/libraries/Cache/drivers/Cache_file.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index dd27aa90e..ec4195278 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -36,8 +36,16 @@ */ class CI_Cache_file extends CI_Driver { + /** + * Directory in which to save cache files + * + * @var string + */ protected $_cache_path; + /** + * Initialize file-based cache + */ public function __construct() { $CI =& get_instance(); @@ -86,10 +94,10 @@ class CI_Cache_file extends CI_Driver { public function save($id, $data, $ttl = 60) { $contents = array( - 'time' => time(), - 'ttl' => $ttl, - 'data' => $data - ); + 'time' => time(), + 'ttl' => $ttl, + 'data' => $data + ); if (write_file($this->_cache_path.$id, serialize($contents))) { -- cgit v1.2.3-24-g4f1b From 5645479c622eb36cf9869797896dc0921568c4a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:32:19 +0300 Subject: Clean up the libraries --- system/libraries/Cache/drivers/Cache_file.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index ec4195278..f0eb8bdf7 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -45,6 +45,8 @@ class CI_Cache_file extends CI_Driver { /** * Initialize file-based cache + * + * @return void */ public function __construct() { -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Cache/drivers/Cache_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index f0eb8bdf7..ce2c2b13a 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -53,7 +53,7 @@ class CI_Cache_file extends CI_Driver { $CI =& get_instance(); $CI->load->helper('file'); $path = $CI->config->item('cache_path'); - $this->_cache_path = ($path == '') ? APPPATH.'cache/' : $path; + $this->_cache_path = ($path === '') ? APPPATH.'cache/' : $path; } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 0f0b76980cb07f39b20c8591882aeae3854f016c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 14:57:04 +0300 Subject: Deprecated do_hash() and read_file() in favor of hash() and file_get_contents() respectively --- system/libraries/Cache/drivers/Cache_file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index ce2c2b13a..5170de821 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -71,7 +71,7 @@ class CI_Cache_file extends CI_Driver { return FALSE; } - $data = unserialize(read_file($this->_cache_path.$id)); + $data = unserialize(file_get_contents($this->_cache_path.$id)); if (time() > $data['time'] + $data['ttl']) { @@ -165,7 +165,7 @@ class CI_Cache_file extends CI_Driver { return FALSE; } - $data = unserialize(read_file($this->_cache_path.$id)); + $data = unserialize(file_get_contents($this->_cache_path.$id)); if (is_array($data)) { -- cgit v1.2.3-24-g4f1b From c9195a75e7d3d06524c9a5ce97f4f4c30c69019b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 12 Jun 2012 03:49:03 +0300 Subject: Add changelog for pull #1017 --- system/libraries/Cache/drivers/Cache_file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 1b57c8929..08231963e 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -26,7 +26,7 @@ */ /** - * CodeIgniter Memcached Caching Class + * CodeIgniter File Caching Class * * @package CodeIgniter * @subpackage Libraries @@ -202,4 +202,4 @@ class CI_Cache_file extends CI_Driver { } /* End of file Cache_file.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_file.php */ +/* Location: ./system/libraries/Cache/drivers/Cache_file.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From ee112692c0e893dbe1d03b7ee62da6860db7310c Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Thu, 14 Jun 2012 15:32:17 -0300 Subject: A TTL of 0 will keep the cache persistant. --- system/libraries/Cache/drivers/Cache_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 08231963e..028875b7d 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -73,7 +73,7 @@ class CI_Cache_file extends CI_Driver { $data = unserialize(file_get_contents($this->_cache_path.$id)); - if (time() > $data['time'] + $data['ttl']) + if ($data['ttl'] > 0 AND time() > $data['time'] + $data['ttl']) { unlink($this->_cache_path.$id); return FALSE; -- cgit v1.2.3-24-g4f1b From 0159ae7d492cccca7a30a2f5b5c2b107d399e7ea Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 17 Jun 2012 02:33:43 +0300 Subject: AND -> && --- system/libraries/Cache/drivers/Cache_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 028875b7d..37d77c268 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -73,7 +73,7 @@ class CI_Cache_file extends CI_Driver { $data = unserialize(file_get_contents($this->_cache_path.$id)); - if ($data['ttl'] > 0 AND time() > $data['time'] + $data['ttl']) + if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) { unlink($this->_cache_path.$id); return FALSE; -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/libraries/Cache/drivers/Cache_file.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 37d77c268..5d370380e 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -1,4 +1,4 @@ - Date: Mon, 3 Dec 2012 14:37:47 +0200 Subject: [ci skip] Cleaned some spaces --- system/libraries/Cache/drivers/Cache_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 5d370380e..9fd053362 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -74,7 +74,7 @@ class CI_Cache_file extends CI_Driver { $data = unserialize(file_get_contents($this->_cache_path.$id)); - if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) + if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) { unlink($this->_cache_path.$id); return FALSE; -- cgit v1.2.3-24-g4f1b