@@ -245,7 +245,7 @@ |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | - * @param $md5 |
|
| 248 | + * @param string $md5 |
|
| 249 | 249 | * |
| 250 | 250 | * @return array |
| 251 | 251 | */ |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function __construct(&$db) { |
| 76 | 76 | // Assign the main CI object to $this->CI and load the file helper since we use it a lot |
| 77 | - $this->CI =& get_instance(); |
|
| 78 | - $this->db =& $db; |
|
| 77 | + $this->CI = & get_instance(); |
|
| 78 | + $this->db = & $db; |
|
| 79 | 79 | $this->CI->load->helper('file'); |
| 80 | 80 | |
| 81 | 81 | $this->check_path(); |
@@ -102,18 +102,18 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // Add a trailing slash to the path if needed |
| 104 | 104 | $path = realpath($path) |
| 105 | - ? rtrim(realpath($path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR |
|
| 106 | - : rtrim($path, '/') . '/'; |
|
| 105 | + ? rtrim(realpath($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR |
|
| 106 | + : rtrim($path, '/').'/'; |
|
| 107 | 107 | |
| 108 | 108 | if(!is_dir($path)) { |
| 109 | - log_message('debug', 'DB cache path error: ' . $path); |
|
| 109 | + log_message('debug', 'DB cache path error: '.$path); |
|
| 110 | 110 | |
| 111 | 111 | // If the path is wrong we'll turn off caching |
| 112 | 112 | return $this->db->cache_off(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | if(!is_really_writable($path)) { |
| 116 | - log_message('debug', 'DB cache dir not writable: ' . $path); |
|
| 116 | + log_message('debug', 'DB cache dir not writable: '.$path); |
|
| 117 | 117 | |
| 118 | 118 | // If the path is not really writable we'll turn off caching |
| 119 | 119 | return $this->db->cache_off(); |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | // BEGIN --- modification for supporting multi-level cache folders |
| 145 | 145 | |
| 146 | 146 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 147 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 147 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 148 | 148 | $layer = $this->get_folder_layers($uri_md5); |
| 149 | - $filepath = $this->db->cachedir . $segment_one.'/'.$segment_two . '/' . implode('/', $layer) . '/' . $uri_md5; |
|
| 149 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.implode('/', $layer).'/'.$uri_md5; |
|
| 150 | 150 | } else { |
| 151 | - $filepath = $this->db->cachedir . $segment_one.'/'. $segment_two . '/' . md5($sql); |
|
| 151 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.md5($sql); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // END --- modification for supporting multi-level cache folders |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | // BEGIN --- modification for supporting multi-level cache folders |
| 179 | 179 | |
| 180 | 180 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 181 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 181 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 182 | 182 | $layer = $this->get_folder_layers($uri_md5); |
| 183 | - $dir_path = $this->db->cachedir . $segment_one.'/'.$segment_two . '/' . implode('/', $layer) . '/'; |
|
| 183 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.implode('/', $layer).'/'; |
|
| 184 | 184 | |
| 185 | 185 | if(!is_dir($dir_path)) { |
| 186 | 186 | $old = umask(0); |
@@ -188,18 +188,18 @@ discard block |
||
| 188 | 188 | umask($old); |
| 189 | 189 | } |
| 190 | 190 | } else { |
| 191 | - $dir_path = $this->db->cachedir . $segment_one.'/'. $segment_two . '/'; |
|
| 191 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $filename = md5($sql); |
| 195 | 195 | |
| 196 | 196 | // END --- modification for supporting multi-level cache folders |
| 197 | 197 | |
| 198 | - if(write_file($dir_path . $filename, serialize($object)) === FALSE) { |
|
| 198 | + if(write_file($dir_path.$filename, serialize($object)) === FALSE) { |
|
| 199 | 199 | return FALSE; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - chmod($dir_path . $filename, 0640); |
|
| 202 | + chmod($dir_path.$filename, 0640); |
|
| 203 | 203 | |
| 204 | 204 | return TRUE; |
| 205 | 205 | } |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 227 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 227 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 228 | 228 | $layer = $this->get_folder_layers($uri_md5); |
| 229 | - $dir_path = $this->db->cachedir . $segment_one.'/'.$segment_two . '/' . implode('/', $layer) . '/'; |
|
| 229 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.implode('/', $layer).'/'; |
|
| 230 | 230 | } else { |
| 231 | - $dir_path = $this->db->cachedir . $segment_one.'/'. $segment_two . '/'; |
|
| 231 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'; |
|
| 232 | 232 | } |
| 233 | 233 | delete_files($dir_path, TRUE); |
| 234 | 234 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @since Version 1.0.0 |
| 36 | 36 | * @filesource |
| 37 | 37 | */ |
| 38 | -defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 38 | +defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Database Cache Class |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $last_key = 0; |
| 255 | 255 | $last_value = 0; |
| 256 | 256 | |
| 257 | - foreach($this->CI->config->item('multi_level_cache_folders') AS $key => $value) { |
|
| 257 | + foreach($this->CI->config->item('multi_level_cache_folders') as $key => $value) { |
|
| 258 | 258 | if($key != 0) { |
| 259 | 259 | $key = $last_key + $last_value; |
| 260 | 260 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | // if this class is already loaded before instantiating it. Loading it now |
| 23 | 23 | // makes sure our version is used when a controller enables query caching |
| 24 | 24 | if(!class_exists('CI_DB_Cache')) { |
| 25 | - @include(APPPATH . 'libraries/MY_DB_cache.php'); |
|
| 25 | + @include(APPPATH.'libraries/MY_DB_cache.php'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // call the parent method to retain the CI functionality |