@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $path = $params[0]; |
50 | 50 | |
51 | 51 | // Check if the path ends with dir separator. |
52 | - if (! Str::endsWith($path, '/')) { |
|
52 | + if (!Str::endsWith($path, '/')) { |
|
53 | 53 | $path .= '/'; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Check if it's a directory. |
57 | - if (! File::isDirectory($path)) { |
|
57 | + if (!File::isDirectory($path)) { |
|
58 | 58 | $this->echoOut('Folder does not exist: '.$path); |
59 | 59 | |
60 | 60 | return $this->returnValue(); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Check if we can write to it. |
64 | - if (! is_writable($path)) { |
|
64 | + if (!is_writable($path)) { |
|
65 | 65 | $this->echoOut('Folder is not writable: '.$path); |
66 | 66 | |
67 | 67 | return $this->returnValue(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // Check if the from date is the proper format. |
71 | 71 | if (isset($params[1]) && $params[1] !== '') { |
72 | - if (! $this->checkDate($params[1])) { |
|
72 | + if (!$this->checkDate($params[1])) { |
|
73 | 73 | return $this->returnValue(); |
74 | 74 | } |
75 | 75 | $fromDate = $params[1]; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // Check if the to date is the proper format. |
79 | 79 | if (isset($params[2]) && $params[2] !== '') { |
80 | - if (! $this->checkDate($params[2])) { |
|
80 | + if (!$this->checkDate($params[2])) { |
|
81 | 81 | return $this->returnValue(); |
82 | 82 | } |
83 | 83 | $toDate = $params[2]; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | // Check if the group_id exists. |
87 | 87 | if (isset($params[3]) && $params[3] !== 0) { |
88 | - if (! is_numeric($params[3])) { |
|
88 | + if (!is_numeric($params[3])) { |
|
89 | 89 | $this->echoOut('The group ID is not a number: '.$params[3]); |
90 | 90 | |
91 | 91 | return $this->returnValue(); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | // Create a path to store the new NZB files. |
122 | 122 | $currentPath = $path.$this->safeFilename($group['name']).'/'; |
123 | - if (! File::isDirectory($currentPath) && ! File::makeDirectory($currentPath) && ! File::isDirectory($currentPath)) { |
|
123 | + if (!File::isDirectory($currentPath) && !File::makeDirectory($currentPath) && !File::isDirectory($currentPath)) { |
|
124 | 124 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $currentPath)); |
125 | 125 | } |
126 | 126 | foreach ($releases as $release) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // Check if the user wants them in gzip, copy it if so. |
142 | 142 | if ($gzip) { |
143 | - if (! copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
143 | + if (!copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
144 | 144 | if ($this->echoCLI) { |
145 | 145 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
146 | 146 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // If not, decompress it and create a file to store it in. |
151 | 151 | } else { |
152 | 152 | $nzbContents = Utility::unzipGzipFile($nzbFile); |
153 | - if (! $nzbContents) { |
|
153 | + if (!$nzbContents) { |
|
154 | 154 | if ($this->echoCLI) { |
155 | 155 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
156 | 156 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | protected function checkDate($date): bool |
192 | 192 | { |
193 | - if (! preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
193 | + if (!preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
194 | 194 | $this->echoOut('Wrong date format: '.$date); |
195 | 195 | |
196 | 196 | return false; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | GROUP BY r.id |
275 | 275 | ORDER BY %s %s %s", |
276 | 276 | $this->uSQL($userShows, 'videos_id'), |
277 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
277 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
278 | 278 | NZB::NZB_ADDED, |
279 | 279 | Category::TV_ROOT, |
280 | 280 | Category::TV_OTHER, |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | { |
345 | 345 | // Delete NZB from disk. |
346 | 346 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
347 | - if (! empty($nzbPath)) { |
|
347 | + if (!empty($nzbPath)) { |
|
348 | 348 | File::delete($nzbPath); |
349 | 349 | } |
350 | 350 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | */ |
385 | 385 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
386 | 386 | { |
387 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
387 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
388 | 388 | return false; |
389 | 389 | } |
390 | 390 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $sql = '(1=2 '; |
409 | 409 | foreach ($userQuery as $query) { |
410 | 410 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
411 | - if (! empty($query->categories)) { |
|
411 | + if (!empty($query->categories)) { |
|
412 | 412 | $catsArr = explode('|', $query->categories); |
413 | 413 | if (\count($catsArr) > 1) { |
414 | 414 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $orderBy = $this->getBrowseOrder($orderBy); |
453 | 453 | } |
454 | 454 | |
455 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
455 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
456 | 456 | return $value !== -1; |
457 | 457 | }); |
458 | 458 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
463 | 463 | } else { |
464 | 464 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
465 | - if (! empty($searchResult)) { |
|
465 | + if (!empty($searchResult)) { |
|
466 | 466 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
467 | 467 | } |
468 | 468 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
554 | 554 | } else { |
555 | 555 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
556 | - if (! empty($searchResult)) { |
|
556 | + if (!empty($searchResult)) { |
|
557 | 557 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
558 | 558 | } |
559 | 559 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
570 | 570 | $catQuery, |
571 | 571 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
572 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
572 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
573 | 573 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
574 | 574 | ); |
575 | 575 | $baseSql = sprintf( |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | if ($releases !== null) { |
604 | 604 | return $releases; |
605 | 605 | } |
606 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
606 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
607 | 607 | $releases = self::fromQuery($sql); |
608 | 608 | } elseif ($searchName !== -1 && empty($searchResult)) { |
609 | 609 | $releases = collect(); |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | ($airDate !== '' ? sprintf('AND DATE(tve.firstaired) = %s', escapeString($airDate)) : '') |
654 | 654 | ); |
655 | 655 | $show = self::fromQuery($showQry); |
656 | - if (! empty($show[0]) && $show->isNotEmpty()) { |
|
657 | - if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') { |
|
656 | + if (!empty($show[0]) && $show->isNotEmpty()) { |
|
657 | + if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') { |
|
658 | 658 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
659 | 659 | } elseif ((int) $show[0]->video > 0) { |
660 | 660 | $showSql = 'AND r.videos_id = '.$show[0]->video; |
661 | 661 | // If $series is set but episode is not, return Season Packs only |
662 | - if (! empty($series) && empty($episode)) { |
|
662 | + if (!empty($series) && empty($episode)) { |
|
663 | 663 | $showSql .= ' AND r.tv_episodes_id = 0'; |
664 | 664 | } |
665 | 665 | } else { |
@@ -672,22 +672,22 @@ discard block |
||
672 | 672 | } |
673 | 673 | } |
674 | 674 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
675 | - if (! empty($name) && $showSql === '') { |
|
676 | - if (! empty($series) && (int) $series < 1900) { |
|
675 | + if (!empty($name) && $showSql === '') { |
|
676 | + if (!empty($series) && (int) $series < 1900) { |
|
677 | 677 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
678 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
678 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
679 | 679 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
680 | 680 | } |
681 | - } elseif (! empty($airDate)) { |
|
681 | + } elseif (!empty($airDate)) { |
|
682 | 682 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
683 | 683 | } |
684 | 684 | } |
685 | - if (! empty($name)) { |
|
685 | + if (!empty($name)) { |
|
686 | 686 | if (config('nntmux.elasticsearch_enabled') === true) { |
687 | 687 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
688 | 688 | } else { |
689 | 689 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
690 | - if (! empty($searchResult)) { |
|
690 | + if (!empty($searchResult)) { |
|
691 | 691 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
692 | 692 | } |
693 | 693 | } |
@@ -703,11 +703,11 @@ discard block |
||
703 | 703 | NZB::NZB_ADDED, |
704 | 704 | $this->showPasswords(), |
705 | 705 | $showSql, |
706 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
706 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
707 | 707 | (empty($searchResult)) ? Category::getCategorySearch($cat) : '', |
708 | 708 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
709 | 709 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
710 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
710 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
711 | 711 | ); |
712 | 712 | $baseSql = sprintf( |
713 | 713 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | if ($releases !== null) { |
744 | 744 | return $releases; |
745 | 745 | } |
746 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
746 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
747 | 747 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
748 | 748 | $releases[0]->_totalrows = $this->getPagerCount( |
749 | 749 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -789,12 +789,12 @@ discard block |
||
789 | 789 | ); |
790 | 790 | $show = self::fromQuery($showQry); |
791 | 791 | if ($show->isNotEmpty()) { |
792 | - if ((! empty($series) || ! empty($episode) || ! empty($airDate)) && $show[0]->episodes !== '') { |
|
792 | + if ((!empty($series) || !empty($episode) || !empty($airDate)) && $show[0]->episodes !== '') { |
|
793 | 793 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
794 | 794 | } elseif ((int) $show[0]->video > 0) { |
795 | 795 | $showSql = 'AND r.videos_id = '.$show[0]->video; |
796 | 796 | // If $series is set but episode is not, return Season Packs only |
797 | - if (! empty($series) && empty($episode)) { |
|
797 | + if (!empty($series) && empty($episode)) { |
|
798 | 798 | $showSql .= ' AND r.tv_episodes_id = 0'; |
799 | 799 | } |
800 | 800 | } else { |
@@ -807,22 +807,22 @@ discard block |
||
807 | 807 | } |
808 | 808 | } |
809 | 809 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
810 | - if (! empty($name) && $showSql === '') { |
|
811 | - if (! empty($series) && (int) $series < 1900) { |
|
810 | + if (!empty($name) && $showSql === '') { |
|
811 | + if (!empty($series) && (int) $series < 1900) { |
|
812 | 812 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
813 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
813 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
814 | 814 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
815 | 815 | } |
816 | - } elseif (! empty($airDate)) { |
|
816 | + } elseif (!empty($airDate)) { |
|
817 | 817 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
818 | 818 | } |
819 | 819 | } |
820 | - if (! empty($name)) { |
|
820 | + if (!empty($name)) { |
|
821 | 821 | if (config('nntmux.elasticsearch_enabled') === true) { |
822 | 822 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
823 | 823 | } else { |
824 | 824 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
825 | - if (! empty($searchResult)) { |
|
825 | + if (!empty($searchResult)) { |
|
826 | 826 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
827 | 827 | } |
828 | 828 | } |
@@ -838,11 +838,11 @@ discard block |
||
838 | 838 | NZB::NZB_ADDED, |
839 | 839 | $this->showPasswords(), |
840 | 840 | $showSql, |
841 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
841 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
842 | 842 | Category::getCategorySearch($cat), |
843 | 843 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
844 | 844 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
845 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
845 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
846 | 846 | ); |
847 | 847 | $baseSql = sprintf( |
848 | 848 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -892,12 +892,12 @@ discard block |
||
892 | 892 | */ |
893 | 893 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
894 | 894 | { |
895 | - if (! empty($name)) { |
|
895 | + if (!empty($name)) { |
|
896 | 896 | if (config('nntmux.elasticsearch_enabled') === true) { |
897 | 897 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
898 | 898 | } else { |
899 | 899 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
900 | - if (! empty($searchResult)) { |
|
900 | + if (!empty($searchResult)) { |
|
901 | 901 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
902 | 902 | } |
903 | 903 | } |
@@ -914,8 +914,8 @@ discard block |
||
914 | 914 | $this->showPasswords(), |
915 | 915 | NZB::NZB_ADDED, |
916 | 916 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
917 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
918 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
917 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
918 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
919 | 919 | Category::getCategorySearch($cat), |
920 | 920 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
921 | 921 | ); |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | */ |
965 | 965 | public function moviesSearch(int $imDbId = -1, int $tmDbId = -1, int $traktId = -1, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, int $minSize = 0, array $excludedCategories = []): mixed |
966 | 966 | { |
967 | - if (! empty($name)) { |
|
967 | + if (!empty($name)) { |
|
968 | 968 | if (config('nntmux.elasticsearch_enabled') === true) { |
969 | 969 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
970 | 970 | } else { |
971 | 971 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
972 | - if (! empty($searchResult)) { |
|
972 | + if (!empty($searchResult)) { |
|
973 | 973 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
974 | 974 | } |
975 | 975 | } |
@@ -986,11 +986,11 @@ discard block |
||
986 | 986 | %s %s %s %s %s %s %s', |
987 | 987 | NZB::NZB_ADDED, |
988 | 988 | $this->showPasswords(), |
989 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
989 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
990 | 990 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
991 | 991 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
992 | 992 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
993 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
993 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
994 | 994 | Category::getCategorySearch($cat), |
995 | 995 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
996 | 996 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $parentCat = $catRow['root_categories_id']; |
1043 | 1043 | |
1044 | 1044 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1045 | - if (! $results) { |
|
1045 | + if (!$results) { |
|
1046 | 1046 | return $ret; |
1047 | 1047 | } |
1048 | 1048 |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | |
378 | 378 | $done = false; |
379 | 379 | // Get all the parts (in portions of $this->messageBuffer to not use too much memory). |
380 | - while (! $done) { |
|
380 | + while (!$done) { |
|
381 | 381 | // Increment last until we reach $groupLast (group newest article). |
382 | 382 | if ($total > $this->messageBuffer) { |
383 | 383 | if ((string) ($first + $this->messageBuffer) > $groupLast) { |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $scanSummary = $this->scan($groupMySQL, $first, $last); |
402 | 402 | |
403 | 403 | // Check if we fetched headers. |
404 | - if (! empty($scanSummary)) { |
|
404 | + if (!empty($scanSummary)) { |
|
405 | 405 | // If new group, update first record & postdate |
406 | 406 | if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] === 0) { |
407 | 407 | $groupMySQL['first_record'] = $scanSummary['firstArticleNumber']; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | $scanSummary['lastArticleDate'] = (isset($scanSummary['lastArticleDate']) ? strtotime($scanSummary['lastArticleDate']) : false); |
428 | - if (! is_numeric($scanSummary['lastArticleDate'])) { |
|
428 | + if (!is_numeric($scanSummary['lastArticleDate'])) { |
|
429 | 429 | $scanSummary['lastArticleDate'] = $this->postdate($scanSummary['lastArticleNumber'], $groupNNTP); |
430 | 430 | } |
431 | 431 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | |
575 | 575 | // If set we are running in partRepair mode. |
576 | 576 | if ($partRepair && $missingParts !== null) { |
577 | - if (! \in_array($header['Number'], $missingParts, false)) { |
|
577 | + if (!\in_array($header['Number'], $missingParts, false)) { |
|
578 | 578 | // If article isn't one that is missing skip it. |
579 | 579 | continue; |
580 | 580 | } |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | |
620 | 620 | unset($headers); // Reclaim memory now that headers are split. |
621 | 621 | |
622 | - if (! empty($this->_binaryBlacklistIdsToUpdate)) { |
|
622 | + if (!empty($this->_binaryBlacklistIdsToUpdate)) { |
|
623 | 623 | $this->updateBlacklistUsage(); |
624 | 624 | } |
625 | 625 | |
626 | - if ($this->_echoCLI && ! $partRepair) { |
|
626 | + if ($this->_echoCLI && !$partRepair) { |
|
627 | 627 | $this->outputHeaderInitial(); |
628 | 628 | } |
629 | 629 | |
630 | - if (! empty($stdHeaders)) { |
|
630 | + if (!empty($stdHeaders)) { |
|
631 | 631 | $this->storeHeaders($stdHeaders); |
632 | 632 | } |
633 | 633 | unset($stdHeaders); |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | // Loop articles, figure out files/parts. |
703 | 703 | foreach ($headers as $this->header) { |
704 | 704 | // Set up the info for inserting into parts/binaries/collections tables. |
705 | - if (! isset($articles[$this->header['matches'][1]])) { |
|
705 | + if (!isset($articles[$this->header['matches'][1]])) { |
|
706 | 706 | // Attempt to find the file count. If it is not found, set it to 0. |
707 | 707 | $fileCount = $this->getFileCount($this->header['matches'][1]); |
708 | 708 | if ($fileCount[1] === 0 && $fileCount[3] === 0) { |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | $this->header['CollectionKey'] = $collMatch['name'].$fileCount[3]; |
718 | 718 | |
719 | 719 | // If this header's collection key isn't in memory, attempt to insert the collection |
720 | - if (! isset($collectionIDs[$this->header['CollectionKey']])) { |
|
720 | + if (!isset($collectionIDs[$this->header['CollectionKey']])) { |
|
721 | 721 | /* Date from header should be a string this format: |
722 | 722 | * 31 Mar 2014 15:36:04 GMT or 6 Oct 1998 04:38:40 -0500 |
723 | 723 | * Still make sure it's not unix time, convert it to unix time if it is. |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | |
749 | 749 | $finalXrefArray = []; |
750 | 750 | foreach ($tempHeaderXrefs as $tempHeaderXref) { |
751 | - if (! in_array($tempHeaderXref, $tempXrefsData, false)) { |
|
751 | + if (!in_array($tempHeaderXref, $tempXrefsData, false)) { |
|
752 | 752 | $finalXrefArray[] = $tempHeaderXref; |
753 | 753 | } |
754 | 754 | } |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | $iterator1 = 0; |
889 | 889 | $iterator2 = $msgCount - 1; |
890 | 890 | while (true) { |
891 | - if (! isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
891 | + if (!isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) { |
|
892 | 892 | $returnArray['firstArticleNumber'] = $headers[$iterator1]['Number']; |
893 | 893 | $returnArray['firstArticleDate'] = $headers[$iterator1]['Date']; |
894 | 894 | } |
895 | 895 | |
896 | - if (! isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
896 | + if (!isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) { |
|
897 | 897 | $returnArray['lastArticleNumber'] = $headers[$iterator2]['Number']; |
898 | 898 | $returnArray['lastArticleDate'] = $headers[$iterator2]['Date']; |
899 | 899 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // Remove articles that we cant fetch after x attempts. |
1070 | - DB::transaction(function () use ($groupArr) { |
|
1070 | + DB::transaction(function() use ($groupArr) { |
|
1071 | 1071 | DB::delete( |
1072 | 1072 | sprintf( |
1073 | 1073 | 'DELETE FROM missed_parts WHERE attempts >= %d AND groups_id = %d', |
@@ -1106,14 +1106,14 @@ discard block |
||
1106 | 1106 | $currentPost |
1107 | 1107 | ) |
1108 | 1108 | ); |
1109 | - if (! empty($local) && \count($local) > 0) { |
|
1109 | + if (!empty($local) && \count($local) > 0) { |
|
1110 | 1110 | $date = $local[0]->date; |
1111 | 1111 | break; |
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | // If we could not find it locally, try usenet. |
1115 | 1115 | $header = $this->_nntp->getXOVER($currentPost); |
1116 | - if (! $this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1116 | + if (!$this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') { |
|
1117 | 1117 | $date = $header[0]['Date']; |
1118 | 1118 | break; |
1119 | 1119 | } |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | } while ($attempts++ <= 20); |
1139 | 1139 | |
1140 | 1140 | // If we didn't get a date, set it to now. |
1141 | - if (! $date) { |
|
1141 | + if (!$date) { |
|
1142 | 1142 | $date = time(); |
1143 | 1143 | } else { |
1144 | 1144 | $date = strtotime($date); |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $articleTime = $this->postdate($wantedArticle, $data); |
1202 | 1202 | |
1203 | 1203 | // Article doesn't exist, start again with something random |
1204 | - if (! $articleTime) { |
|
1204 | + if (!$articleTime) { |
|
1205 | 1205 | $wantedArticle = random_int($aMin, $aMax); |
1206 | 1206 | $articleTime = $this->postdate($wantedArticle, $data); |
1207 | 1207 | } |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | foreach ($numbers as $number) { |
1274 | 1274 | $sql .= $number.','; |
1275 | 1275 | } |
1276 | - DB::transaction(static function () use ($groupID, $sql) { |
|
1276 | + DB::transaction(static function() use ($groupID, $sql) { |
|
1277 | 1277 | DB::delete(rtrim($sql, ',').') AND groups_id = '.$groupID); |
1278 | 1278 | }, 10); |
1279 | 1279 | } |
@@ -1288,10 +1288,10 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | protected function _retrieveBlackList(string $groupName): void |
1290 | 1290 | { |
1291 | - if (! isset($this->blackList[$groupName])) { |
|
1291 | + if (!isset($this->blackList[$groupName])) { |
|
1292 | 1292 | $this->blackList[$groupName] = $this->getBlacklist(true, self::OPTYPE_BLACKLIST, $groupName, true); |
1293 | 1293 | } |
1294 | - if (! isset($this->whiteList[$groupName])) { |
|
1294 | + if (!isset($this->whiteList[$groupName])) { |
|
1295 | 1295 | $this->whiteList[$groupName] = $this->getBlacklist(true, self::OPTYPE_WHITELIST, $groupName, true); |
1296 | 1296 | } |
1297 | 1297 | $this->_listsFound[$groupName] = ($this->blackList[$groupName] || $this->whiteList[$groupName]); |
@@ -1305,10 +1305,10 @@ discard block |
||
1305 | 1305 | */ |
1306 | 1306 | public function isBlackListed(array $msg, string $groupName): bool |
1307 | 1307 | { |
1308 | - if (! isset($this->_listsFound[$groupName])) { |
|
1308 | + if (!isset($this->_listsFound[$groupName])) { |
|
1309 | 1309 | $this->_retrieveBlackList($groupName); |
1310 | 1310 | } |
1311 | - if (! $this->_listsFound[$groupName]) { |
|
1311 | + if (!$this->_listsFound[$groupName]) { |
|
1312 | 1312 | return false; |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | |
1337 | 1337 | // Check if the field is blacklisted. |
1338 | 1338 | |
1339 | - if (! $blackListed && $this->blackList[$groupName]) { |
|
1339 | + if (!$blackListed && $this->blackList[$groupName]) { |
|
1340 | 1340 | foreach ($this->blackList[$groupName] as $blackList) { |
1341 | 1341 | if (preg_match('/'.$blackList->regex.'/i', $field[$blackList->msgcol])) { |
1342 | 1342 | $blackListed = true; |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | */ |
1447 | 1447 | public function delete(int $collectionID): void |
1448 | 1448 | { |
1449 | - DB::transaction(static function () use ($collectionID) { |
|
1449 | + DB::transaction(static function() use ($collectionID) { |
|
1450 | 1450 | DB::delete(sprintf('DELETE FROM collections WHERE id = %d', $collectionID)); |
1451 | 1451 | }, 10); |
1452 | 1452 | |
@@ -1493,7 +1493,7 @@ discard block |
||
1493 | 1493 | |
1494 | 1494 | private function getFileCount($subject): array |
1495 | 1495 | { |
1496 | - if (! preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) { |
|
1496 | + if (!preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) { |
|
1497 | 1497 | $fileCount[1] = $fileCount[3] = 0; |
1498 | 1498 | } |
1499 | 1499 |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $this->config->language = $this->lookuplanguage; |
138 | 138 | $this->config->throwHttpExceptions = false; |
139 | 139 | $cacheDir = storage_path('framework/cache/imdb_cache'); |
140 | - if (! File::isDirectory($cacheDir)) { |
|
140 | + if (!File::isDirectory($cacheDir)) { |
|
141 | 141 | File::makeDirectory($cacheDir, 0777, false, true); |
142 | 142 | } |
143 | 143 | $this->config->cachedir = $cacheDir; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | ORDER BY %s %s %s", |
191 | 191 | $this->showPasswords, |
192 | 192 | $this->getBrowseBy(), |
193 | - (! empty($catsrch) ? $catsrch : ''), |
|
193 | + (!empty($catsrch) ? $catsrch : ''), |
|
194 | 194 | ( |
195 | 195 | $maxAge > 0 |
196 | 196 | ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | Cache::put(md5($moviesSql.$page), $movies, $expiresAt); |
211 | 211 | } |
212 | 212 | $movieIDs = $releaseIDs = []; |
213 | - if (! empty($movies['result'])) { |
|
213 | + if (!empty($movies['result'])) { |
|
214 | 214 | foreach ($movies['result'] as $movie => $id) { |
215 | 215 | $movieIDs[] = $id->imdbid; |
216 | 216 | $releaseIDs[] = $id->grp_release_id; |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | AND r.id IN (%s) %s |
250 | 250 | GROUP BY m.imdbid |
251 | 251 | ORDER BY %s %s", |
252 | - (\is_array($movieIDs) && ! empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
253 | - (\is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
254 | - (! empty($catsrch) ? $catsrch : ''), |
|
252 | + (\is_array($movieIDs) && !empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
253 | + (\is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
254 | + (!empty($catsrch) ? $catsrch : ''), |
|
255 | 255 | $order[0], |
256 | 256 | $order[1] |
257 | 257 | ); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $browseBy = ' '; |
298 | 298 | $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb']; |
299 | 299 | foreach ($browseByArr as $bb) { |
300 | - if (request()->has($bb) && ! empty(request()->input($bb))) { |
|
300 | + if (request()->has($bb) && !empty(request()->input($bb))) { |
|
301 | 301 | $bbv = stripslashes(request()->input($bb)); |
302 | 302 | if ($bb === 'rating') { |
303 | 303 | $bbv .= '.'; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | if ($this->traktcheck !== null) { |
332 | 332 | $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full'); |
333 | - if (($data !== false) && ! empty($data['trailer'])) { |
|
333 | + if (($data !== false) && !empty($data['trailer'])) { |
|
334 | 334 | return $data['trailer']; |
335 | 335 | } |
336 | 336 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | return false; |
357 | 357 | } |
358 | 358 | |
359 | - if (! empty($data['trailer'])) { |
|
359 | + if (!empty($data['trailer'])) { |
|
360 | 360 | $data['trailer'] = str_ireplace( |
361 | 361 | ['watch?v=', 'http://'], |
362 | 362 | ['embed/', 'https://'], |
@@ -390,17 +390,17 @@ discard block |
||
390 | 390 | */ |
391 | 391 | private function checkTraktValue($value) |
392 | 392 | { |
393 | - if (\is_array($value) && ! empty($value)) { |
|
393 | + if (\is_array($value) && !empty($value)) { |
|
394 | 394 | $temp = ''; |
395 | 395 | foreach ($value as $val) { |
396 | - if (! \is_array($val) && ! \is_object($val)) { |
|
396 | + if (!\is_array($val) && !\is_object($val)) { |
|
397 | 397 | $temp .= $val; |
398 | 398 | } |
399 | 399 | } |
400 | 400 | $value = $temp; |
401 | 401 | } |
402 | 402 | |
403 | - return ! empty($value) ? $value : ''; |
|
403 | + return !empty($value) ? $value : ''; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function update(array $values): bool |
423 | 423 | { |
424 | - if (! \count($values)) { |
|
424 | + if (!\count($values)) { |
|
425 | 425 | return false; |
426 | 426 | } |
427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $onDuplicateKey = ['created_at' => now()]; |
430 | 430 | $found = 0; |
431 | 431 | foreach ($values as $key => $value) { |
432 | - if (! empty($value)) { |
|
432 | + if (!empty($value)) { |
|
433 | 433 | $found++; |
434 | 434 | if (\in_array($key, ['genre', 'language'], false)) { |
435 | 435 | $value = substr($value, 0, 64); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $onDuplicateKey += [$key => $value]; |
439 | 439 | } |
440 | 440 | } |
441 | - if (! $found) { |
|
441 | + if (!$found) { |
|
442 | 442 | return false; |
443 | 443 | } |
444 | 444 | foreach ($query as $key => $value) { |
@@ -455,19 +455,19 @@ discard block |
||
455 | 455 | */ |
456 | 456 | protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5) |
457 | 457 | { |
458 | - if (! empty($variable1)) { |
|
458 | + if (!empty($variable1)) { |
|
459 | 459 | return $variable1; |
460 | 460 | } |
461 | - if (! empty($variable2)) { |
|
461 | + if (!empty($variable2)) { |
|
462 | 462 | return $variable2; |
463 | 463 | } |
464 | - if (! empty($variable3)) { |
|
464 | + if (!empty($variable3)) { |
|
465 | 465 | return $variable3; |
466 | 466 | } |
467 | - if (! empty($variable4)) { |
|
467 | + if (!empty($variable4)) { |
|
468 | 468 | return $variable4; |
469 | 469 | } |
470 | - if (! empty($variable5)) { |
|
470 | + if (!empty($variable5)) { |
|
471 | 471 | return $variable5; |
472 | 472 | } |
473 | 473 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | $iTunes = $this->fetchItunesMovieProperties($this->currentTitle); |
504 | 504 | |
505 | - if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) { |
|
505 | + if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) { |
|
506 | 506 | return false; |
507 | 507 | } |
508 | 508 | |
@@ -515,36 +515,36 @@ discard block |
||
515 | 515 | $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = ''; |
516 | 516 | |
517 | 517 | $mov['imdbid'] = $imdbId; |
518 | - $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
519 | - $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
518 | + $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
519 | + $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
520 | 520 | |
521 | 521 | // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes. |
522 | - if (! empty($fanart['cover'])) { |
|
522 | + if (!empty($fanart['cover'])) { |
|
523 | 523 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath); |
524 | - } elseif (! empty($tmdb['cover'])) { |
|
524 | + } elseif (!empty($tmdb['cover'])) { |
|
525 | 525 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath); |
526 | - } elseif (! empty($imdb['cover'])) { |
|
526 | + } elseif (!empty($imdb['cover'])) { |
|
527 | 527 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath); |
528 | - } elseif (! empty($omdb['cover'])) { |
|
528 | + } elseif (!empty($omdb['cover'])) { |
|
529 | 529 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath); |
530 | - } elseif (! empty($iTunes['cover'])) { |
|
530 | + } elseif (!empty($iTunes['cover'])) { |
|
531 | 531 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath); |
532 | 532 | } |
533 | 533 | |
534 | 534 | // Backdrops. |
535 | - if (! empty($fanart['backdrop'])) { |
|
535 | + if (!empty($fanart['backdrop'])) { |
|
536 | 536 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024); |
537 | - } elseif (! empty($tmdb['backdrop'])) { |
|
537 | + } elseif (!empty($tmdb['backdrop'])) { |
|
538 | 538 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024); |
539 | 539 | } |
540 | 540 | |
541 | 541 | // Banner |
542 | - if (! empty($fanart['banner'])) { |
|
542 | + if (!empty($fanart['banner'])) { |
|
543 | 543 | $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath); |
544 | 544 | } |
545 | 545 | |
546 | 546 | // RottenTomatoes rating from OmdbAPI |
547 | - if ($omdb !== false && ! empty($omdb['rtRating'])) { |
|
547 | + if ($omdb !== false && !empty($omdb['rtRating'])) { |
|
548 | 548 | $mov['rtrating'] = $omdb['rtRating']; |
549 | 549 | } |
550 | 550 | |
@@ -555,29 +555,29 @@ discard block |
||
555 | 555 | $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? ''); |
556 | 556 | $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? ''); |
557 | 557 | |
558 | - if (! empty($imdb['type'])) { |
|
558 | + if (!empty($imdb['type'])) { |
|
559 | 559 | $mov['type'] = $imdb['type']; |
560 | 560 | } |
561 | 561 | |
562 | - if (! empty($imdb['director'])) { |
|
562 | + if (!empty($imdb['director'])) { |
|
563 | 563 | $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director']; |
564 | - } elseif (! empty($omdb['director'])) { |
|
564 | + } elseif (!empty($omdb['director'])) { |
|
565 | 565 | $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director']; |
566 | - } elseif (! empty($tmdb['director'])) { |
|
566 | + } elseif (!empty($tmdb['director'])) { |
|
567 | 567 | $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director']; |
568 | 568 | } |
569 | 569 | |
570 | - if (! empty($imdb['actors'])) { |
|
570 | + if (!empty($imdb['actors'])) { |
|
571 | 571 | $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors']; |
572 | - } elseif (! empty($omdb['actors'])) { |
|
572 | + } elseif (!empty($omdb['actors'])) { |
|
573 | 573 | $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors']; |
574 | - } elseif (! empty($tmdb['actors'])) { |
|
574 | + } elseif (!empty($tmdb['actors'])) { |
|
575 | 575 | $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors']; |
576 | 576 | } |
577 | 577 | |
578 | - if (! empty($imdb['language'])) { |
|
578 | + if (!empty($imdb['language'])) { |
|
579 | 579 | $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language']; |
580 | - } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) { |
|
580 | + } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) { |
|
581 | 581 | $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language']; |
582 | 582 | } |
583 | 583 | |
@@ -635,20 +635,20 @@ discard block |
||
635 | 635 | if ($this->fanartapikey !== null) { |
636 | 636 | $art = $this->fanart->getMovieFanArt('tt'.$imdbId); |
637 | 637 | |
638 | - if (! empty($art)) { |
|
638 | + if (!empty($art)) { |
|
639 | 639 | if (isset($art['status']) && $art['status'] === 'error') { |
640 | 640 | return false; |
641 | 641 | } |
642 | 642 | $ret = []; |
643 | - if (! empty($art['moviebackground'][0]['url'])) { |
|
643 | + if (!empty($art['moviebackground'][0]['url'])) { |
|
644 | 644 | $ret['backdrop'] = $art['moviebackground'][0]['url']; |
645 | - } elseif (! empty($art['moviethumb'][0]['url'])) { |
|
645 | + } elseif (!empty($art['moviethumb'][0]['url'])) { |
|
646 | 646 | $ret['backdrop'] = $art['moviethumb'][0]['url']; |
647 | 647 | } |
648 | - if (! empty($art['movieposter'][0]['url'])) { |
|
648 | + if (!empty($art['movieposter'][0]['url'])) { |
|
649 | 649 | $ret['cover'] = $art['movieposter'][0]['url']; |
650 | 650 | } |
651 | - if (! empty($art['moviebanner'][0]['url'])) { |
|
651 | + if (!empty($art['moviebanner'][0]['url'])) { |
|
652 | 652 | $ret['banner'] = $art['moviebanner'][0]['url']; |
653 | 653 | } |
654 | 654 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | return false; |
686 | 686 | } |
687 | 687 | |
688 | - if (! empty($tmdbLookup)) { |
|
688 | + if (!empty($tmdbLookup)) { |
|
689 | 689 | if ($this->currentTitle !== '') { |
690 | 690 | // Check the similarity. |
691 | 691 | similar_text($this->currentTitle, $tmdbLookup['title'], $percent); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | $ret['rating'] = ''; |
715 | 715 | } |
716 | 716 | $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name'); |
717 | - if (! empty($actors)) { |
|
717 | + if (!empty($actors)) { |
|
718 | 718 | $ret['actors'] = $actors; |
719 | 719 | } else { |
720 | 720 | $ret['actors'] = ''; |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | } |
726 | 726 | } |
727 | 727 | $overview = $tmdbLookup['overview']; |
728 | - if (! empty($overview)) { |
|
728 | + if (!empty($overview)) { |
|
729 | 729 | $ret['plot'] = $overview; |
730 | 730 | } else { |
731 | 731 | $ret['plot'] = ''; |
@@ -735,13 +735,13 @@ discard block |
||
735 | 735 | $ret['tagline'] = $tagline ?? ''; |
736 | 736 | |
737 | 737 | $released = $tmdbLookup['release_date']; |
738 | - if (! empty($released)) { |
|
738 | + if (!empty($released)) { |
|
739 | 739 | $ret['year'] = Carbon::parse($released)->year; |
740 | 740 | } else { |
741 | 741 | $ret['year'] = ''; |
742 | 742 | } |
743 | 743 | $genresa = $tmdbLookup['genres']; |
744 | - if (! empty($genresa) && \count($genresa) > 0) { |
|
744 | + if (!empty($genresa) && \count($genresa) > 0) { |
|
745 | 745 | $genres = []; |
746 | 746 | foreach ($genresa as $genre) { |
747 | 747 | $genres[] = $genre['name']; |
@@ -751,13 +751,13 @@ discard block |
||
751 | 751 | $ret['genre'] = ''; |
752 | 752 | } |
753 | 753 | $posterp = $tmdbLookup['poster_path']; |
754 | - if (! empty($posterp)) { |
|
754 | + if (!empty($posterp)) { |
|
755 | 755 | $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp; |
756 | 756 | } else { |
757 | 757 | $ret['cover'] = ''; |
758 | 758 | } |
759 | 759 | $backdrop = $tmdbLookup['backdrop_path']; |
760 | - if (! empty($backdrop)) { |
|
760 | + if (!empty($backdrop)) { |
|
761 | 761 | $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop; |
762 | 762 | } else { |
763 | 763 | $ret['backdrop'] = ''; |
@@ -779,9 +779,9 @@ discard block |
||
779 | 779 | { |
780 | 780 | $realId = (new Title($imdbId, $this->config))->real_id(); |
781 | 781 | $result = new Title($realId, $this->config); |
782 | - $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
783 | - if (! empty($title)) { |
|
784 | - if (! empty($this->currentTitle)) { |
|
782 | + $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
783 | + if (!empty($title)) { |
|
784 | + if (!empty($this->currentTitle)) { |
|
785 | 785 | similar_text($this->currentTitle, $title, $percent); |
786 | 786 | if ($percent >= self::MATCH_PERCENT) { |
787 | 787 | similar_text($this->currentYear, $result->year(), $percent); |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | 'title' => $title, |
791 | 791 | 'tagline' => $result->tagline() ?? '', |
792 | 792 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
793 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
793 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
794 | 794 | 'year' => $result->year() ?? '', |
795 | 795 | 'cover' => $result->photo() ?? '', |
796 | 796 | 'genre' => $result->genre() ?? '', |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | 'title' => $title, |
816 | 816 | 'tagline' => $result->tagline() ?? '', |
817 | 817 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
818 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
818 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
819 | 819 | 'year' => $result->year() ?? '', |
820 | 820 | 'cover' => $result->photo() ?? '', |
821 | 821 | 'genre' => $result->genre() ?? '', |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | if ($this->omdbapikey !== null) { |
890 | 890 | $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId); |
891 | 891 | |
892 | - if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
892 | + if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
893 | 893 | similar_text($this->currentTitle, $resp->data->Title, $percent); |
894 | 894 | if ($percent >= self::MATCH_PERCENT) { |
895 | 895 | similar_text($this->currentYear, $resp->data->Year, $percent); |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | // Loop over releases. |
1056 | 1056 | foreach ($res as $arr) { |
1057 | 1057 | // Try to get a name/year. |
1058 | - if (! $this->parseMovieSearchName($arr['searchname'])) { |
|
1058 | + if (!$this->parseMovieSearchName($arr['searchname'])) { |
|
1059 | 1059 | //We didn't find a name, so set to all 0's so we don't parse again. |
1060 | 1060 | Release::query()->where('id', $arr['id'])->update(['imdbid' => null]); |
1061 | 1061 | |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | $imdbSearch = new TitleSearch($this->config); |
1090 | 1090 | foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) { |
1091 | 1091 | try { |
1092 | - if (! empty($imdbTitle->orig_title())) { |
|
1092 | + if (!empty($imdbTitle->orig_title())) { |
|
1093 | 1093 | similar_text($imdbTitle->orig_title(), $this->currentTitle, $percent); |
1094 | 1094 | if ($percent >= self::MATCH_PERCENT) { |
1095 | 1095 | similar_text($this->currentYear, $imdbTitle->year(), $percent); |
@@ -1119,10 +1119,10 @@ discard block |
||
1119 | 1119 | $buffer = $this->omdbApi->search($omdbTitle, 'movie'); |
1120 | 1120 | } |
1121 | 1121 | |
1122 | - if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
1122 | + if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
1123 | 1123 | $getIMDBid = $buffer->data->Search[0]->imdbID; |
1124 | 1124 | |
1125 | - if (! empty($getIMDBid)) { |
|
1125 | + if (!empty($getIMDBid)) { |
|
1126 | 1126 | $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']); |
1127 | 1127 | if ($imdbId !== false) { |
1128 | 1128 | $movieUpdated = true; |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | $data = $this->traktTv->client->movieSummary($movieName, 'full'); |
1138 | 1138 | if ($data !== false) { |
1139 | 1139 | $this->parseTraktTv($data); |
1140 | - if (! empty($data['ids']['imdb'])) { |
|
1140 | + if (!empty($data['ids']['imdb'])) { |
|
1141 | 1141 | $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']); |
1142 | 1142 | if ($imdbId !== false) { |
1143 | 1143 | $movieUpdated = true; |
@@ -1150,13 +1150,13 @@ discard block |
||
1150 | 1150 | if ($movieUpdated === false) { |
1151 | 1151 | try { |
1152 | 1152 | $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle); |
1153 | - if (($data['total_results'] > 0) && ! empty($data['results'])) { |
|
1153 | + if (($data['total_results'] > 0) && !empty($data['results'])) { |
|
1154 | 1154 | foreach ($data['results'] as $result) { |
1155 | - if (! empty($result['id']) && ! empty($result['release_date'])) { |
|
1155 | + if (!empty($result['id']) && !empty($result['release_date'])) { |
|
1156 | 1156 | similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent); |
1157 | 1157 | if ($percent >= self::YEAR_MATCH_PERCENT) { |
1158 | 1158 | $ret = $this->fetchTMDBProperties($result['id'], true); |
1159 | - if ($ret !== false && ! empty($ret['imdbid'])) { |
|
1159 | + if ($ret !== false && !empty($ret['imdbid'])) { |
|
1160 | 1160 | $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']); |
1161 | 1161 | if ($imdbId !== false) { |
1162 | 1162 | $movieUpdated = true; |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | // Finally remove multiple spaces and trim leading spaces. |
1258 | 1258 | $name = trim(preg_replace('/\s{2,}/', ' ', $name)); |
1259 | 1259 | // Check if the name is long enough and not just numbers. |
1260 | - if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) { |
|
1260 | + if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) { |
|
1261 | 1261 | $this->currentTitle = $name; |
1262 | 1262 | $this->currentYear = $year; |
1263 | 1263 |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $this->echoCLI = config('nntmux.echocli'); |
111 | 111 | $groupID = ''; |
112 | 112 | |
113 | - if (! empty($groupName)) { |
|
113 | + if (!empty($groupName)) { |
|
114 | 114 | $groupInfo = UsenetGroup::getByName($groupName); |
115 | 115 | if ($groupInfo !== null) { |
116 | 116 | $groupID = $groupInfo['id']; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->colorCLI->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')'); |
122 | 122 | } |
123 | 123 | |
124 | - if (! file_exists(Settings::settingValue('..nzbpath'))) { |
|
124 | + if (!file_exists(Settings::settingValue('..nzbpath'))) { |
|
125 | 125 | if ($this->echoCLI) { |
126 | 126 | $this->colorCLI->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath')); |
127 | 127 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $cat = new Categorize(); |
183 | 183 | $categorized = $total = 0; |
184 | 184 | $releasesQuery = Release::query()->where(['categories_id' => Category::OTHER_MISC, 'iscategorized' => 0]); |
185 | - if (! empty($groupId)) { |
|
185 | + if (!empty($groupId)) { |
|
186 | 186 | $releasesQuery->where('groups_id', $groupId); |
187 | 187 | } |
188 | 188 | $releases = $releasesQuery->select(['id', 'fromname', 'groups_id', $type])->get(); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $this->colorCLI->header('Process Releases -> Attempting to find complete collections.'); |
219 | 219 | } |
220 | 220 | |
221 | - $where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
221 | + $where = (!empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' '); |
|
222 | 222 | |
223 | 223 | $this->processStuckCollections($groupID); |
224 | 224 | $this->collectionFileCheckStage1($groupID); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($this->echoCLI) { |
232 | 232 | $countQuery = Collection::query()->where('filecheck', self::COLLFC_COMPPART); |
233 | 233 | |
234 | - if (! empty($groupID)) { |
|
234 | + if (!empty($groupID)) { |
|
235 | 235 | $countQuery->where('groups_id', $groupID); |
236 | 236 | } |
237 | 237 | $count = $countQuery->count('id'); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $this->colorCLI->header('Process Releases -> Calculating collection sizes (in bytes).'); |
259 | 259 | } |
260 | 260 | // Get the total size in bytes of the collection for collections where filecheck = 2. |
261 | - DB::transaction(function () use ($groupID, $startTime) { |
|
261 | + DB::transaction(function() use ($groupID, $startTime) { |
|
262 | 262 | $checked = DB::update( |
263 | 263 | sprintf( |
264 | 264 | ' |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | AND c.filesize = 0 %s', |
275 | 275 | self::COLLFC_SIZED, |
276 | 276 | self::COLLFC_COMPPART, |
277 | - (! empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
277 | + (!empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ') |
|
278 | 278 | ) |
279 | 279 | ); |
280 | 280 | if ($checked > 0 && $this->echoCLI) { |
@@ -313,16 +313,16 @@ discard block |
||
313 | 313 | |
314 | 314 | $groupMinimums = UsenetGroup::getGroupByID($grpID['id']); |
315 | 315 | if ($groupMinimums !== null) { |
316 | - if (! empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
316 | + if (!empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) { |
|
317 | 317 | $groupMinSizeSetting = (int) $groupMinimums['minsizetoformrelease']; |
318 | 318 | } |
319 | - if (! empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
319 | + if (!empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) { |
|
320 | 320 | $groupMinFilesSetting = (int) $groupMinimums['minfilestoformrelease']; |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | if (Collection::query()->where('filecheck', self::COLLFC_SIZED)->where('filesize', '>', 0)->first() !== null) { |
325 | - DB::transaction(function () use ( |
|
325 | + DB::transaction(function() use ( |
|
326 | 326 | $groupMinSizeSetting, |
327 | 327 | $minSizeSetting, |
328 | 328 | $minSizeDeleted, |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $collectionsQuery = Collection::query() |
396 | 396 | ->where('collections.filecheck', self::COLLFC_SIZED) |
397 | 397 | ->where('collections.filesize', '>', 0); |
398 | - if (! empty($groupID)) { |
|
398 | + if (!empty($groupID)) { |
|
399 | 399 | $collectionsQuery->where('collections.groups_id', $groupID); |
400 | 400 | } |
401 | 401 | $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname']) |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $releaseID = Release::insertRelease( |
451 | 451 | [ |
452 | 452 | 'name' => $cleanRelName, |
453 | - 'searchname' => ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
453 | + 'searchname' => !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName, |
|
454 | 454 | 'totalpart' => $collection->totalfiles, |
455 | 455 | 'groups_id' => $collection->groups_id, |
456 | 456 | 'guid' => createGUID(), |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | if ($releaseID !== null) { |
468 | 468 | // Update collections table to say we inserted the release. |
469 | - DB::transaction(static function () use ($collection, $releaseID) { |
|
469 | + DB::transaction(static function() use ($collection, $releaseID) { |
|
470 | 470 | Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]); |
471 | 471 | }, 10); |
472 | 472 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | } |
528 | 528 | } else { |
529 | 529 | // The release was already in the DB, so delete the collection. |
530 | - DB::transaction(static function () use ($collection) { |
|
530 | + DB::transaction(static function() use ($collection) { |
|
531 | 531 | Collection::query()->where('collectionhash', $collection->collectionhash)->delete(); |
532 | 532 | }, 10); |
533 | 533 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | } |
569 | 569 | |
570 | 570 | $releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0); |
571 | - if (! empty($groupID)) { |
|
571 | + if (!empty($groupID)) { |
|
572 | 572 | $releasesQuery->where('releases.groups_id', $groupID); |
573 | 573 | } |
574 | 574 | $releases = $releasesQuery->select(['id', 'guid', 'name', 'categories_id'])->get(); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | ), true); |
672 | 672 | } |
673 | 673 | |
674 | - DB::transaction(function () use ($deletedCount, $startTime) { |
|
674 | + DB::transaction(function() use ($deletedCount, $startTime) { |
|
675 | 675 | $deleted = 0; |
676 | 676 | $deleteQuery = Collection::query() |
677 | 677 | ->where('dateadded', '<', now()->subHours(Settings::settingValue('..partretentionhours'))) |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | $releases = Release::query() |
835 | 835 | ->select(['id', 'guid']) |
836 | 836 | ->where('passwordstatus', '=', Releases::PASSWD_RAR) |
837 | - ->orWhereIn('id', function ($query) { |
|
837 | + ->orWhereIn('id', function($query) { |
|
838 | 838 | $query->select('releases_id') |
839 | 839 | ->from('release_files') |
840 | 840 | ->where('passworded', '=', Releases::PASSWD_RAR); |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | foreach ($genrelist as $genre) { |
894 | 894 | $musicInfoQuery = MusicInfo::query()->where('genre_id', (int) $genre['id'])->select(['id']); |
895 | 895 | $releases = Release::query() |
896 | - ->joinSub($musicInfoQuery, 'mi', function ($join) { |
|
896 | + ->joinSub($musicInfoQuery, 'mi', function($join) { |
|
897 | 897 | $join->on('releases.musicinfo_id', '=', 'mi.id'); |
898 | 898 | }) |
899 | 899 | ->select(['releases.id', 'releases.guid']) |
@@ -979,18 +979,18 @@ discard block |
||
979 | 979 | */ |
980 | 980 | private function collectionFileCheckStage1(int $groupID): void |
981 | 981 | { |
982 | - DB::transaction(static function () use ($groupID) { |
|
982 | + DB::transaction(static function() use ($groupID) { |
|
983 | 983 | $collectionsCheck = Collection::query()->select(['collections.id']) |
984 | 984 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
985 | 985 | ->where('collections.totalfiles', '>', 0) |
986 | 986 | ->where('collections.filecheck', '=', self::COLLFC_DEFAULT); |
987 | - if (! empty($groupID)) { |
|
987 | + if (!empty($groupID)) { |
|
988 | 988 | $collectionsCheck->where('collections.groups_id', $groupID); |
989 | 989 | } |
990 | 990 | $collectionsCheck->groupBy('binaries.collections_id', 'collections.totalfiles', 'collections.id') |
991 | 991 | ->havingRaw('COUNT(binaries.id) IN (collections.totalfiles, collections.totalfiles+1)'); |
992 | 992 | |
993 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
993 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
994 | 994 | $join->on('collections.id', '=', 'r.id'); |
995 | 995 | })->update(['collections.filecheck' => self::COLLFC_COMPCOLL]); |
996 | 996 | }, 10); |
@@ -1011,25 +1011,25 @@ discard block |
||
1011 | 1011 | */ |
1012 | 1012 | private function collectionFileCheckStage2(int $groupID): void |
1013 | 1013 | { |
1014 | - DB::transaction(static function () use ($groupID) { |
|
1014 | + DB::transaction(static function() use ($groupID) { |
|
1015 | 1015 | $collectionsCheck = Collection::query()->select(['collections.id']) |
1016 | 1016 | ->join('binaries', 'binaries.collections_id', '=', 'collections.id') |
1017 | 1017 | ->where('binaries.filenumber', '=', 0) |
1018 | 1018 | ->where('collections.totalfiles', '>', 0) |
1019 | 1019 | ->where('collections.filecheck', '=', self::COLLFC_COMPCOLL); |
1020 | - if (! empty($groupID)) { |
|
1020 | + if (!empty($groupID)) { |
|
1021 | 1021 | $collectionsCheck->where('collections.groups_id', $groupID); |
1022 | 1022 | } |
1023 | 1023 | $collectionsCheck->groupBy('collections.id'); |
1024 | 1024 | |
1025 | - Collection::query()->joinSub($collectionsCheck, 'r', function ($join) { |
|
1025 | + Collection::query()->joinSub($collectionsCheck, 'r', function($join) { |
|
1026 | 1026 | $join->on('collections.id', '=', 'r.id'); |
1027 | 1027 | })->update(['collections.filecheck' => self::COLLFC_ZEROPART]); |
1028 | 1028 | }, 10); |
1029 | 1029 | |
1030 | - DB::transaction(static function () use ($groupID) { |
|
1030 | + DB::transaction(static function() use ($groupID) { |
|
1031 | 1031 | $collectionQuery = Collection::query()->where('filecheck', '=', self::COLLFC_COMPCOLL); |
1032 | - if (! empty($groupID)) { |
|
1032 | + if (!empty($groupID)) { |
|
1033 | 1033 | $collectionQuery->where('groups_id', $groupID); |
1034 | 1034 | } |
1035 | 1035 | $collectionQuery->update(['filecheck' => self::COLLFC_TEMPCOMP]); |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | */ |
1048 | 1048 | private function collectionFileCheckStage3(string $where): void |
1049 | 1049 | { |
1050 | - DB::transaction(static function () use ($where) { |
|
1050 | + DB::transaction(static function() use ($where) { |
|
1051 | 1051 | DB::update( |
1052 | 1052 | sprintf( |
1053 | 1053 | ' |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | ); |
1072 | 1072 | }, 10); |
1073 | 1073 | |
1074 | - DB::transaction(static function () use ($where) { |
|
1074 | + DB::transaction(static function() use ($where) { |
|
1075 | 1075 | DB::update( |
1076 | 1076 | sprintf( |
1077 | 1077 | ' |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | */ |
1109 | 1109 | private function collectionFileCheckStage4(string &$where): void |
1110 | 1110 | { |
1111 | - DB::transaction(static function () use ($where) { |
|
1111 | + DB::transaction(static function() use ($where) { |
|
1112 | 1112 | DB::update( |
1113 | 1113 | sprintf( |
1114 | 1114 | ' |
@@ -1138,9 +1138,9 @@ discard block |
||
1138 | 1138 | */ |
1139 | 1139 | private function collectionFileCheckStage5(int $groupId): void |
1140 | 1140 | { |
1141 | - DB::transaction(static function () use ($groupId) { |
|
1141 | + DB::transaction(static function() use ($groupId) { |
|
1142 | 1142 | $collectionQuery = Collection::query()->whereIn('filecheck', [self::COLLFC_TEMPCOMP, self::COLLFC_ZEROPART]); |
1143 | - if (! empty($groupId)) { |
|
1143 | + if (!empty($groupId)) { |
|
1144 | 1144 | $collectionQuery->where('groups_id', $groupId); |
1145 | 1145 | } |
1146 | 1146 | $collectionQuery->update(['filecheck' => self::COLLFC_COMPCOLL]); |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | */ |
1159 | 1159 | private function collectionFileCheckStage6(string &$where): void |
1160 | 1160 | { |
1161 | - DB::transaction(function () use ($where) { |
|
1161 | + DB::transaction(function() use ($where) { |
|
1162 | 1162 | DB::update( |
1163 | 1163 | sprintf( |
1164 | 1164 | " |
@@ -1188,10 +1188,10 @@ discard block |
||
1188 | 1188 | { |
1189 | 1189 | $lastRun = Settings::settingValue('indexer.processing.last_run_time'); |
1190 | 1190 | |
1191 | - DB::transaction(function () use ($groupID, $lastRun) { |
|
1191 | + DB::transaction(function() use ($groupID, $lastRun) { |
|
1192 | 1192 | $objQuery = Collection::query() |
1193 | 1193 | ->where('added', '<', Carbon::createFromFormat('Y-m-d H:i:s', $lastRun)->subHours($this->collectionTimeout)); |
1194 | - if (! empty($groupID)) { |
|
1194 | + if (!empty($groupID)) { |
|
1195 | 1195 | $objQuery->where('groups_id', $groupID); |
1196 | 1196 | } |
1197 | 1197 | $obj = $objQuery->delete(); |