Completed
Push — master ( 84f8b9...29b389 )
by Angus
08:20
created
application/core/MY_Log.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
 		// detect and register all PHP errors in this log hence forth
68 68
 		ErrorHandler::register($this->log);
69 69
 
70
-		if ($this->config['introspection_processor'])
71
-		{
70
+		if ($this->config['introspection_processor']) {
72 71
 			// add controller and line number info to each log message
73 72
 			// 2 = depth in the stacktrace to ignore. This gives us the file
74 73
 			// making the call to log_message();
@@ -76,10 +75,8 @@  discard block
 block discarded – undo
76 75
 		}
77 76
 
78 77
 		// decide which handler(s) to use
79
-		foreach ($this->config['handlers'] as $value)
80
-		{
81
-			switch ($value)
82
-			{
78
+		foreach ($this->config['handlers'] as $value) {
79
+			switch ($value) {
83 80
 				case 'file':
84 81
 					$handler = new RotatingFileHandler($this->config['file_logfile']);
85 82
 					$formatter = new LineFormatter(null, null, $config['file_multiline']);
@@ -140,35 +137,28 @@  discard block
 block discarded – undo
140 137
 	 * @param $msg
141 138
 	 * @return bool
142 139
 	 */
143
-	public function write_log($level = 'error', $msg)
144
-	{
140
+	public function write_log($level = 'error', $msg) {
145 141
 		$level = strtoupper($level);
146 142
 
147 143
 		// verify error level
148
-		if (!isset($this->_levels[$level]))
149
-		{
144
+		if (!isset($this->_levels[$level])) {
150 145
 			$this->log->addError('unknown error level: ' . $level);
151 146
 			$level = 'ALL';
152 147
 		}
153 148
 
154 149
 		// filter out anything in $this->config['exclusion_list']
155
-		if (!empty($this->config['exclusion_list']))
156
-		{
157
-			foreach ($this->config['exclusion_list'] as $findme)
158
-			{
150
+		if (!empty($this->config['exclusion_list'])) {
151
+			foreach ($this->config['exclusion_list'] as $findme) {
159 152
 				$pos = strpos($msg, $findme);
160
-				if ($pos !== false)
161
-				{
153
+				if ($pos !== false) {
162 154
 					// just exit now - we don't want to log this error
163 155
 					return true;
164 156
 				}
165 157
 			}
166 158
 		}
167 159
 
168
-		if ($this->_levels[$level] <= $this->config['threshold'])
169
-		{
170
-			switch ($level)
171
-			{
160
+		if ($this->_levels[$level] <= $this->config['threshold']) {
161
+			switch ($level) {
172 162
 				case 'ERROR':
173 163
 					$this->log->addError($msg);
174 164
 					break;
Please login to merge, or discard this patch.
application/models/Tracker/Tracker_Admin_Model.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 					//Make sure last_checked is always updated on successful run.
153 153
 					//CHECK: Is there a reason we aren't just doing this in updateByID?
154 154
 					$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
155
-					         ->where('id', $row->title_id)
156
-					         ->update('tracker_titles');
155
+							 ->where('id', $row->title_id)
156
+							 ->update('tracker_titles');
157 157
 
158 158
 					print " - ({$titleData['latest_chapter']})\n";
159 159
 				} else {
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 					//Make sure last_checked is always updated on successful run.
168 168
 					//CHECK: Is there a reason we aren't just doing this in updateByID?
169 169
 					$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
170
-					         ->where('id', $row->title_id)
171
-					         ->update('tracker_titles');
170
+							 ->where('id', $row->title_id)
171
+							 ->update('tracker_titles');
172 172
 
173 173
 					print " - (No chapters found?)\n";
174 174
 				} else {
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function updateCustom() {
193 193
 		$query = $this->db->select('*')
194
-		                  ->from('tracker_sites')
195
-		                  ->where('status', 'enabled')
196
-		                  ->where('tracker_sites.use_custom', 'Y')
197
-		                  ->get();
194
+						  ->from('tracker_sites')
195
+						  ->where('status', 'enabled')
196
+						  ->where('tracker_sites.use_custom', 'Y')
197
+						  ->get();
198 198
 
199 199
 		$sites = $query->result_array();
200 200
 		foreach ($sites as $site) {
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 									//Make sure last_checked is always updated on successful run.
212 212
 									//CHECK: Is there a reason we aren't just doing this in updateByID?
213 213
 									$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
214
-									         ->where('id', $titleID)
215
-									         ->update('tracker_titles');
214
+											 ->where('id', $titleID)
215
+											 ->update('tracker_titles');
216 216
 
217 217
 									print " - ({$titleData['latest_chapter']})\n";
218 218
 								} else {
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 
242 242
 	public function refollowCustom() {
243 243
 		$query = $this->db->select('tracker_titles.id, tracker_titles.title_url, tracker_sites.site_class')
244
-		                  ->from('tracker_titles')
245
-		                  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
246
-		                  ->where('tracker_titles.followed','N')
247
-		                  ->where('tracker_titles !=', '255')
248
-		                  ->where('tracker_sites.status', 'enabled')
249
-		                  ->where('tracker_sites.use_custom', 'Y')
250
-		                  ->get();
244
+						  ->from('tracker_titles')
245
+						  ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left')
246
+						  ->where('tracker_titles.followed','N')
247
+						  ->where('tracker_titles !=', '255')
248
+						  ->where('tracker_sites.status', 'enabled')
249
+						  ->where('tracker_sites.use_custom', 'Y')
250
+						  ->get();
251 251
 
252 252
 		if($query->num_rows() > 0) {
253 253
 			foreach($query->result() as $row) {
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 
259 259
 					if(!empty($titleData)) {
260 260
 						$this->db->set($titleData)
261
-						         ->where('id', $row->id)
262
-						         ->update('tracker_titles');
261
+								 ->where('id', $row->id)
262
+								 ->update('tracker_titles');
263 263
 
264 264
 						print "> {$row->site_class}:{$row->id}:{$row->title_url} FOLLOWED\n";
265 265
 					} else {
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 				if($titleData['title'] && is_array($titleData) && !is_null($titleData['latest_chapter'])) {
308 308
 					if($titleData['title'] !== $row->title) {
309 309
 						$this->db->set('title', $titleData['title'])
310
-						         ->where('id', $row->id)
311
-						         ->update('tracker_titles');
310
+								 ->where('id', $row->id)
311
+								 ->update('tracker_titles');
312 312
 						//TODO: Add to history somehow?
313 313
 						print " - NEW TITLE ({$titleData['title']})\n";
314 314
 					} else {
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 					//We might as well try to update as well.
319 319
 					if($this->Tracker->title->updateByID((int) $row->id, $titleData['latest_chapter'])) {
320 320
 						$this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE)
321
-						         ->where('id', $row->id)
322
-						         ->update('tracker_titles');
321
+								 ->where('id', $row->id)
322
+								 ->update('tracker_titles');
323 323
 					}
324 324
 				} else {
325 325
 					log_message('error', "{$row->title} failed to update title successfully");
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 		$date = $temp_now->format('Y-m-d');
336 336
 
337 337
 		$query = $this->db->select('1')
338
-		                  ->from('site_stats')
339
-		                  ->where('date', $date)
340
-		                  ->get();
338
+						  ->from('site_stats')
339
+						  ->where('date', $date)
340
+						  ->get();
341 341
 
342 342
 		if($query->num_rows() > 0) {
343 343
 			$this->db->set('total_requests', 'total_requests+1', FALSE)
344
-			         ->where('date', $date)
345
-			         ->update('site_stats');
344
+					 ->where('date', $date)
345
+					 ->update('site_stats');
346 346
 		} else {
347 347
 			$this->db->insert('site_stats', [
348 348
 				'date'           => $date,
Please login to merge, or discard this patch.