summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/database/DB_cache.php2
-rw-r--r--system/helpers/file_helper.php31
-rw-r--r--system/helpers/security_helper.php3
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php4
4 files changed, 10 insertions, 30 deletions
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;
}
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index d53d986f9..b717aaa0d 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -44,38 +44,15 @@ if ( ! function_exists('read_file'))
*
* Opens the file specfied in the path and returns it as a string.
*
+ * This function is DEPRECATED and should be removed in
+ * CodeIgniter 3.1+. Use file_get_contents() instead.
+ *
* @param string path to file
* @return string
*/
function read_file($file)
{
- if ( ! file_exists($file))
- {
- return FALSE;
- }
-
- if (function_exists('file_get_contents'))
- {
- return file_get_contents($file);
- }
-
- if ( ! $fp = @fopen($file, FOPEN_READ))
- {
- return FALSE;
- }
-
- flock($fp, LOCK_SH);
-
- $data = '';
- if (filesize($file) > 0)
- {
- $data =& fread($fp, filesize($file));
- }
-
- flock($fp, LOCK_UN);
- fclose($fp);
-
- return $data;
+ return file_get_contents($file);
}
}
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 6187a4a7a..3e6e91435 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -77,6 +77,9 @@ if ( ! function_exists('do_hash'))
/**
* Hash encode a string
*
+ * This function is DEPRECATED and should be removed in
+ * CodeIgniter 3.1+. Use hash() instead.
+ *
* @param string
* @param string
* @return string
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))
{