@@ -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'); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | //Make sure last_checked is always updated on successful run. |
| 33 | 33 | //CHECK: Is there a reason we aren't just doing this in updateTitleById? |
| 34 | 34 | $this->db->set('last_checked', 'CURRENT_TIMESTAMP', FALSE) |
| 35 | - ->where('id', $id) |
|
| 36 | - ->update('tracker_titles'); |
|
| 35 | + ->where('id', $id) |
|
| 36 | + ->update('tracker_titles'); |
|
| 37 | 37 | } |
| 38 | 38 | } else { |
| 39 | 39 | log_message('error', "{$query->row('title')} failed to update successfully"); |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function addTitle(string $titleURL, int $siteID) : int { |
| 75 | 75 | $query = $this->db->select('site, site_class') |
| 76 | - ->from('tracker_sites') |
|
| 77 | - ->where('id', $siteID) |
|
| 78 | - ->get(); |
|
| 76 | + ->from('tracker_sites') |
|
| 77 | + ->where('id', $siteID) |
|
| 78 | + ->get(); |
|
| 79 | 79 | |
| 80 | 80 | $titleData = $this->sites->{$query->row()->site_class}->getTitleData($titleURL, TRUE); |
| 81 | 81 | |
@@ -101,20 +101,20 @@ discard block |
||
| 101 | 101 | public function updateByID(int $titleID, string $latestChapter) : bool { |
| 102 | 102 | //FIXME: Really not too happy with how we're doing history stuff here, it just feels messy. |
| 103 | 103 | $query = $this->db->select('latest_chapter AS current_chapter') |
| 104 | - ->from('tracker_titles') |
|
| 105 | - ->where('id', $titleID) |
|
| 106 | - ->get(); |
|
| 104 | + ->from('tracker_titles') |
|
| 105 | + ->where('id', $titleID) |
|
| 106 | + ->get(); |
|
| 107 | 107 | $row = $query->row(); |
| 108 | 108 | |
| 109 | 109 | $success = $this->db->set(['latest_chapter' => $latestChapter, 'failed_checks' => 0]) //last_updated gets updated via a trigger if something changes |
| 110 | - ->where('id', $titleID) |
|
| 111 | - ->update('tracker_titles'); |
|
| 110 | + ->where('id', $titleID) |
|
| 111 | + ->update('tracker_titles'); |
|
| 112 | 112 | |
| 113 | 113 | if($this->db->affected_rows() > 0) { |
| 114 | 114 | //Clear hidden latest chapter |
| 115 | 115 | $this->db->set(['ignore_chapter' => 'NULL', 'last_updated' => 'last_updated'], NULL, FALSE) |
| 116 | - ->where('title_id', $titleID) |
|
| 117 | - ->update('tracker_chapters'); |
|
| 116 | + ->where('title_id', $titleID) |
|
| 117 | + ->update('tracker_chapters'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | //Update History |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function updateFailedChecksByID(int $titleID) : bool { |
| 129 | 129 | $success = $this->db->set('failed_checks', 'failed_checks + 1', FALSE) |
| 130 | - ->where('id', $titleID) |
|
| 131 | - ->update('tracker_titles'); |
|
| 130 | + ->where('id', $titleID) |
|
| 131 | + ->update('tracker_titles'); |
|
| 132 | 132 | |
| 133 | 133 | return $success; |
| 134 | 134 | } |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function getSiteDataFromURL(string $site_url) { |
| 142 | 142 | $query = $this->db->select('*') |
| 143 | - ->from('tracker_sites') |
|
| 144 | - ->where('site', $site_url) |
|
| 145 | - ->get(); |
|
| 143 | + ->from('tracker_sites') |
|
| 144 | + ->where('site', $site_url) |
|
| 145 | + ->get(); |
|
| 146 | 146 | |
| 147 | 147 | return $query->row(); |
| 148 | 148 | } |