From a2097a077474eab1b9d35acc2c93f0e99a7f12d0 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 10 Oct 2011 10:10:46 -0400 Subject: Converted database constructors to PHP5 type --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 3bf065ca5..ad1c28d72 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -33,7 +33,7 @@ class CI_DB_Cache { * Grabs the CI super object instance so we can access it. * */ - function CI_DB_Cache(&$db) + function __construct(&$db) { // Assign the main CI object to $this->CI // and load the file helper since we use it a lot -- cgit v1.2.3-24-g4f1b From f4a4bd8fac188ebc9cda822ffc811c218fd92b45 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Thu, 20 Oct 2011 12:18:42 -0500 Subject: adding new license file (OSL 3.0) and updating readme to ReST added notice of license to all source files. OSL to all except the few files we ship inside of the application folder, those are AFL. Updated license in user guide. incrementing next dev version to 3.0 due to licensing change --- system/database/DB_cache.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index ad1c28d72..6c1ffc0f3 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -4,10 +4,22 @@ * * An open source application development framework for PHP 5.1.6 or newer * + * NOTICE OF LICENSE + * + * Licensed under the Open Software License version 3.0 + * + * This source file is subject to the Open Software License (OSL 3.0) that is + * bundled with this package in the files license.txt / license.rst. It is + * also available through the world wide web at this URL: + * http://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to obtain it + * through the world wide web, please send an email to + * licensing@ellislab.com so we can send you a copy immediately. + * * @package CodeIgniter - * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. - * @license http://codeigniter.com/user_guide/license.html + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 * @filesource @@ -19,7 +31,7 @@ * Database Cache Class * * @category Database - * @author ExpressionEngine Dev Team + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ class CI_DB_Cache { -- cgit v1.2.3-24-g4f1b From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 6c1ffc0f3..1ff046c21 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 24276a3a204ddf5947c66bd74f183d8058c1171e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 02:44:38 +0200 Subject: Improve database classes --- system/database/DB_cache.php | 49 +++++++++++++------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 1ff046c21..79651fcb0 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -1,13 +1,13 @@ -CI - // and load the file helper since we use it a lot + // Assign the main CI object to $this->CI and load the file helper since we use it a lot $this->CI =& get_instance(); $this->db =& $db; $this->CI->load->helper('file'); @@ -59,11 +50,10 @@ class CI_DB_Cache { /** * Set Cache Directory Path * - * @access public * @param string the path to the cache directory * @return bool */ - function check_path($path = '') + public function check_path($path = '') { if ($path == '') { @@ -76,7 +66,7 @@ class CI_DB_Cache { } // Add a trailing slash to the path if needed - $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); + $path = preg_replace('/(.+?)\/*$/', '\\1/', $path); if ( ! is_dir($path) OR ! is_really_writable($path)) { @@ -96,10 +86,9 @@ class CI_DB_Cache { * The URI being requested will become the name of the cache sub-folder. * An MD5 hash of the SQL statement will become the cache file name * - * @access public * @return string */ - function read($sql) + public function read($sql) { if ( ! $this->check_path()) { @@ -107,9 +96,7 @@ class CI_DB_Cache { } $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); - $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); if (FALSE === ($cachedata = read_file($filepath))) @@ -125,10 +112,9 @@ class CI_DB_Cache { /** * Write a query to a cache file * - * @access public * @return bool */ - function write($sql, $object) + public function write($sql, $object) { if ( ! $this->check_path()) { @@ -136,11 +122,8 @@ class CI_DB_Cache { } $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); - $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; - $filename = md5($sql); if ( ! @is_dir($dir_path)) @@ -167,10 +150,9 @@ class CI_DB_Cache { /** * Delete cache files within a particular directory * - * @access public * @return bool */ - function delete($segment_one = '', $segment_two = '') + public function delete($segment_one = '', $segment_two = '') { if ($segment_one == '') { @@ -183,7 +165,6 @@ class CI_DB_Cache { } $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; - delete_files($dir_path, TRUE); } @@ -192,16 +173,14 @@ class CI_DB_Cache { /** * Delete all existing cache files * - * @access public * @return bool */ - function delete_all() + public function delete_all() { delete_files($this->db->cachedir, TRUE); } } - /* End of file DB_cache.php */ -/* Location: ./system/database/DB_cache.php */ \ No newline at end of file +/* Location: ./system/database/DB_cache.php */ -- cgit v1.2.3-24-g4f1b From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 79651fcb0..fb0cfa89a 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From 215890b015d219f0d31e8ad678b0b655e6923f3b Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 20 Mar 2012 09:38:16 -0400 Subject: Remove extraneous newlines --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index fb0cfa89a..58e6968c0 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -183,4 +183,4 @@ class CI_DB_Cache { } /* End of file DB_cache.php */ -/* Location: ./system/database/DB_cache.php */ +/* Location: ./system/database/DB_cache.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From fd6c2bc7ed0ce474ac08fefb3efe88288368da98 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 3 Apr 2012 16:21:48 +0300 Subject: Fix issue #1238 --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 58e6968c0..ff942856b 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -177,7 +177,7 @@ class CI_DB_Cache { */ public function delete_all() { - delete_files($this->db->cachedir, TRUE); + delete_files($this->db->cachedir, TRUE, 0, TRUE); } } -- cgit v1.2.3-24-g4f1b From 48a2baf0e288accd206f5da5031d29076e130792 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:09:54 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/database --- system/database/DB_cache.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index ff942856b..443bbce5f 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -55,9 +55,9 @@ class CI_DB_Cache { */ public function check_path($path = '') { - if ($path == '') + if ($path === '') { - if ($this->db->cachedir == '') + if ($this->db->cachedir === '') { return $this->db->cache_off(); } @@ -95,8 +95,8 @@ class CI_DB_Cache { return $this->db->cache_off(); } - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); if (FALSE === ($cachedata = read_file($filepath))) @@ -121,8 +121,8 @@ class CI_DB_Cache { return $this->db->cache_off(); } - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; $filename = md5($sql); @@ -154,14 +154,14 @@ class CI_DB_Cache { */ public function delete($segment_one = '', $segment_two = '') { - if ($segment_one == '') + if ($segment_one === '') { - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); } - if ($segment_two == '') + if ($segment_two === '') { - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); } $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; -- cgit v1.2.3-24-g4f1b From e4c30195c5f6dc7a144cfe4ee160b18626626612 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 Jun 2012 15:08:24 +0300 Subject: Revert/optimize some changes from 48a2baf0e288accd206f5da5031d29076e130792 --- system/database/DB_cache.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 443bbce5f..14f3c21bc 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -95,8 +95,8 @@ class CI_DB_Cache { return $this->db->cache_off(); } - $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); if (FALSE === ($cachedata = read_file($filepath))) @@ -121,8 +121,8 @@ class CI_DB_Cache { return $this->db->cache_off(); } - $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; $filename = md5($sql); @@ -156,12 +156,12 @@ class CI_DB_Cache { { if ($segment_one === '') { - $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); } if ($segment_two === '') { - $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); } $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; -- 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/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 14f3c21bc..ba9110382 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -99,7 +99,7 @@ class CI_DB_Cache { $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); - if (FALSE === ($cachedata = read_file($filepath))) + if (FALSE === ($cachedata = file_get_contents($filepath))) { return FALSE; } -- cgit v1.2.3-24-g4f1b From 256a18c50f0c042ae80d931ab3bd54b09f0fafa0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 23 Oct 2012 12:18:32 +0300 Subject: Fix issues #134, #1911 --- system/database/DB_cache.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index ba9110382..bdd91867a 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -43,6 +43,8 @@ class CI_DB_Cache { $this->CI =& get_instance(); $this->db =& $db; $this->CI->load->helper('file'); + + $this->check_path(); } // -------------------------------------------------------------------- @@ -66,7 +68,9 @@ class CI_DB_Cache { } // Add a trailing slash to the path if needed - $path = preg_replace('/(.+?)\/*$/', '\\1/', $path); + $path = realpath($path) + ? rtrim(realpath($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR + : rtrim($path, '/').'/'; if ( ! is_dir($path) OR ! is_really_writable($path)) { @@ -90,11 +94,6 @@ class CI_DB_Cache { */ public function read($sql) { - if ( ! $this->check_path()) - { - return $this->db->cache_off(); - } - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); @@ -116,11 +115,6 @@ class CI_DB_Cache { */ public function write($sql, $object) { - if ( ! $this->check_path()) - { - return $this->db->cache_off(); - } - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; -- cgit v1.2.3-24-g4f1b From 5fd3ae8d33a4f5d3159b86683b9a670e973a63f5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 14:55:35 +0300 Subject: [ci skip] style and phpdoc-related changes (rel #1295) --- system/database/DB_cache.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index bdd91867a..671147b3d 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -37,6 +37,12 @@ class CI_DB_Cache { public $CI; public $db; // allows passing of db object so that multiple database connections and returned db objects can be supported + /** + * Constructor + * + * @param &$db + * @return void + */ public function __construct(&$db) { // Assign the main CI object to $this->CI and load the file helper since we use it a lot @@ -90,6 +96,7 @@ class CI_DB_Cache { * The URI being requested will become the name of the cache sub-folder. * An MD5 hash of the SQL statement will become the cache file name * + * @param string $sql * @return string */ public function read($sql) @@ -111,6 +118,8 @@ class CI_DB_Cache { /** * Write a query to a cache file * + * @param string $sql + * @param object $object * @return bool */ public function write($sql, $object) @@ -144,7 +153,9 @@ class CI_DB_Cache { /** * Delete cache files within a particular directory * - * @return bool + * @param string $segment_one = '' + * @param string $segment_two = '' + * @return void */ public function delete($segment_one = '', $segment_two = '') { @@ -167,7 +178,7 @@ class CI_DB_Cache { /** * Delete all existing cache files * - * @return bool + * @return void */ public function delete_all() { -- cgit v1.2.3-24-g4f1b From 6df461a84a1915759111a1dce893c628bf805219 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 14:57:37 +0300 Subject: [ci skip] Fix a docblock --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 671147b3d..d07c755c6 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -40,7 +40,7 @@ class CI_DB_Cache { /** * Constructor * - * @param &$db + * @param object &$db * @return void */ public function __construct(&$db) -- 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/database/DB_cache.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index d07c755c6..37d2dd0b5 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -1,4 +1,4 @@ - Date: Fri, 2 Nov 2012 01:42:31 +0200 Subject: DocBlocks for base DB classes Partially fixes issue #1295. --- system/database/DB_cache.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 37d2dd0b5..b8f8995fa 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -35,8 +35,24 @@ defined('BASEPATH') OR exit('No direct script access allowed'); */ class CI_DB_Cache { + /** + * CI Singleton + * + * @var object + */ public $CI; - public $db; // allows passing of db object so that multiple database connections and returned db objects can be supported + + /** + * Database object + * + * Allows passing of DB object so that multiple database connections + * and returned DB objects can be supported. + * + * @var object + */ + public $db; + + // -------------------------------------------------------------------- /** * Constructor @@ -59,7 +75,7 @@ class CI_DB_Cache { /** * Set Cache Directory Path * - * @param string the path to the cache directory + * @param string $path Path to the cache directory * @return bool */ public function check_path($path = '') @@ -95,7 +111,7 @@ class CI_DB_Cache { * Retrieve a cached query * * The URI being requested will become the name of the cache sub-folder. - * An MD5 hash of the SQL statement will become the cache file name + * An MD5 hash of the SQL statement will become the cache file name. * * @param string $sql * @return string @@ -154,8 +170,8 @@ class CI_DB_Cache { /** * Delete cache files within a particular directory * - * @param string $segment_one = '' - * @param string $segment_two = '' + * @param string $segment_one + * @param string $segment_two * @return void */ public function delete($segment_one = '', $segment_two = '') -- cgit v1.2.3-24-g4f1b From 53b8ef524529e6ca9f32ad49d36c5140df84feb0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 8 Nov 2012 21:38:53 +0200 Subject: Polish docs for HTML, Inflector, Language, Number, Path, Security and Smiley helpers Also fixed a DB_cache bug introduced in previous commit and removed an unused parameter in a smiley helper --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index b8f8995fa..1be80c5c7 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -199,7 +199,7 @@ class CI_DB_Cache { */ public function delete_all() { - delete_files($this->db->cachedir, TRUE, 0, TRUE); + delete_files($this->db->cachedir, TRUE, TRUE); } } -- cgit v1.2.3-24-g4f1b From 83b2b1cd75d85d78ddcae1f9716984d8acdd7ca6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 13 Nov 2012 10:58:38 +0200 Subject: Fix some DB_cache-related issues http://codeigniter.com/forums/viewthread/229610/ --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 1be80c5c7..db7636450 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -122,7 +122,7 @@ class CI_DB_Cache { $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); - if (FALSE === ($cachedata = file_get_contents($filepath))) + if (FALSE === ($cachedata = @file_get_contents($filepath))) { return FALSE; } -- cgit v1.2.3-24-g4f1b From 51c0b55a235ebcac022d6f5576c209edf98c38fe Mon Sep 17 00:00:00 2001 From: Brian Gottier Date: Tue, 13 Nov 2012 18:47:19 -0800 Subject: Better debugging for DB Cache path --- system/database/DB_cache.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index db7636450..d023db979 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -95,12 +95,22 @@ class CI_DB_Cache { ? rtrim(realpath($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : rtrim($path, '/').'/'; - if ( ! is_dir($path) OR ! is_really_writable($path)) + if ( ! is_dir($path)) { + log_message('debug', 'Cache Path Error: '.$path); + // If the path is wrong we'll turn off caching return $this->db->cache_off(); } + if ( ! is_really_writable($path)) + { + log_message('debug', 'Cache Dir Not Writable: '.$path); + + // If the path is not really writable we'll turn off caching + return $this->db->cache_off(); + } + $this->db->cachedir = $path; return TRUE; } -- cgit v1.2.3-24-g4f1b From 4a18c9505040f5b0fc1129ec7f167baeae016080 Mon Sep 17 00:00:00 2001 From: Brian Gottier Date: Wed, 14 Nov 2012 07:40:55 -0800 Subject: Changes per narfbg --- system/database/DB_cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index d023db979..fd01dc2d8 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -97,7 +97,7 @@ class CI_DB_Cache { if ( ! is_dir($path)) { - log_message('debug', 'Cache Path Error: '.$path); + log_message('debug', 'DB cache path error: '.$path); // If the path is wrong we'll turn off caching return $this->db->cache_off(); @@ -105,7 +105,7 @@ class CI_DB_Cache { if ( ! is_really_writable($path)) { - log_message('debug', 'Cache Dir Not Writable: '.$path); + log_message('debug', 'DB cache dir not writable: '.$path); // If the path is not really writable we'll turn off caching return $this->db->cache_off(); -- cgit v1.2.3-24-g4f1b From 80500afbd188600212ca913a7bac073009feac73 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 1 Jan 2013 08:16:53 +0200 Subject: [ci skip] Happy new year --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index fd01dc2d8..921e68655 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 871754af60251993d640981e107d2def5f2db396 Mon Sep 17 00:00:00 2001 From: darwinel Date: Tue, 11 Feb 2014 17:34:57 +0100 Subject: 2013 > 2014 Update copyright notices from 2013 to 2014. And update one calendar example in user_guide from year 2013/2014 to 2014/2015. --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 921e68655..0ef0ae52f 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 382b51383c84fbb7f861fcd87b0b71b35c9f2869 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 26 Feb 2014 18:41:59 +0200 Subject: Don't use error suppression on is_dir(), file_exists() --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 0ef0ae52f..0ab9c5d6b 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -156,7 +156,7 @@ class CI_DB_Cache { $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; $filename = md5($sql); - if ( ! @is_dir($dir_path)) + if ( ! is_dir($dir_path)) { if ( ! @mkdir($dir_path, DIR_WRITE_MODE)) { -- cgit v1.2.3-24-g4f1b From 7cf682abf46bcaa112b63c500a884ba25c0dd8b3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 13 Mar 2014 14:55:45 +0200 Subject: Partially revert PR #2190 The core shouldn't depend on constants that are not defined by itself --- system/database/DB_cache.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 0ab9c5d6b..b855ff24e 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -158,12 +158,12 @@ class CI_DB_Cache { if ( ! is_dir($dir_path)) { - if ( ! @mkdir($dir_path, DIR_WRITE_MODE)) + if ( ! @mkdir($dir_path, 0777)) { return FALSE; } - @chmod($dir_path, DIR_WRITE_MODE); + @chmod($dir_path, 0777); } if (write_file($dir_path.$filename, serialize($object)) === FALSE) @@ -171,7 +171,7 @@ class CI_DB_Cache { return FALSE; } - @chmod($dir_path.$filename, FILE_WRITE_MODE); + @chmod($dir_path.$filename, 0666); return TRUE; } -- cgit v1.2.3-24-g4f1b From 459657415189f4fe3f8d4eb05b209ab78409f9b0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Aug 2014 20:40:11 +0300 Subject: Fix #2963 Changed all file permissions settings throught the framework and the documentation. Also added configuration settings for CI_Log and CI_Image_lib --- system/database/DB_cache.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index b855ff24e..2efb42c5c 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -156,14 +156,9 @@ class CI_DB_Cache { $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; $filename = md5($sql); - if ( ! is_dir($dir_path)) + if ( ! is_dir($dir_path) && ! @mkdir($dir_path, 0750)) { - if ( ! @mkdir($dir_path, 0777)) - { - return FALSE; - } - - @chmod($dir_path, 0777); + return FALSE; } if (write_file($dir_path.$filename, serialize($object)) === FALSE) @@ -171,7 +166,7 @@ class CI_DB_Cache { return FALSE; } - @chmod($dir_path.$filename, 0666); + chmod($dir_path.$filename, 0640); return TRUE; } -- cgit v1.2.3-24-g4f1b From bdb96ca1b1dbfc1791172fd169d7751cbc4d7d55 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Oct 2014 00:13:31 +0200 Subject: [ci skip] Switch to MIT license; close #3293 --- system/database/DB_cache.php | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 2efb42c5c..f5af19010 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -4,24 +4,35 @@ * * An open source application development framework for PHP 5.2.4 or newer * - * NOTICE OF LICENSE + * This content is released under the MIT License (MIT) * - * Licensed under the Open Software License version 3.0 + * Copyright (c) 2014, British Columbia Institute of Technology * - * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is - * also available through the world wide web at this URL: - * http://opensource.org/licenses/OSL-3.0 - * If you did not receive a copy of the license and are unable to obtain it - * through the world wide web, please send an email to - * licensing@ellislab.com so we can send you a copy immediately. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * @package CodeIgniter - * @author EllisLab Dev Team + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - * @link http://codeigniter.com - * @since Version 1.0 + * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); -- cgit v1.2.3-24-g4f1b From fe9309d22c1b088f5363954d6dac013c8c955894 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Jan 2015 17:48:58 +0200 Subject: Bulk (mostly documentation) update - Remove PHP version from license notices - Bump year number in copyright notices - Recommend PHP 5.4 or newer to be used - Tell Travis-CI to test on PHP 5.3.0 instead of the latest 5.3 version Related: #3450 --- system/database/DB_cache.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index f5af19010..8f5317293 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 4cbe463b4c442e0e2dae2f43565e77f7ac5ecb86 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 21 Jan 2015 22:56:22 +0100 Subject: Remove closing blocks at end of PHP files --- system/database/DB_cache.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 8f5317293..223055f60 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -219,6 +219,3 @@ class CI_DB_Cache { } } - -/* End of file DB_cache.php */ -/* Location: ./system/database/DB_cache.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 125ef4751080a2118cb203357d77687699e3eb25 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:33:00 +0200 Subject: [ci skip] Bump year to 2016 --- system/database/DB_cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 223055f60..134737e31 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology + * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From bd202c91b0e9cf0a8c93bcaa71df9574f5909346 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:50:18 +0200 Subject: [ci skip] Update codeigniter.com links to https --- system/database/DB_cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 134737e31..f31a8e2fb 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -31,7 +31,7 @@ * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com + * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ @@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * * @category Database * @author EllisLab Dev Team - * @link http://codeigniter.com/user_guide/database/ + * @link https://codeigniter.com/user_guide/database/ */ class CI_DB_Cache { -- cgit v1.2.3-24-g4f1b From 1924e879b165fb119847a49a7a5eab2f28295fa2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:55:34 +0200 Subject: [ci skip] Update ellislab.com links to https too --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index f31a8e2fb..8855cc1b1 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -28,7 +28,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com -- cgit v1.2.3-24-g4f1b From da60e9bc66ec90970fbd2dfd08b0a6e66b9f5f5f Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/database/DB_cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 8855cc1b1..b74c31924 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From c9054be8617adb9418e8edb732d6e234f7024e82 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 10 May 2017 11:36:31 +0300 Subject: Merge pull request #5112 from cerealbeer/develop read() in DB_cache fails when catching E_WARNING with custom error handler --- system/database/DB_cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_cache.php') diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index b74c31924..7c8ee5fc9 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -143,7 +143,7 @@ class CI_DB_Cache { $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); - if (FALSE === ($cachedata = @file_get_contents($filepath))) + if ( ! is_file($filepath) OR FALSE === ($cachedata = file_get_contents($filepath))) { return FALSE; } -- cgit v1.2.3-24-g4f1b