@@ -210,10 +210,10 @@ |
||
| 210 | 210 | { |
| 211 | 211 | // Ensure there's a trailing slash |
| 212 | 212 | $system_path = strtr( |
| 213 | - rtrim($system_path, '/\\'), |
|
| 214 | - '/\\', |
|
| 215 | - DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
|
| 216 | - ).DIRECTORY_SEPARATOR; |
|
| 213 | + rtrim($system_path, '/\\'), |
|
| 214 | + '/\\', |
|
| 215 | + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
|
| 216 | + ).DIRECTORY_SEPARATOR; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | // Is the system path correct? |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class UnitTester extends \Codeception\Actor |
| 20 | 20 | { |
| 21 | - use _generated\UnitTesterActions; |
|
| 21 | + use _generated\UnitTesterActions; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Define custom actions here |
@@ -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 |
@@ -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 |
@@ -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 | */ |
@@ -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) { |
@@ -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 | } |
@@ -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 | } |
@@ -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('*') |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function getID(string $titleURL, int $siteID, bool $create = TRUE, bool $returnData = FALSE) { |
| 17 | 17 | $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) |
| 18 | - ->from('tracker_titles') |
|
| 19 | - ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 20 | - ->where('tracker_titles.title_url', $titleURL) |
|
| 21 | - ->where('tracker_titles.site_id', $siteID) |
|
| 22 | - ->get(); |
|
| 18 | + ->from('tracker_titles') |
|
| 19 | + ->join('tracker_sites', 'tracker_sites.id = tracker_titles.site_id', 'left') |
|
| 20 | + ->where('tracker_titles.title_url', $titleURL) |
|
| 21 | + ->where('tracker_titles.site_id', $siteID) |
|
| 22 | + ->get(); |
|
| 23 | 23 | |
| 24 | 24 | if($query->num_rows() > 0) { |
| 25 | 25 | $id = (int) $query->row('id'); |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | //Make sure last_checked is always updated on successful run. |
| 34 | 34 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
| 35 | 35 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 36 | - ->where('id', $id) |
|
| 37 | - ->update('tracker_titles'); |
|
| 36 | + ->where('id', $id) |
|
| 37 | + ->update('tracker_titles'); |
|
| 38 | 38 | } |
| 39 | 39 | } else { |
| 40 | 40 | log_message('error', "{$siteClass} | {$query->row('title')} ({$query->row('title_url')}) | Failed to update."); |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | private function addTitle(string $titleURL, int $siteID) : int { |
| 76 | 76 | $query = $this->db->select('site, site_class') |
| 77 | - ->from('tracker_sites') |
|
| 78 | - ->where('id', $siteID) |
|
| 79 | - ->get(); |
|
| 77 | + ->from('tracker_sites') |
|
| 78 | + ->where('id', $siteID) |
|
| 79 | + ->get(); |
|
| 80 | 80 | |
| 81 | 81 | $titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL, TRUE); |
| 82 | 82 | |
@@ -102,21 +102,21 @@ discard block |
||
| 102 | 102 | public function updateByID(int $titleID, ?string $latestChapter) : bool { |
| 103 | 103 | //FIXME: Really not too happy with how we're doing history stuff here, it just feels messy. |
| 104 | 104 | $query = $this->db->select('latest_chapter AS current_chapter') |
| 105 | - ->from('tracker_titles') |
|
| 106 | - ->where('id', $titleID) |
|
| 107 | - ->get(); |
|
| 105 | + ->from('tracker_titles') |
|
| 106 | + ->where('id', $titleID) |
|
| 107 | + ->get(); |
|
| 108 | 108 | $row = $query->row(); |
| 109 | 109 | |
| 110 | 110 | //TODO (CHECK): If failed_checks changes won't that trigger affected_rows? |
| 111 | 111 | $success = $this->db->set(['latest_chapter' => $latestChapter, 'failed_checks' => 0]) //last_updated gets updated via a trigger if something changes |
| 112 | - ->where('id', $titleID) |
|
| 113 | - ->update('tracker_titles'); |
|
| 112 | + ->where('id', $titleID) |
|
| 113 | + ->update('tracker_titles'); |
|
| 114 | 114 | |
| 115 | 115 | if($this->db->affected_rows() > 0) { |
| 116 | 116 | //Clear hidden latest chapter |
| 117 | 117 | $this->db->set(['ignore_chapter' => 'NULL', 'last_updated' => 'last_updated'], NULL, FALSE) |
| 118 | - ->where('title_id', $titleID) |
|
| 119 | - ->update('tracker_chapters'); |
|
| 118 | + ->where('title_id', $titleID) |
|
| 119 | + ->update('tracker_chapters'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | //Update History |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | public function updateFailedChecksByID(int $titleID) : bool { |
| 131 | 131 | $success = $this->db->set('failed_checks', 'failed_checks + 1', FALSE) |
| 132 | - ->where('id', $titleID) |
|
| 133 | - ->update('tracker_titles'); |
|
| 132 | + ->where('id', $titleID) |
|
| 133 | + ->update('tracker_titles'); |
|
| 134 | 134 | |
| 135 | 135 | return $success; |
| 136 | 136 | } |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function getSiteDataFromURL(string $site_url) { |
| 144 | 144 | $query = $this->db->select('*') |
| 145 | - ->from('tracker_sites') |
|
| 146 | - ->where('site', $site_url) |
|
| 147 | - ->get(); |
|
| 145 | + ->from('tracker_sites') |
|
| 146 | + ->where('site', $site_url) |
|
| 147 | + ->get(); |
|
| 148 | 148 | |
| 149 | 149 | return $query->row(); |
| 150 | 150 | } |