@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $this->echoCLI = config('nntmux.echocli'); |
110 | 110 | $groupID = ''; |
111 | 111 | |
112 | - if (! empty($groupName)) { |
|
112 | + if (!empty($groupName)) { |
|
113 | 113 | $groupInfo = UsenetGroup::getByName($groupName); |
114 | 114 | if ($groupInfo !== null) { |
115 | 115 | $groupID = $groupInfo['id']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->colorCLI->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')'); |
121 | 121 | } |
122 | 122 | |
123 | - if (! file_exists(config('nntmux_settings.path_to_nzbs'))) { |
|
123 | + if (!file_exists(config('nntmux_settings.path_to_nzbs'))) { |
|
124 | 124 | if ($this->echoCLI) { |
125 | 125 | $this->colorCLI->error('Bad or missing nzb directory - '.config('nntmux_settings.path_to_nzbs')); |
126 | 126 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $cat = new Categorize; |
182 | 182 | $categorized = $total = 0; |
183 | 183 | $releasesQuery = Release::query()->where(['categories_id' => Category::OTHER_MISC, 'iscategorized' => 0]); |
184 | - if (! empty($groupId)) { |
|
184 | + if (!empty($groupId)) { |
|
185 | 185 | $releasesQuery->where('groups_id', $groupId); |
186 | 186 | } |
187 | 187 | $releases = $releasesQuery->select(['id', 'fromname', 'groups_id', $type])->get(); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->colorCLI->header('Process Releases -> Attempting to find complete collections.'); |
218 | 218 | } |
219 | 219 | |
220 | - $where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
220 | + $where = (!empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
221 | 221 | |
222 | 222 | $this->processStuckCollections($groupID); |
223 | 223 | $this->collectionFileCheckStage1($groupID); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if ($this->echoCLI) { |
231 | 231 | $countQuery = Collection::query()->where('filecheck', self::COLLFC_COMPPART); |
232 | 232 | |
233 | - if (! empty($groupID)) { |
|
233 | + if (!empty($groupID)) { |
|
234 | 234 | $countQuery->where('groups_id', $groupID); |
235 | 235 | } |
236 | 236 | $count = $countQuery->count('id'); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $this->colorCLI->header('Process Releases -> Calculating collection sizes (in bytes).'); |
258 | 258 | } |
259 | 259 | // Get the total size in bytes of the collection for collections where filecheck = 2. |
260 | - DB::transaction(function () use ($groupID, $startTime) { |
|
260 | + DB::transaction(function() use ($groupID, $startTime) { |
|
261 | 261 | $checked = DB::update( |
262 | 262 | sprintf( |
263 | 263 | ' |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | AND c.filesize = 0 %s', |
274 | 274 | self::COLLFC_SIZED, |
275 | 275 | self::COLLFC_COMPPART, |
276 | - (! empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
276 | + (!empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | if ($checked > 0 && $this->echoCLI) { |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | |
313 | 313 | $groupMinimums = UsenetGroup::getGroupByID($grpID['id']); |
314 | 314 | if ($groupMinimums !== null) { |
315 | - if (! empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
315 | + if (!empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
316 | 316 | $groupMinSizeSetting = (int) $groupMinimums['minsizetoformrelease']; |
317 | 317 | } |
318 | - if (! empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
318 | + if (!empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
319 | 319 | $groupMinFilesSetting = (int) $groupMinimums['minfilestoformrelease']; |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | 323 | if (Collection::query()->where('filecheck', self::COLLFC_SIZED)->where('filesize', '>', 0)->first() !== null) { |
324 | - DB::transaction(function () use ( |
|
324 | + DB::transaction(function() use ( |
|
325 | 325 | $groupMinSizeSetting, |
326 | 326 | $minSizeSetting, |
327 | 327 | $minSizeDeleted, |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $collectionsQuery = Collection::query() |
394 | 394 | ->where('collections.filecheck', self::COLLFC_SIZED) |
395 | 395 | ->where('collections.filesize', '>', 0); |
396 | - if (! empty($groupID)) { |
|
396 | + if (!empty($groupID)) { |
|
397 | 397 | $collectionsQuery->where('collections.groups_id', $groupID); |
398 | 398 | } |
399 | 399 | $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | |
446 | 446 | $determinedCategory = $categorize->determineCategory($collection->groups_id, $cleanedName); |
447 | 447 | |
448 | - $searchName = ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName; |
|
448 | + $searchName = !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName; |
|
449 | 449 | |
450 | 450 | $releaseID = Release::insertRelease( |
451 | 451 | [ |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | if ($releaseID !== null) { |
469 | 469 | // Update collections table to say we inserted the release. |
470 | - DB::transaction(static function () use ($collection, $releaseID) { |
|
470 | + DB::transaction(static function() use ($collection, $releaseID) { |
|
471 | 471 | Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]); |
472 | 472 | }, 10); |
473 | 473 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | } |
529 | 529 | } else { |
530 | 530 | // The release was already in the DB, so delete the collection. |
531 | - DB::transaction(static function () use ($collection) { |
|
531 | + DB::transaction(static function() use ($collection) { |
|
532 | 532 | Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); |
533 | 533 | }, 10); |
534 | 534 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | } |
570 | 570 | |
571 | 571 | $releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0); |
572 | - if (! empty($groupID)) { |
|
572 | + if (!empty($groupID)) { |
|
573 | 573 | $releasesQuery->where('releases.groups_id', $groupID); |
574 | 574 | } |
575 | 575 | $releases = $releasesQuery->select(['id', 'guid', 'name', 'categories_id'])->get(); |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | ), true); |
673 | 673 | } |
674 | 674 | |
675 | - DB::transaction(function () use ($deletedCount, $startTime) { |
|
675 | + DB::transaction(function() use ($deletedCount, $startTime) { |
|
676 | 676 | $deleted = 0; |
677 | 677 | $deleteQuery = Collection::query() |
678 | 678 | ->where('dateadded', '<', now()->subHours(Settings::settingValue('partretentionhours'))) |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | $releases = Release::query() |
836 | 836 | ->select(['id', 'guid']) |
837 | 837 | ->where('passwordstatus', '=', Releases::PASSWD_RAR) |
838 | - ->orWhereIn('id', function ($query) { |
|
838 | + ->orWhereIn('id', function($query) { |
|
839 | 839 | $query->select('releases_id') |
840 | 840 | ->from('release_files') |
841 | 841 | ->where('passworded', '=', Releases::PASSWD_RAR); |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | foreach ($genrelist as $genre) { |
895 | 895 | $musicInfoQuery = MusicInfo::query()->where('genre_id', (int) $genre['id'])->select(['id']); |
896 | 896 | $releases = Release::query() |
897 | - ->joinSub($musicInfoQuery, 'mi', function ($join) { |
|
897 | + ->joinSub($musicInfoQuery, 'mi', function($join) { |
|
898 | 898 | $join->on('releases.musicinfo_id', '=', 'mi.id'); |
899 | 899 | }) |
900 | 900 | ->select(['releases.id', 'releases.guid']) |
@@ -980,18 +980,18 @@ discard block |
||
980 | 980 | */ |
981 | 981 | private function collectionFileCheckStage1(int $groupID): void |
982 | 982 | { |
983 | - DB::transaction(static function () use ($groupID) { |
|
983 | + DB::transaction(static function() use ($groupID) { |
|
984 | 984 | $collectionsCheck = Collection::query()->select(['collections.id']) |
985 | 985 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
986 | 986 | ->where('collections.totalfiles', '>', 0) |
987 | 987 | ->where('collections.filecheck', '=', self::COLLFC_DEFAULT); |
988 | - if (! empty($groupID)) { |
|
988 | + if (!empty($groupID)) { |
|
989 | 989 | $collectionsCheck->where('collections.groups_id', $groupID); |
990 | 990 | } |
991 | 991 | $collectionsCheck->groupBy('binaries.collections_id', 'collections.totalfiles', 'collections.id') |
992 | 992 | ->havingRaw('COUNT(binaries.id) IN (collections.totalfiles, collections.totalfiles+1)'); |
993 | 993 | |
994 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
994 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
995 | 995 | $join->on('collections.id', '=', 'r.id'); |
996 | 996 | })->update(['collections.filecheck' => self::COLLFC_COMPCOLL]); |
997 | 997 | }, 10); |
@@ -1012,25 +1012,25 @@ discard block |
||
1012 | 1012 | */ |
1013 | 1013 | private function collectionFileCheckStage2(int $groupID): void |
1014 | 1014 | { |
1015 | - DB::transaction(static function () use ($groupID) { |
|
1015 | + DB::transaction(static function() use ($groupID) { |
|
1016 | 1016 | $collectionsCheck = Collection::query()->select(['collections.id']) |
1017 | 1017 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
1018 | 1018 | ->where('binaries.filenumber', '=', 0) |
1019 | 1019 | ->where('collections.totalfiles', '>', 0) |
1020 | 1020 | ->where('collections.filecheck', '=', self::COLLFC_COMPCOLL); |
1021 | - if (! empty($groupID)) { |
|
1021 | + if (!empty($groupID)) { |
|
1022 | 1022 | $collectionsCheck->where('collections.groups_id', $groupID); |
1023 | 1023 | } |
1024 | 1024 | $collectionsCheck->groupBy('collections.id'); |
1025 | 1025 | |
1026 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
1026 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
1027 | 1027 | $join->on('collections.id', '=', 'r.id'); |
1028 | 1028 | })->update(['collections.filecheck' => self::COLLFC_ZEROPART]); |
1029 | 1029 | }, 10); |
1030 | 1030 | |
1031 | - DB::transaction(static function () use ($groupID) { |
|
1031 | + DB::transaction(static function() use ($groupID) { |
|
1032 | 1032 | $collectionQuery = Collection::query()->where('filecheck', '=', self::COLLFC_COMPCOLL); |
1033 | - if (! empty($groupID)) { |
|
1033 | + if (!empty($groupID)) { |
|
1034 | 1034 | $collectionQuery->where('groups_id', $groupID); |
1035 | 1035 | } |
1036 | 1036 | $collectionQuery->update(['filecheck' => self::COLLFC_TEMPCOMP]); |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | */ |
1049 | 1049 | private function collectionFileCheckStage3(string $where): void |
1050 | 1050 | { |
1051 | - DB::transaction(static function () use ($where) { |
|
1051 | + DB::transaction(static function() use ($where) { |
|
1052 | 1052 | DB::update( |
1053 | 1053 | sprintf( |
1054 | 1054 | ' |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | ); |
1073 | 1073 | }, 10); |
1074 | 1074 | |
1075 | - DB::transaction(static function () use ($where) { |
|
1075 | + DB::transaction(static function() use ($where) { |
|
1076 | 1076 | DB::update( |
1077 | 1077 | sprintf( |
1078 | 1078 | ' |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | */ |
1110 | 1110 | private function collectionFileCheckStage4(string &$where): void |
1111 | 1111 | { |
1112 | - DB::transaction(static function () use ($where) { |
|
1112 | + DB::transaction(static function() use ($where) { |
|
1113 | 1113 | DB::update( |
1114 | 1114 | sprintf( |
1115 | 1115 | ' |
@@ -1139,9 +1139,9 @@ discard block |
||
1139 | 1139 | */ |
1140 | 1140 | private function collectionFileCheckStage5(int $groupId): void |
1141 | 1141 | { |
1142 | - DB::transaction(static function () use ($groupId) { |
|
1142 | + DB::transaction(static function() use ($groupId) { |
|
1143 | 1143 | $collectionQuery = Collection::query()->whereIn('filecheck', [self::COLLFC_TEMPCOMP, self::COLLFC_ZEROPART]); |
1144 | - if (! empty($groupId)) { |
|
1144 | + if (!empty($groupId)) { |
|
1145 | 1145 | $collectionQuery->where('groups_id', $groupId); |
1146 | 1146 | } |
1147 | 1147 | $collectionQuery->update(['filecheck' => self::COLLFC_COMPCOLL]); |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | private function collectionFileCheckStage6(string &$where): void |
1161 | 1161 | { |
1162 | - DB::transaction(function () use ($where) { |
|
1162 | + DB::transaction(function() use ($where) { |
|
1163 | 1163 | DB::update( |
1164 | 1164 | sprintf( |
1165 | 1165 | " |
@@ -1189,10 +1189,10 @@ discard block |
||
1189 | 1189 | { |
1190 | 1190 | $lastRun = Settings::settingValue('last_run_time'); |
1191 | 1191 | |
1192 | - DB::transaction(function () use ($groupID, $lastRun) { |
|
1192 | + DB::transaction(function() use ($groupID, $lastRun) { |
|
1193 | 1193 | $objQuery = Collection::query() |
1194 | 1194 | ->where('added', '<', Carbon::createFromFormat('Y-m-d H:i:s', $lastRun)->subHours($this->collectionTimeout)); |
1195 | - if (! empty($groupID)) { |
|
1195 | + if (!empty($groupID)) { |
|
1196 | 1196 | $objQuery->where('groups_id', $groupID); |
1197 | 1197 | } |
1198 | 1198 | $obj = $objQuery->delete(); |