@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class AcceptanceTester extends \Codeception\Actor |
| 20 | 20 | { |
| 21 | - use _generated\AcceptanceTesterActions; |
|
| 21 | + use _generated\AcceptanceTesterActions; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Define custom actions here |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @SuppressWarnings(PHPMD) |
| 18 | 18 | */ |
| 19 | -class AcceptanceTester extends \Codeception\Actor |
|
| 20 | -{ |
|
| 19 | +class AcceptanceTester extends \Codeception\Actor { |
|
| 21 | 20 | use _generated\AcceptanceTesterActions; |
| 22 | 21 | |
| 23 | 22 | /** |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class FunctionalTester extends \Codeception\Actor |
| 20 | 20 | { |
| 21 | - use _generated\FunctionalTesterActions; |
|
| 21 | + use _generated\FunctionalTesterActions; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Define custom actions here |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @SuppressWarnings(PHPMD) |
| 18 | 18 | */ |
| 19 | -class FunctionalTester extends \Codeception\Actor |
|
| 20 | -{ |
|
| 19 | +class FunctionalTester extends \Codeception\Actor { |
|
| 21 | 20 | use _generated\FunctionalTesterActions; |
| 22 | 21 | |
| 23 | 22 | /** |
@@ -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 | */ |
@@ -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 | } |
@@ -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(); |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | // BEGIN --- modification for supporting multi-level cache folders |
| 144 | 144 | |
| 145 | 145 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 146 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 146 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 147 | 147 | $layer = $this->get_folder_layers($uri_md5); |
| 148 | - $filepath = $this->db->cachedir . $segment_one . '/' . $segment_two . '/' . trim(implode('/', $layer), '/') . '/' . $uri_md5; |
|
| 148 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.trim(implode('/', $layer), '/').'/'.$uri_md5; |
|
| 149 | 149 | } else { |
| 150 | - $filepath = $this->db->cachedir . $segment_one . '/' . $segment_two . '/' . md5($sql); |
|
| 150 | + $filepath = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.md5($sql); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // 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 . '/' . trim(implode('/', $layer), '/') . '/'; |
|
| 183 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.trim(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 | return TRUE; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if(is_array($this->CI->config->item('multi_level_cache_folders'))) { |
| 226 | - $uri_md5 = md5($segment_one . '+' . $segment_two); |
|
| 226 | + $uri_md5 = md5($segment_one.'+'.$segment_two); |
|
| 227 | 227 | $layer = $this->get_folder_layers($uri_md5); |
| 228 | - $dir_path = $this->db->cachedir . $segment_one . '/' . $segment_two . '/' . trim(implode('/', $layer), '/') . '/'; |
|
| 228 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'.trim(implode('/', $layer), '/').'/'; |
|
| 229 | 229 | } else { |
| 230 | - $dir_path = $this->db->cachedir . $segment_one . '/' . $segment_two . '/'; |
|
| 230 | + $dir_path = $this->db->cachedir.$segment_one.'/'.$segment_two.'/'; |
|
| 231 | 231 | } |
| 232 | 232 | delete_files($dir_path, TRUE); |
| 233 | 233 | } |
@@ -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 |
@@ -137,7 +137,9 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $success = $this->set_db($idData, $valueData); |
| 140 | - if($success) $this->session->unset_tempdata("option_{$option}"); |
|
| 140 | + if($success) { |
|
| 141 | + $this->session->unset_tempdata("option_{$option}"); |
|
| 142 | + } |
|
| 141 | 143 | } else { |
| 142 | 144 | $success = FALSE; |
| 143 | 145 | } |
@@ -164,7 +166,9 @@ discard block |
||
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | //Overall fallback method. |
| 167 | - if(!isset($value)) $value = $this->options[$option]['default']; |
|
| 169 | + if(!isset($value)) { |
|
| 170 | + $value = $this->options[$option]['default']; |
|
| 171 | + } |
|
| 168 | 172 | } else { |
| 169 | 173 | $value = FALSE; |
| 170 | 174 | } |
@@ -215,7 +219,10 @@ discard block |
||
| 215 | 219 | //This should never happen. |
| 216 | 220 | break; |
| 217 | 221 | } |
| 218 | - if(!isset($value)) $value = FALSE; //FIXME: This won't play nice with BOOL type false? |
|
| 222 | + if(!isset($value)) { |
|
| 223 | + $value = FALSE; |
|
| 224 | + } |
|
| 225 | + //FIXME: This won't play nice with BOOL type false? |
|
| 219 | 226 | |
| 220 | 227 | return $value; |
| 221 | 228 | } |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | * @param string $option |
| 115 | 115 | * @param int|null $userID |
| 116 | 116 | * |
| 117 | - * @return mixed Returns option value as STRING, or FALSE if option does not exist. |
|
| 117 | + * @return string Returns option value as STRING, or FALSE if option does not exist. |
|
| 118 | 118 | */ |
| 119 | 119 | public function get(string $option, ?int $userID = NULL) { |
| 120 | 120 | $userID = (is_null($userID) ? (int) $this->User->id : $userID); |
@@ -188,18 +188,18 @@ |
||
| 188 | 188 | //FIXME: Query duplication. |
| 189 | 189 | if($this->User->id !== $userID) { |
| 190 | 190 | $query = $this->db->select('value_str, value_int') |
| 191 | - ->from('user_options') |
|
| 192 | - ->where('user_id', $userID) |
|
| 193 | - ->where('name', $option) |
|
| 194 | - ->limit(1); |
|
| 191 | + ->from('user_options') |
|
| 192 | + ->where('user_id', $userID) |
|
| 193 | + ->where('name', $option) |
|
| 194 | + ->limit(1); |
|
| 195 | 195 | $data = $query->get()->row_array(); |
| 196 | 196 | } else { |
| 197 | 197 | if(!($data = $this->session->tempdata("option_{$option}"))) { |
| 198 | 198 | $query = $this->db->select('value_str, value_int') |
| 199 | - ->from('user_options') |
|
| 200 | - ->where('user_id', $userID) |
|
| 201 | - ->where('name', $option) |
|
| 202 | - ->limit(1); |
|
| 199 | + ->from('user_options') |
|
| 200 | + ->where('user_id', $userID) |
|
| 201 | + ->where('name', $option) |
|
| 202 | + ->limit(1); |
|
| 203 | 203 | $data = $query->get()->row_array(); |
| 204 | 204 | $this->session->set_tempdata("option_{$option}", $data, 3600); |
| 205 | 205 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $query = $this->db->select('value_str, value_int') |
| 201 | 201 | ->from('user_options') |
| 202 | 202 | ->where('user_id', $userID) |
| 203 | - ->where('name', $option) |
|
| 203 | + ->where('name', $option) |
|
| 204 | 204 | ->limit(1); |
| 205 | 205 | $data = $query->get()->row_array(); |
| 206 | 206 | } else { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $query = $this->db->select('value_str, value_int') |
| 209 | 209 | ->from('user_options') |
| 210 | 210 | ->where('user_id', $userID) |
| 211 | - ->where('name', $option) |
|
| 211 | + ->where('name', $option) |
|
| 212 | 212 | ->limit(1); |
| 213 | 213 | $data = $query->get()->row_array(); |
| 214 | 214 | $this->session->set_tempdata("option_{$option}", $data, 3600); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | ); |
| 262 | 262 | //FIXME: Get a better solution than str_replace for removing special characters |
| 263 | 263 | $elements = array(); |
| 264 | - foreach (array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
| 264 | + foreach(array_values($this->options[$option]['valid_options']) as $valid_option) { |
|
| 265 | 265 | $elements[$option.'_'.str_replace(',', '_', $valid_option)] = array_merge($base_attributes, array( |
| 266 | 266 | 'value' => $valid_option |
| 267 | 267 | )); |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | $success = FALSE; |
| 10 | 10 | if(preg_match("/^[a-z0-9\\-_,:]{0,255}$/", $tag_string)) { |
| 11 | 11 | $success = (bool) $this->db->set(['tags' => $tag_string, 'active' => 'Y', 'last_updated' => NULL]) |
| 12 | - ->where('user_id', $userID) |
|
| 13 | - ->where('id', $chapterID) |
|
| 14 | - ->update('tracker_chapters'); |
|
| 12 | + ->where('user_id', $userID) |
|
| 13 | + ->where('id', $chapterID) |
|
| 14 | + ->update('tracker_chapters'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if($success) { |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | class Tracker_Tag_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -35,9 +35,13 @@ |
||
| 35 | 35 | $titleID = $id; |
| 36 | 36 | } else { |
| 37 | 37 | //TODO: Check if title is valid URL! |
| 38 | - if($create) $titleID = $this->addTitle($titleURL, $siteID); |
|
| 38 | + if($create) { |
|
| 39 | + $titleID = $this->addTitle($titleURL, $siteID); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + if(!isset($titleID) || !$titleID) { |
|
| 43 | + $titleID = 0; |
|
| 39 | 44 | } |
| 40 | - if(!isset($titleID) || !$titleID) $titleID = 0; |
|
| 41 | 45 | |
| 42 | 46 | return ($returnData && $titleID !== 0 ? $query->row_array() : $titleID); |
| 43 | 47 | } |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | /** |
| 123 | 123 | * @param string $site_url |
| 124 | 124 | * |
| 125 | - * @return stdClass|object|null |
|
| 125 | + * @return string |
|
| 126 | 126 | */ |
| 127 | 127 | public function getSiteDataFromURL(string $site_url) { |
| 128 | 128 | $query = $this->db->select('*') |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function getID(string $titleURL, int $siteID, bool $create = TRUE, bool $returnData = FALSE) { |
| 19 | 19 | $query = $this->db->select('tracker_titles.id, tracker_titles.title, tracker_titles.title_url, tracker_titles.latest_chapter, tracker_titles.status, tracker_sites.site_class, (tracker_titles.last_checked > DATE_SUB(NOW(), INTERVAL 3 DAY)) AS active', FALSE) |
| 20 | - ->from('tracker_titles') |
|
| 21 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 22 | - ->where('tracker_titles.title_url', $titleURL) |
|
| 23 | - ->where('tracker_titles.site_id', $siteID) |
|
| 24 | - ->get(); |
|
| 20 | + ->from('tracker_titles') |
|
| 21 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 22 | + ->where('tracker_titles.title_url', $titleURL) |
|
| 23 | + ->where('tracker_titles.site_id', $siteID) |
|
| 24 | + ->get(); |
|
| 25 | 25 | |
| 26 | 26 | if($query->num_rows() > 0) { |
| 27 | 27 | $id = (int) $query->row('id'); |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | //Make sure last_checked is always updated on successful run. |
| 36 | 36 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
| 37 | 37 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 38 | - ->where('id', $id) |
|
| 39 | - ->update('tracker_titles'); |
|
| 38 | + ->where('id', $id) |
|
| 39 | + ->update('tracker_titles'); |
|
| 40 | 40 | } |
| 41 | 41 | } else { |
| 42 | 42 | log_message('error', "{$siteClass} | {$query->row('title')} ({$query->row('title_url')}) | Failed to update."); |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | private function addTitle(string $titleURL, int $siteID) : int { |
| 78 | 78 | $query = $this->db->select('site, site_class') |
| 79 | - ->from('tracker_sites') |
|
| 80 | - ->where('id', $siteID) |
|
| 81 | - ->get(); |
|
| 79 | + ->from('tracker_sites') |
|
| 80 | + ->where('id', $siteID) |
|
| 81 | + ->get(); |
|
| 82 | 82 | |
| 83 | 83 | $titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL, TRUE); |
| 84 | 84 | |
@@ -104,21 +104,21 @@ discard block |
||
| 104 | 104 | public function updateByID(int $titleID, ?string $latestChapter) : bool { |
| 105 | 105 | //FIXME: Really not too happy with how we're doing history stuff here, it just feels messy. |
| 106 | 106 | $query = $this->db->select('latest_chapter AS current_chapter') |
| 107 | - ->from('tracker_titles') |
|
| 108 | - ->where('id', $titleID) |
|
| 109 | - ->get(); |
|
| 107 | + ->from('tracker_titles') |
|
| 108 | + ->where('id', $titleID) |
|
| 109 | + ->get(); |
|
| 110 | 110 | $row = $query->row(); |
| 111 | 111 | |
| 112 | 112 | //TODO (CHECK): If failed_checks changes won't that trigger affected_rows? |
| 113 | 113 | $success = $this->db->set(['latest_chapter' => $latestChapter, 'failed_checks' => 0]) //last_updated gets updated via a trigger if something changes |
| 114 | - ->where('id', $titleID) |
|
| 115 | - ->update('tracker_titles'); |
|
| 114 | + ->where('id', $titleID) |
|
| 115 | + ->update('tracker_titles'); |
|
| 116 | 116 | |
| 117 | 117 | if($this->db->affected_rows() > 0) { |
| 118 | 118 | //Clear hidden latest chapter |
| 119 | 119 | $this->db->set(['ignore_chapter' => 'NULL', 'last_updated' => 'last_updated'], NULL, FALSE) |
| 120 | - ->where('title_id', $titleID) |
|
| 121 | - ->update('tracker_chapters'); |
|
| 120 | + ->where('title_id', $titleID) |
|
| 121 | + ->update('tracker_chapters'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | //Update History |
@@ -135,20 +135,20 @@ discard block |
||
| 135 | 135 | if(!array_diff(array_keys($data), TITLEDATA_COLUMNS)) { |
| 136 | 136 | $newData = array_merge($data, ['failed_checks' => 0]); |
| 137 | 137 | $oldData = $this->db->select('latest_chapter AS current_chapter') |
| 138 | - ->from('tracker_titles') |
|
| 139 | - ->where('id', $titleID) |
|
| 140 | - ->get()->row_array(); |
|
| 138 | + ->from('tracker_titles') |
|
| 139 | + ->where('id', $titleID) |
|
| 140 | + ->get()->row_array(); |
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | $success = $this->db->set($newData) //last_updated gets updated via a trigger if something changes |
| 144 | - ->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
|
| 145 | - ->where('id', $titleID) |
|
| 146 | - ->update('tracker_titles'); |
|
| 144 | + ->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
|
| 145 | + ->where('id', $titleID) |
|
| 146 | + ->update('tracker_titles'); |
|
| 147 | 147 | if(in_array('latest_chapter', $newData, TRUE) && $newData['latest_chapter'] !== $oldData['current_chapter'] && $this->db->affected_rows() > 0) { |
| 148 | 148 | //Clear hidden latest chapter |
| 149 | 149 | $this->db->set(['ignore_chapter' => 'NULL', 'last_updated' => 'last_updated'], NULL, FALSE) |
| 150 | - ->where('title_id', $titleID) |
|
| 151 | - ->update('tracker_chapters'); |
|
| 150 | + ->where('title_id', $titleID) |
|
| 151 | + ->update('tracker_chapters'); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | //Update History |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | public function updateFailedChecksByID(int $titleID) : bool { |
| 166 | 166 | $success = $this->db->set('failed_checks', 'failed_checks + 1', FALSE) |
| 167 | - ->where('id', $titleID) |
|
| 168 | - ->update('tracker_titles'); |
|
| 167 | + ->where('id', $titleID) |
|
| 168 | + ->update('tracker_titles'); |
|
| 169 | 169 | |
| 170 | 170 | return $success; |
| 171 | 171 | } |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function getSiteDataFromURL(string $site_url) { |
| 179 | 179 | $query = $this->db->select('*') |
| 180 | - ->from('tracker_sites') |
|
| 181 | - ->where('site', $site_url) |
|
| 182 | - ->get(); |
|
| 180 | + ->from('tracker_sites') |
|
| 181 | + ->where('site', $site_url) |
|
| 182 | + ->get(); |
|
| 183 | 183 | |
| 184 | 184 | return $query->row(); |
| 185 | 185 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | const TITLEDATA_COLUMNS = ['title', 'latest_chapter', 'status', 'followed', 'mal_id', 'last_updated']; |
| 4 | 4 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | //FIXME: The <preferable> solution here is we'd just check against the last_updated time, but that can have a few issues. |
| 157 | 157 | $this->History->updateTitleHistory($titleID, $oldData['current_chapter'], $newData['latest_chapter'] ?? NULL, date('Y-m-d H:i:s')); |
| 158 | 158 | } else { |
| 159 | - log_message('error', "ID {$titleID} is attempting to access an invalid column?"); |
|
| 159 | + log_message('error', "id {$titleID} is attempting to access an invalid column?"); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return (bool) $success; |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function setByID(int $userID, int $chapterID, string $category) : bool { |
| 9 | 9 | $success = $this->db->set(['category' => $category, 'active' => 'Y', 'last_updated' => NULL]) |
| 10 | - ->where('user_id', $userID) |
|
| 11 | - ->where('id', $chapterID) |
|
| 12 | - ->update('tracker_chapters'); |
|
| 10 | + ->where('user_id', $userID) |
|
| 11 | + ->where('id', $chapterID) |
|
| 12 | + ->update('tracker_chapters'); |
|
| 13 | 13 | |
| 14 | 14 | return (bool) $success; |
| 15 | 15 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public function getUsed(int $userID) : array { |
| 42 | 42 | $query = $this->db->distinct() |
| 43 | - ->select('category') |
|
| 44 | - ->from('tracker_chapters') |
|
| 45 | - ->where('tracker_chapters.active', 'Y') |
|
| 46 | - ->where('user_id', $userID) |
|
| 47 | - ->get(); |
|
| 43 | + ->select('category') |
|
| 44 | + ->from('tracker_chapters') |
|
| 45 | + ->where('tracker_chapters.active', 'Y') |
|
| 46 | + ->where('user_id', $userID) |
|
| 47 | + ->get(); |
|
| 48 | 48 | |
| 49 | 49 | return array_column($query->result_array(), 'category'); |
| 50 | 50 | } |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 1 | +<?php declare(strict_types=1); defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 2 | 2 | |
| 3 | 3 | class Tracker_Category_Model extends Tracker_Base_Model { |
| 4 | 4 | public function __construct() { |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -defined('BASEPATH') OR exit('No direct script access allowed'); |
|
| 2 | +defined('BASEPATH') or exit('No direct script access allowed'); |
|
| 3 | 3 | |
| 4 | 4 | echo "\nERROR: ", |
| 5 | 5 | $heading, |