Completed
Push — master ( 68c2d1...79d43d )
by Angus
02:33
created
application/libraries/MY_DB_cache.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
application/core/MY_Loader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.