Completed
Push — master ( f5a1ed...b21e22 )
by Darko
42s queued 21s
created
Blacklight/Nfo.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $this->colorCli = new ColorCLI;
76 76
 
77 77
         $this->tmpPath = config('nntmux.tmp_unrar_path');
78
-        if (! preg_match('/[\/\\\\]$/', $this->tmpPath)) {
78
+        if (!preg_match('/[\/\\\\]$/', $this->tmpPath)) {
79 79
             $this->tmpPath .= '/';
80 80
         }
81 81
     }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         $size = \strlen($possibleNFO);
137 137
         if ($size < 65535 &&
138 138
             $size > 11 &&
139
-            ! preg_match(
139
+            !preg_match(
140 140
                 '/\A(\s*<\?xml|=newz\[NZB\]=|RIFF|\s*[RP]AR|.{0,10}(JFIF|matroska|ftyp|ID3))|;\s*Generated\s*by.*SF\w/i',
141 141
                 $possibleNFO
142 142
             )) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
             // Linux boxes have 'file' (so should Macs), Windows *can* have it too: see GNUWIN.txt in docs.
148 148
             $result = Utility::fileInfo($tmpPath);
149
-            if (! empty($result)) {
149
+            if (!empty($result)) {
150 150
                 // Check if it's text.
151 151
                 if (preg_match('/(ASCII|ISO-8859|UTF-(8|16|32).*?)\s*text/', $result)) {
152 152
                     @File::delete($tmpPath);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
             Release::whereId($release->id)->update(['nfostatus' => self::NFO_FOUND]);
201 201
 
202
-            if (! isset($release->completion)) {
202
+            if (!isset($release->completion)) {
203 203
                 $release->completion = 0;
204 204
             }
205 205
 
Please login to merge, or discard this patch.
Blacklight/processing/post/ProcessAdditional.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
         // Pass the binary extractors to ArchiveInfo.
287 287
         $clients = [];
288
-        if (! empty(Settings::settingValue('apps..unrarpath'))) {
288
+        if (!empty(Settings::settingValue('apps..unrarpath'))) {
289 289
             $this->_unrarPath = Settings::settingValue('apps..unrarpath');
290 290
             $clients += [ArchiveInfo::TYPE_RAR => $this->_unrarPath];
291 291
         }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         $this->_archiveInfo->setExternalClients($clients);
294 294
 
295 295
         $this->_killString = '"';
296
-        if (! empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) {
296
+        if (!empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) {
297 297
             $this->_killString = (
298 298
                 '"'.Settings::settingValue('apps..timeoutpath').
299 299
                 '" --foreground --signal=KILL '.
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
         $this->_addPAR2Files = (int) Settings::settingValue('..addpar2') !== 0;
335 335
 
336
-        if (! Settings::settingValue('apps..ffmpegpath')) {
336
+        if (!Settings::settingValue('apps..ffmpegpath')) {
337 337
             $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false;
338 338
         } else {
339 339
             $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0;
345 345
         $this->_processMediaInfo = Settings::settingValue('apps..mediainfopath') !== '';
346 346
         $this->_processAudioInfo = $this->_processMediaInfo;
347
-        $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath'));
347
+        $this->_processPasswords = !empty(Settings::settingValue('..checkpasswordedrar')) && !empty(Settings::settingValue('apps..unrarpath'));
348 348
 
349 349
         $this->_audioSavePath = storage_path('covers/audiosample/');
350 350
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         $this->_mainTmpPath = config('nntmux.tmp_unrar_path');
402 402
 
403 403
         // Check if it ends with a dir separator.
404
-        if (! Str::endsWith($this->_mainTmpPath, '/') && ! Str::endsWith($this->_mainTmpPath, '\\')) {
404
+        if (!Str::endsWith($this->_mainTmpPath, '/') && !Str::endsWith($this->_mainTmpPath, '\\')) {
405 405
             $this->_mainTmpPath .= '/';
406 406
         }
407 407
 
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
             $this->_mainTmpPath .= $guidChar.'/';
413 413
         }
414 414
 
415
-        if (! File::isDirectory($this->_mainTmpPath)) {
416
-            if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) {
415
+        if (!File::isDirectory($this->_mainTmpPath)) {
416
+            if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) {
417 417
                 throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath));
418 418
             }
419 419
         }
420 420
 
421
-        if (! File::isDirectory($this->_mainTmpPath)) {
421
+        if (!File::isDirectory($this->_mainTmpPath)) {
422 422
             throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')');
423 423
         }
424 424
 
@@ -456,10 +456,10 @@  discard block
 block discarded – undo
456 456
         if ($this->_minSize > 0) {
457 457
             $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576);
458 458
         }
459
-        if (! empty($groupID)) {
459
+        if (!empty($groupID)) {
460 460
             $releasesQuery->where('releases.groups_id', $groupID);
461 461
         }
462
-        if (! empty($guidChar)) {
462
+        if (!empty($guidChar)) {
463 463
             $releasesQuery->where('releases.leftguid', $guidChar);
464 464
         }
465 465
         $releasesQuery->select(['releases.id', 'releases.id as releases_id', 'releases.guid', 'releases.name', 'releases.size', 'releases.groups_id', 'releases.nfostatus', 'releases.fromname', 'releases.completion', 'releases.categories_id', 'releases.searchname', 'releases.predb_id', 'categories.disablepreview'])
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
             cli_set_process_title($this->_showCLIReleaseID.$this->_release->id);
514 514
 
515 515
             // Create folder to store temporary files.
516
-            if (! $this->_createTempFolder()) {
516
+            if (!$this->_createTempFolder()) {
517 517
                 continue;
518 518
             }
519 519
 
520 520
             // Get NZB contents.
521
-            if (! $this->_getNZBContents()) {
521
+            if (!$this->_getNZBContents()) {
522 522
                 continue;
523 523
             }
524 524
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                 $this->_processMessageIDDownloads();
541 541
 
542 542
                 // Process compressed (RAR/ZIP) files inside the NZB.
543
-                if (! $bookFlood && $this->_NZBHasCompressedFile) {
543
+                if (!$bookFlood && $this->_NZBHasCompressedFile) {
544 544
                     // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB.
545 545
                     $this->_processNZBCompressedFiles();
546 546
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
                         $this->_processNZBCompressedFiles(true);
550 550
                     }
551 551
 
552
-                    if (! $this->_releaseHasPassword) {
552
+                    if (!$this->_releaseHasPassword) {
553 553
                         // Process the extracted files to get video/audio samples/etc.
554 554
                         $this->_processExtractedFiles();
555 555
                     }
@@ -593,10 +593,10 @@  discard block
 block discarded – undo
593 593
     {
594 594
         // Per release defaults.
595 595
         $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/';
596
-        if (! File::isDirectory($this->tmpPath)) {
597
-            if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) {
596
+        if (!File::isDirectory($this->tmpPath)) {
597
+            if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) {
598 598
                 // We will try to create the main temp folder again, just in case there was a file lock or filesystem issue.
599
-                if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) {
599
+                if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) {
600 600
                     $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning');
601 601
 
602 602
                     return false;
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         $nzbPath = $this->_nzb->NZBPath($this->_release->guid);
619 619
         if ($nzbPath !== false) {
620 620
             $nzbContents = Utility::unzipGzipFile($nzbPath);
621
-            if (! $nzbContents) {
621
+            if (!$nzbContents) {
622 622
                 if ($this->_echoCLI) {
623 623
                     $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning');
624 624
                 }
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
                 }
680 680
 
681 681
                 // Check if it's a rar/zip.
682
-                if (! $this->_NZBHasCompressedFile &&
682
+                if (!$this->_NZBHasCompressedFile &&
683 683
                     preg_match(
684 684
                         '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i',
685 685
                         $this->_currentNZBFile['title']
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                 }
690 690
 
691 691
                 // Look for a video sample, make sure it's not an image.
692
-                if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title'])
692
+                if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title'])
693 693
                 ) {
694 694
                     // Get the amount of segments for this file.
695 695
                     $segCount = (\count($this->_currentNZBFile['segments']) - 1);
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
                 }
704 704
 
705 705
                 // Look for a JPG picture, make sure it's not a CD cover.
706
-                if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && ! preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title'])
706
+                if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && !preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title'])
707 707
                 ) {
708 708
                     // Get the amount of segments for this file.
709 709
                     $segCount = (\count($this->_currentNZBFile['segments']) - 1);
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         $this->_reverse = $reverse;
756 756
 
757 757
         if ($this->_reverse) {
758
-            if (! krsort($this->_nzbContents)) {
758
+            if (!krsort($this->_nzbContents)) {
759 759
                 return;
760 760
             }
761 761
         } else {
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
             }
780 780
 
781 781
             // Probably not a rar/zip.
782
-            if (! preg_match(
782
+            if (!preg_match(
783 783
                 '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i',
784 784
                 $nzbFile['title']
785 785
             )
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
                     break;
796 796
                 }
797 797
                 $segment = (string) $nzbFile['segments'][$i];
798
-                if (! $this->_reverse) {
798
+                if (!$this->_reverse) {
799 799
                     $this->_triedCompressedMids[] = $segment;
800 800
                 } elseif (\in_array($segment, $this->_triedCompressedMids, false)) {
801 801
                     // We already downloaded this file.
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
     {
848 848
         $this->_compressedFilesChecked++;
849 849
         // Give the data to archive info, so it can check if it's a rar.
850
-        if (! $this->_archiveInfo->setData($compressedData, true)) {
850
+        if (!$this->_archiveInfo->setData($compressedData, true)) {
851 851
             if (config('app.debug') === true) {
852 852
                 $this->_debug('Data is probably not RAR or ZIP.');
853 853
             }
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
         }
878 878
 
879 879
         // Check if the compressed file is encrypted.
880
-        if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) {
880
+        if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) {
881 881
             if (config('app.debug') === true) {
882 882
                 $this->_debug('ArchiveInfo: Compressed file has a password.');
883 883
             }
@@ -889,13 +889,13 @@  discard block
 block discarded – undo
889 889
 
890 890
         if ($this->_reverse) {
891 891
             $fileData = $dataSummary['file_list'] ?? [];
892
-            if (! empty($fileData)) {
892
+            if (!empty($fileData)) {
893 893
                 $rarFileName = Arr::pluck($fileData, 'name');
894 894
                 if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) {
895 895
                     $preCheck = Predb::whereTitle($hit[0])->first();
896 896
                     $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0;
897 897
                     (new NameFixer)->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid);
898
-                } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
898
+                } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
899 899
                     $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list'];
900 900
                     $archiveFileName = Arr::pluck($archiveData, 'name');
901 901
                     if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) {
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
                     $this->_echo('r', 'primaryOver');
914 914
                 }
915 915
 
916
-                if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) {
916
+                if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) {
917 917
                     $fileName = $this->tmpPath.uniqid('', true).'.rar';
918 918
                     File::put($fileName, $compressedData);
919 919
                     runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"');
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
                 if ($this->_echoCLI) {
925 925
                     $this->_echo('z', 'primaryOver');
926 926
                 }
927
-                if (! $this->_extractUsingRarInfo) {
927
+                if (!$this->_extractUsingRarInfo) {
928 928
                     $fileName = $this->tmpPath.uniqid('', true).'.zip';
929 929
                     File::put($fileName, $compressedData);
930 930
                     // Use the unzip command instead of 7zip
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
     {
950 950
         // Get a list of files inside the Compressed file.
951 951
         $files = $this->_archiveInfo->getArchiveFileList();
952
-        if (! \is_array($files) || \count($files) === 0) {
952
+        if (!\is_array($files) || \count($files) === 0) {
953 953
             return false;
954 954
         }
955 955
 
@@ -1019,8 +1019,8 @@  discard block
 block discarded – undo
1019 1019
     protected function _addFileInfo(&$file): void
1020 1020
     {
1021 1021
         // Don't add rar/zip files to the DB.
1022
-        if (! isset($file['error']) && isset($file['source']) &&
1023
-            ! preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name'])
1022
+        if (!isset($file['error']) && isset($file['source']) &&
1023
+            !preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name'])
1024 1024
         ) {
1025 1025
             // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content.
1026 1026
             // This is so we don't download more RAR or ZIP files for no reason.
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
              */
1032 1032
             if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) {
1033 1033
                 $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? '');
1034
-                if (! empty($addReleaseFiles)) {
1034
+                if (!empty($addReleaseFiles)) {
1035 1035
                     $this->_addedFileInfo++;
1036 1036
 
1037 1037
                     if ($this->_echoCLI) {
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
                         $this->_releaseHasPassword = true;
1047 1047
                         $this->_passwordStatus = Releases::PASSWD_RAR;
1048 1048
                     } //Run a PreDB filename check on insert to try and match the release
1049
-                    elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) {
1049
+                    elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) {
1050 1050
                         $this->_release['filename'] = $file['name'];
1051 1051
                         $this->_release['releases_id'] = $this->_release->id;
1052 1052
                         $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true);
@@ -1077,12 +1077,12 @@  discard block
 block discarded – undo
1077 1077
             // Get all the compressed files in the temp folder.
1078 1078
             $files = $this->_getTempDirectoryContents('/.*\.([rz]\d{2,}|rar|zipx?|0{0,2}1)($|[^a-z0-9])/i');
1079 1079
 
1080
-            if (! empty($files)) {
1080
+            if (!empty($files)) {
1081 1081
                 foreach ($files as $file) {
1082 1082
                     // Check if the file exists.
1083 1083
                     if (File::isFile($file[0])) {
1084 1084
                         $rarData = @File::get($file[0]);
1085
-                        if (! empty($rarData)) {
1085
+                        if (!empty($rarData)) {
1086 1086
                             $this->_processCompressedData($rarData);
1087 1087
                             $foundCompressedFile = true;
1088 1088
                         }
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
             }
1093 1093
 
1094 1094
             // If we found no compressed files, break out.
1095
-            if (! $foundCompressedFile) {
1095
+            if (!$foundCompressedFile) {
1096 1096
                 break;
1097 1097
             }
1098 1098
 
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
         // Get all the remaining files in the temp dir.
1105 1105
         $files = $this->_getTempDirectoryContents();
1106
-        if (! empty($files)) {
1106
+        if (!empty($files)) {
1107 1107
             foreach ($files as $file) {
1108 1108
                 $file = $file->getPathname();
1109 1109
 
@@ -1114,39 +1114,39 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
                 if (File::isFile($file)) {
1116 1116
                     // Process PAR2 files.
1117
-                    if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1117
+                    if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1118 1118
                         $this->_siftPAR2Info($file);
1119 1119
                     } // Process NFO files.
1120 1120
                     elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) {
1121 1121
                         $this->_processNfoFile($file);
1122 1122
                     } // Process audio files.
1123
-                    elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1123
+                    elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1124 1124
                         // Try to get audio sample/audio media info.
1125 1125
                         File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]);
1126 1126
                         $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]);
1127 1127
                         File::delete($this->tmpPath.'audiofile.'.$fileType[2]);
1128 1128
                     } // Process JPG files.
1129
-                    elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1129
+                    elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1130 1130
                         $this->_getJPGSample($file);
1131 1131
                         File::delete($file);
1132 1132
                     } // Video sample // video clip // video media info.
1133
-                    elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1133
+                    elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1134 1134
                         $this->_processVideoFile($file);
1135 1135
                     } // Check file's magic info.
1136 1136
                     else {
1137 1137
                         $output = Utility::fileInfo($file);
1138
-                        if (! empty($output)) {
1138
+                        if (!empty($output)) {
1139 1139
                             switch (true) {
1140
-                                case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1140
+                                case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1141 1141
                                     $this->_getJPGSample($file);
1142 1142
                                     File::delete($file);
1143 1143
                                     break;
1144 1144
 
1145
-                                case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1145
+                                case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1146 1146
                                     $this->_processVideoFile($file);
1147 1147
                                     break;
1148 1148
 
1149
-                                case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1149
+                                case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1150 1150
                                     switch ($fileType[0]) {
1151 1151
                                         case 'FLAC':
1152 1152
                                             $fileType = 'FLAC';
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
                                     File::delete($this->tmpPath.'audiofile.'.$fileType);
1164 1164
                                     break;
1165 1165
 
1166
-                                case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1166
+                                case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1167 1167
                                     $this->_siftPAR2Info($file);
1168 1168
                                     break;
1169 1169
                             }
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
     protected function _processSampleMessageIDs(): void
1200 1200
     {
1201 1201
         // Download and process sample image.
1202
-        if (! $this->_foundSample || ! $this->_foundVideo) {
1203
-            if (! empty($this->_sampleMessageIDs)) {
1202
+        if (!$this->_foundSample || !$this->_foundVideo) {
1203
+            if (!empty($this->_sampleMessageIDs)) {
1204 1204
                 // Download it from usenet.
1205 1205
                 $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP);
1206 1206
                 if ($this->_nntp::isError($sampleBinary)) {
@@ -1219,12 +1219,12 @@  discard block
 block discarded – undo
1219 1219
                         File::put($fileLocation, $sampleBinary);
1220 1220
 
1221 1221
                         // Try to get a sample picture.
1222
-                        if (! $this->_foundSample) {
1222
+                        if (!$this->_foundSample) {
1223 1223
                             $this->_foundSample = $this->_getSample($fileLocation);
1224 1224
                         }
1225 1225
 
1226 1226
                         // Try to get a sample video.
1227
-                        if (! $this->_foundVideo) {
1227
+                        if (!$this->_foundVideo) {
1228 1228
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1229 1229
                         }
1230 1230
                     }
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
     protected function _processMediaInfoMessageIDs(): void
1246 1246
     {
1247 1247
         // Download and process mediainfo. Also try to get a sample if we didn't get one yet.
1248
-        if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) {
1249
-            if (! empty($this->_MediaInfoMessageIDs)) {
1248
+        if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) {
1249
+            if (!empty($this->_MediaInfoMessageIDs)) {
1250 1250
                 // Try to download it from usenet.
1251 1251
                 $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP);
1252 1252
                 if ($this->_nntp::isError($mediaBinary)) {
@@ -1266,17 +1266,17 @@  discard block
 block discarded – undo
1266 1266
                         File::put($fileLocation, $mediaBinary);
1267 1267
 
1268 1268
                         // Try to get media info.
1269
-                        if (! $this->_foundMediaInfo) {
1269
+                        if (!$this->_foundMediaInfo) {
1270 1270
                             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
1271 1271
                         }
1272 1272
 
1273 1273
                         // Try to get a sample picture.
1274
-                        if (! $this->_foundSample) {
1274
+                        if (!$this->_foundSample) {
1275 1275
                             $this->_foundSample = $this->_getSample($fileLocation);
1276 1276
                         }
1277 1277
 
1278 1278
                         // Try to get a sample video.
1279
-                        if (! $this->_foundVideo) {
1279
+                        if (!$this->_foundVideo) {
1280 1280
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1281 1281
                         }
1282 1282
                     }
@@ -1297,8 +1297,8 @@  discard block
 block discarded – undo
1297 1297
     protected function _processAudioInfoMessageIDs(): void
1298 1298
     {
1299 1299
         // Download audio file, use media info to try to get the artist / album.
1300
-        if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) {
1301
-            if (! empty($this->_AudioInfoMessageIDs)) {
1300
+        if (!$this->_foundAudioInfo || !$this->_foundAudioSample) {
1301
+            if (!empty($this->_AudioInfoMessageIDs)) {
1302 1302
                 // Try to download it from usenet.
1303 1303
                 $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP);
1304 1304
                 if ($this->_nntp::isError($audioBinary)) {
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
     protected function _processJPGMessageIDs(): void
1334 1334
     {
1335 1335
         // Download JPG file.
1336
-        if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) {
1336
+        if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) {
1337 1337
             // Try to download it.
1338 1338
             $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP);
1339 1339
             if ($this->_nntp::isError($jpgBinary)) {
@@ -1402,12 +1402,12 @@  discard block
 block discarded – undo
1402 1402
         $this->_passwordStatus = max([$this->_passwordStatus]);
1403 1403
 
1404 1404
         // Set the release to no password if password processing is off.
1405
-        if (! $this->_processPasswords) {
1405
+        if (!$this->_processPasswords) {
1406 1406
             $this->_releaseHasPassword = false;
1407 1407
         }
1408 1408
 
1409 1409
         // If we failed to get anything from the RAR/ZIPs update the release with what we have, if the rar/zip has no password.
1410
-        if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1410
+        if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1411 1411
             $release = Release::query()->where('id', $this->_release->id);
1412 1412
             $release->update(
1413 1413
                 $updateRows
@@ -1461,19 +1461,19 @@  discard block
 block discarded – undo
1461 1461
         $retVal = $audVal = false;
1462 1462
 
1463 1463
         // Check if audio sample fetching is on.
1464
-        if (! $this->_processAudioSample) {
1464
+        if (!$this->_processAudioSample) {
1465 1465
             $audVal = true;
1466 1466
         }
1467 1467
 
1468 1468
         // Check if media info fetching is on.
1469
-        if (! $this->_processAudioInfo) {
1469
+        if (!$this->_processAudioInfo) {
1470 1470
             $retVal = true;
1471 1471
         }
1472 1472
 
1473 1473
         $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first();
1474 1474
 
1475 1475
         $musicParent = (string) Category::MUSIC_ROOT;
1476
-        if ($rQuery === null || ! preg_match(
1476
+        if ($rQuery === null || !preg_match(
1477 1477
             sprintf(
1478 1478
                 '/%d\d{3}|%d|%d|%d/',
1479 1479
                 $musicParent[0],
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 
1490 1490
         if (File::isFile($fileLocation)) {
1491 1491
             // Check if media info is enabled.
1492
-            if (! $retVal) {
1492
+            if (!$retVal) {
1493 1493
                 // Get the media info for the file.
1494 1494
                 try {
1495 1495
                     $xmlArray = $this->mediaInfo->getInfo($fileLocation, false);
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
                                     $ext = strtoupper($fileExtension);
1503 1503
 
1504 1504
                                     // Form a new search name.
1505
-                                    if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1505
+                                    if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1506 1506
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext;
1507 1507
                                     } else {
1508 1508
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext;
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
             }
1565 1565
 
1566 1566
             // Check if creating audio samples is enabled.
1567
-            if (! $audVal) {
1567
+            if (!$audVal) {
1568 1568
                 // File name to store audio file.
1569 1569
                 $audioFileName = ($this->_release->guid.'.ogg');
1570 1570
 
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
                     // Try to move the temp audio file.
1589 1589
                     $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1590 1590
 
1591
-                    if (! $renamed) {
1591
+                    if (!$renamed) {
1592 1592
                         // Try to copy it if it fails.
1593 1593
                         $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1594 1594
 
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
                         File::delete($this->tmpPath.$audioFileName);
1597 1597
 
1598 1598
                         // If it didn't copy continue.
1599
-                        if (! $copied) {
1599
+                        if (!$copied) {
1600 1600
                             return false;
1601 1601
                         }
1602 1602
                     }
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
             $time = $this->ffprobe->format($videoLocation)->get('duration');
1649 1649
         }
1650 1650
 
1651
-        if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1651
+        if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1652 1652
             return '';
1653 1653
         }
1654 1654
 
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
      */
1670 1670
     protected function _getSample(string $fileLocation): bool
1671 1671
     {
1672
-        if (! $this->_processThumbnails) {
1672
+        if (!$this->_processThumbnails) {
1673 1673
             return false;
1674 1674
         }
1675 1675
 
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
      */
1735 1735
     protected function _getVideo(string $fileLocation): bool
1736 1736
     {
1737
-        if (! $this->_processVideo) {
1737
+        if (!$this->_processVideo) {
1738 1738
             return false;
1739 1739
         }
1740 1740
 
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
             }
1790 1790
 
1791 1791
             // If longer than 60 or we could not get the video length, run the old way.
1792
-            if (! $newMethod && $this->ffprobe->isValid($fileLocation)) {
1792
+            if (!$newMethod && $this->ffprobe->isValid($fileLocation)) {
1793 1793
                 try {
1794 1794
                     $video = $this->ffmpeg->open($fileLocation);
1795 1795
                     $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration));
@@ -1812,14 +1812,14 @@  discard block
 block discarded – undo
1812 1812
 
1813 1813
                 // Try to move the file to the new path.
1814 1814
                 // If we couldn't rename it, try to copy it.
1815
-                if (! @File::move($fileName, $newFile)) {
1815
+                if (!@File::move($fileName, $newFile)) {
1816 1816
                     $copied = @File::copy($fileName, $newFile);
1817 1817
 
1818 1818
                     // Delete the old file.
1819 1819
                     File::delete($fileName);
1820 1820
 
1821 1821
                     // If it didn't copy, continue.
1822
-                    if (! $copied) {
1822
+                    if (!$copied) {
1823 1823
                         return false;
1824 1824
                     }
1825 1825
                 }
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
      */
1846 1846
     protected function _getMediaInfo($fileLocation): bool
1847 1847
     {
1848
-        if (! $this->_processMediaInfo) {
1848
+        if (!$this->_processMediaInfo) {
1849 1849
             return false;
1850 1850
         }
1851 1851
 
@@ -1914,7 +1914,7 @@  discard block
 block discarded – undo
1914 1914
         $filesAdded = 0;
1915 1915
 
1916 1916
         foreach ($this->_par2Info->getFileList() as $file) {
1917
-            if (! isset($file['name'])) {
1917
+            if (!isset($file['name'])) {
1918 1918
                 continue;
1919 1919
             }
1920 1920
 
@@ -1937,7 +1937,7 @@  discard block
 block discarded – undo
1937 1937
             }
1938 1938
 
1939 1939
             // Try to get a new name.
1940
-            if (! $foundName) {
1940
+            if (!$foundName) {
1941 1941
                 $this->_release->textstring = $file['name'];
1942 1942
                 $this->_release->releases_id = $this->_release->id;
1943 1943
                 if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) {
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
     protected function _processVideoFile($fileLocation): void
1968 1968
     {
1969 1969
         // Try to get a sample with it.
1970
-        if (! $this->_foundSample) {
1970
+        if (!$this->_foundSample) {
1971 1971
             $this->_foundSample = $this->_getSample($fileLocation);
1972 1972
         }
1973 1973
 
@@ -1975,12 +1975,12 @@  discard block
 block discarded – undo
1975 1975
          * Don't get it here if _sampleMessageIDs is empty
1976 1976
          * or has 1 message-id (Saves downloading another part).
1977 1977
          */
1978
-        if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
1978
+        if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
1979 1979
             $this->_foundVideo = $this->_getVideo($fileLocation);
1980 1980
         }
1981 1981
 
1982 1982
         // Try to get media info with it.
1983
-        if (! $this->_foundMediaInfo) {
1983
+        if (!$this->_foundMediaInfo) {
1984 1984
             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
1985 1985
         }
1986 1986
     }
@@ -2002,24 +2002,24 @@  discard block
 block discarded – undo
2002 2002
             $bf = true;
2003 2003
         }
2004 2004
 
2005
-        if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2005
+        if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2006 2006
             $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a);
2007 2007
             $af = true;
2008 2008
         }
2009
-        if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2009
+        if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2010 2010
             $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b);
2011 2011
             $bf = true;
2012 2012
         }
2013 2013
 
2014
-        if (! $af && ! $bf) {
2014
+        if (!$af && !$bf) {
2015 2015
             return strnatcasecmp($a, $b);
2016 2016
         }
2017 2017
 
2018
-        if (! $bf) {
2018
+        if (!$bf) {
2019 2019
             return -1;
2020 2020
         }
2021 2021
 
2022
-        if (! $af) {
2022
+        if (!$af) {
2023 2023
             return 1;
2024 2024
         }
2025 2025
 
@@ -2044,12 +2044,12 @@  discard block
 block discarded – undo
2044 2044
     protected function _resetReleaseStatus(): void
2045 2045
     {
2046 2046
         // Only process for samples, previews and images if not disabled.
2047
-        $this->_foundVideo = ! $this->_processVideo;
2048
-        $this->_foundMediaInfo = ! $this->_processMediaInfo;
2049
-        $this->_foundAudioInfo = ! $this->_processAudioInfo;
2050
-        $this->_foundAudioSample = ! $this->_processAudioSample;
2051
-        $this->_foundJPGSample = ! $this->_processJPGSample;
2052
-        $this->_foundSample = ! $this->_processThumbnails;
2047
+        $this->_foundVideo = !$this->_processVideo;
2048
+        $this->_foundMediaInfo = !$this->_processMediaInfo;
2049
+        $this->_foundAudioInfo = !$this->_processAudioInfo;
2050
+        $this->_foundAudioSample = !$this->_processAudioSample;
2051
+        $this->_foundJPGSample = !$this->_processJPGSample;
2052
+        $this->_foundSample = !$this->_processThumbnails;
2053 2053
         $this->_foundPAR2Info = false;
2054 2054
 
2055 2055
         $this->_passwordStatus = Releases::PASSWD_NONE;
Please login to merge, or discard this patch.
Blacklight/processing/ProcessReleases.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(Settings::settingValue('..nzbpath'))) {
123
+        if (!file_exists(Settings::settingValue('..nzbpath'))) {
124 124
             if ($this->echoCLI) {
125 125
                 $this->colorCLI->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath'));
126 126
             }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'])
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
                 $releaseID = Release::insertRelease(
449 449
                     [
450 450
                         'name' => $cleanRelName,
451
-                        'searchname' => ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName,
451
+                        'searchname' => !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName,
452 452
                         'totalpart' => $collection->totalfiles,
453 453
                         'groups_id' => $collection->groups_id,
454 454
                         'guid' => createGUID(),
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
                 if ($releaseID !== null) {
466 466
                     // Update collections table to say we inserted the release.
467
-                    DB::transaction(static function () use ($collection, $releaseID) {
467
+                    DB::transaction(static function() use ($collection, $releaseID) {
468 468
                         Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]);
469 469
                     }, 10);
470 470
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                 }
526 526
             } else {
527 527
                 // The release was already in the DB, so delete the collection.
528
-                DB::transaction(static function () use ($collection) {
528
+                DB::transaction(static function() use ($collection) {
529 529
                     Collection::query()->where('collectionhash', $collection->collectionhash)->delete();
530 530
                 }, 10);
531 531
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         }
567 567
 
568 568
         $releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0);
569
-        if (! empty($groupID)) {
569
+        if (!empty($groupID)) {
570 570
             $releasesQuery->where('releases.groups_id', $groupID);
571 571
         }
572 572
         $releases = $releasesQuery->select(['id', 'guid', 'name', 'categories_id'])->get();
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
                 ), true);
670 670
         }
671 671
 
672
-        DB::transaction(function () use ($deletedCount, $startTime) {
672
+        DB::transaction(function() use ($deletedCount, $startTime) {
673 673
             $deleted = 0;
674 674
             $deleteQuery = Collection::query()
675 675
                 ->where('dateadded', '<', now()->subHours(Settings::settingValue('..partretentionhours')))
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
             $releases = Release::query()
833 833
                 ->select(['id', 'guid'])
834 834
                 ->where('passwordstatus', '=', Releases::PASSWD_RAR)
835
-                ->orWhereIn('id', function ($query) {
835
+                ->orWhereIn('id', function($query) {
836 836
                     $query->select('releases_id')
837 837
                         ->from('release_files')
838 838
                         ->where('passworded', '=', Releases::PASSWD_RAR);
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
             foreach ($genrelist as $genre) {
892 892
                 $musicInfoQuery = MusicInfo::query()->where('genre_id', (int) $genre['id'])->select(['id']);
893 893
                 $releases = Release::query()
894
-                    ->joinSub($musicInfoQuery, 'mi', function ($join) {
894
+                    ->joinSub($musicInfoQuery, 'mi', function($join) {
895 895
                         $join->on('releases.musicinfo_id', '=', 'mi.id');
896 896
                     })
897 897
                     ->select(['releases.id', 'releases.guid'])
@@ -977,18 +977,18 @@  discard block
 block discarded – undo
977 977
      */
978 978
     private function collectionFileCheckStage1(int $groupID): void
979 979
     {
980
-        DB::transaction(static function () use ($groupID) {
980
+        DB::transaction(static function() use ($groupID) {
981 981
             $collectionsCheck = Collection::query()->select(['collections.id'])
982 982
                 ->join('binaries', 'binaries.collections_id', '=', 'collections.id')
983 983
                 ->where('collections.totalfiles', '>', 0)
984 984
                 ->where('collections.filecheck', '=', self::COLLFC_DEFAULT);
985
-            if (! empty($groupID)) {
985
+            if (!empty($groupID)) {
986 986
                 $collectionsCheck->where('collections.groups_id', $groupID);
987 987
             }
988 988
             $collectionsCheck->groupBy('binaries.collections_id', 'collections.totalfiles', 'collections.id')
989 989
                 ->havingRaw('COUNT(binaries.id) IN (collections.totalfiles, collections.totalfiles+1)');
990 990
 
991
-            Collection::query()->joinSub($collectionsCheck, 'r', function ($join) {
991
+            Collection::query()->joinSub($collectionsCheck, 'r', function($join) {
992 992
                 $join->on('collections.id', '=', 'r.id');
993 993
             })->update(['collections.filecheck' => self::COLLFC_COMPCOLL]);
994 994
         }, 10);
@@ -1009,25 +1009,25 @@  discard block
 block discarded – undo
1009 1009
      */
1010 1010
     private function collectionFileCheckStage2(int $groupID): void
1011 1011
     {
1012
-        DB::transaction(static function () use ($groupID) {
1012
+        DB::transaction(static function() use ($groupID) {
1013 1013
             $collectionsCheck = Collection::query()->select(['collections.id'])
1014 1014
                 ->join('binaries', 'binaries.collections_id', '=', 'collections.id')
1015 1015
                 ->where('binaries.filenumber', '=', 0)
1016 1016
                 ->where('collections.totalfiles', '>', 0)
1017 1017
                 ->where('collections.filecheck', '=', self::COLLFC_COMPCOLL);
1018
-            if (! empty($groupID)) {
1018
+            if (!empty($groupID)) {
1019 1019
                 $collectionsCheck->where('collections.groups_id', $groupID);
1020 1020
             }
1021 1021
             $collectionsCheck->groupBy('collections.id');
1022 1022
 
1023
-            Collection::query()->joinSub($collectionsCheck, 'r', function ($join) {
1023
+            Collection::query()->joinSub($collectionsCheck, 'r', function($join) {
1024 1024
                 $join->on('collections.id', '=', 'r.id');
1025 1025
             })->update(['collections.filecheck' => self::COLLFC_ZEROPART]);
1026 1026
         }, 10);
1027 1027
 
1028
-        DB::transaction(static function () use ($groupID) {
1028
+        DB::transaction(static function() use ($groupID) {
1029 1029
             $collectionQuery = Collection::query()->where('filecheck', '=', self::COLLFC_COMPCOLL);
1030
-            if (! empty($groupID)) {
1030
+            if (!empty($groupID)) {
1031 1031
                 $collectionQuery->where('groups_id', $groupID);
1032 1032
             }
1033 1033
             $collectionQuery->update(['filecheck' => self::COLLFC_TEMPCOMP]);
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
      */
1046 1046
     private function collectionFileCheckStage3(string $where): void
1047 1047
     {
1048
-        DB::transaction(static function () use ($where) {
1048
+        DB::transaction(static function() use ($where) {
1049 1049
             DB::update(
1050 1050
                 sprintf(
1051 1051
                     '
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
             );
1070 1070
         }, 10);
1071 1071
 
1072
-        DB::transaction(static function () use ($where) {
1072
+        DB::transaction(static function() use ($where) {
1073 1073
             DB::update(
1074 1074
                 sprintf(
1075 1075
                     '
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
      */
1107 1107
     private function collectionFileCheckStage4(string &$where): void
1108 1108
     {
1109
-        DB::transaction(static function () use ($where) {
1109
+        DB::transaction(static function() use ($where) {
1110 1110
             DB::update(
1111 1111
                 sprintf(
1112 1112
                     '
@@ -1136,9 +1136,9 @@  discard block
 block discarded – undo
1136 1136
      */
1137 1137
     private function collectionFileCheckStage5(int $groupId): void
1138 1138
     {
1139
-        DB::transaction(static function () use ($groupId) {
1139
+        DB::transaction(static function() use ($groupId) {
1140 1140
             $collectionQuery = Collection::query()->whereIn('filecheck', [self::COLLFC_TEMPCOMP, self::COLLFC_ZEROPART]);
1141
-            if (! empty($groupId)) {
1141
+            if (!empty($groupId)) {
1142 1142
                 $collectionQuery->where('groups_id', $groupId);
1143 1143
             }
1144 1144
             $collectionQuery->update(['filecheck' => self::COLLFC_COMPCOLL]);
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
      */
1157 1157
     private function collectionFileCheckStage6(string &$where): void
1158 1158
     {
1159
-        DB::transaction(function () use ($where) {
1159
+        DB::transaction(function() use ($where) {
1160 1160
             DB::update(
1161 1161
                 sprintf(
1162 1162
                     "
@@ -1186,10 +1186,10 @@  discard block
 block discarded – undo
1186 1186
     {
1187 1187
         $lastRun = Settings::settingValue('indexer.processing.last_run_time');
1188 1188
 
1189
-        DB::transaction(function () use ($groupID, $lastRun) {
1189
+        DB::transaction(function() use ($groupID, $lastRun) {
1190 1190
             $objQuery = Collection::query()
1191 1191
                 ->where('added', '<', Carbon::createFromFormat('Y-m-d H:i:s', $lastRun)->subHours($this->collectionTimeout));
1192
-            if (! empty($groupID)) {
1192
+            if (!empty($groupID)) {
1193 1193
                 $objQuery->where('groups_id', $groupID);
1194 1194
             }
1195 1195
             $obj = $objQuery->delete();
Please login to merge, or discard this patch.
Blacklight/PopulateAniDB.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                     $episodeArray[$i]['episode_no'] = (int) $episode->epno;
125 125
                     $episodeArray[$i]['airdate'] = (string) $episode->airdate;
126 126
 
127
-                    if (! empty($episode->title)) {
127
+                    if (!empty($episode->title)) {
128 128
                         foreach ($episode->title as $title) {
129 129
                             $xmlAttribs = $title->attributes('xml', true);
130 130
                             // only english, x-jat imploded episode titles for now
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                     'updated' => now(),
245 245
                 ]
246 246
             );
247
-        if (! empty($AniDBInfoArray['epsarr'])) {
247
+        if (!empty($AniDBInfoArray['epsarr'])) {
248 248
             $this->insertAniDBEpisodes($aniDbId, $AniDBInfoArray['epsarr']);
249 249
         }
250 250
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
     private function insertAniDBEpisodes($aniDbId, array $episodeArr = []): void
255 255
     {
256
-        if (! empty($episodeArr)) {
256
+        if (!empty($episodeArr)) {
257 257
             foreach ($episodeArr as $episode) {
258 258
                 AnidbEpisode::insertOrIgnore(
259 259
                     [
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                     'updated' => now(),
413 413
                 ]
414 414
             );
415
-        if (! empty($AniDBInfoArray['epsarr'])) {
415
+        if (!empty($AniDBInfoArray['epsarr'])) {
416 416
             $this->insertAniDBEpisodes($aniDbId, $AniDBInfoArray['epsarr']);
417 417
         }
418 418
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
             $picture = $this->updateAniDBInfoEps($aniDbId, $AniDBInfoArray);
430 430
         }
431 431
 
432
-        if (! empty($picture) && ! file_exists($this->imgSavePath.$aniDbId.'.jpg')) {
432
+        if (!empty($picture) && !file_exists($this->imgSavePath.$aniDbId.'.jpg')) {
433 433
             (new ReleaseImage)->saveImage(
434 434
                 $aniDbId,
435 435
                 'http://img7.anidb.net/pics/anime/'.$picture,
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ApiV2Controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
                 'search' => ['available' => 'yes', 'supportedParams' => 'id'],
52 52
                 'tv-search' => ['available' => 'yes', 'supportedParams' => 'id,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'],
53 53
                 'movie-search' => ['available' => 'yes', 'supportedParams' => 'id, imdbid, tmdbid, traktid'],
54
-                'audio-search' => ['available' => 'no',  'supportedParams' => ''],
54
+                'audio-search' => ['available' => 'no', 'supportedParams' => ''],
55 55
             ],
56 56
             'categories' => fractal($category, new CategoryTransformer),
57 57
         ];
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ApiInformController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,18 +19,18 @@
 block discarded – undo
19 19
      */
20 20
     public function release(Request $request): \Illuminate\Http\JsonResponse
21 21
     {
22
-        $releaseObName = $request->has('relo') && ! empty($request->input('relo')) ? $request->input('relo') : '';
23
-        $releasePrName = $request->has('relp') && ! empty($request->input('relp')) ? $request->input('relp') : '';
24
-        $apiToken = $request->has('api_token') && ! empty($request->input('api_token')) ? $request->input('api_token') : '';
22
+        $releaseObName = $request->has('relo') && !empty($request->input('relo')) ? $request->input('relo') : '';
23
+        $releasePrName = $request->has('relp') && !empty($request->input('relp')) ? $request->input('relp') : '';
24
+        $apiToken = $request->has('api_token') && !empty($request->input('api_token')) ? $request->input('api_token') : '';
25 25
         $user = User::query()->where('api_token', $request->input('api_token'))->first();
26
-        if (! $user) {
26
+        if (!$user) {
27 27
             return response()->json(['message' => 'Indexer inform error, wrong api key!'], 404);
28 28
         }
29 29
 
30
-        if (! empty($releaseObName) && ! empty($releasePrName) && ! empty($apiToken)) {
30
+        if (!empty($releaseObName) && !empty($releasePrName) && !empty($apiToken)) {
31 31
             ReleaseInform::insertOrIgnore(['relOName' => $releaseObName, 'relPName' => $releasePrName, 'api_token' => $apiToken, 'created_at' => now(), 'updated_at' => now()]);
32 32
             $release = Release::whereSearchname($releaseObName)->first();
33
-            if (! empty($release)) {
33
+            if (!empty($release)) {
34 34
                 (new NameFixer)->updateRelease($release, $releasePrName, 'Release Inform API', true, 'Filenames, ', 1, true);
35 35
             }
36 36
 
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ApiController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $releases = new Releases;
118 118
 
119 119
         // Set Query Parameters based on Request objects
120
-        $outputXML = ! ($request->has('o') && $request->input('o') === 'json');
120
+        $outputXML = !($request->has('o') && $request->input('o') === 'json');
121 121
         $minSize = $request->has('minsize') && $request->input('minsize') > 0 ? $request->input('minsize') : 0;
122 122
         $offset = $this->offset($request);
123 123
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
                 $this->addCoverURL(
260 260
                     $relData,
261
-                    function ($release) {
261
+                    function($release) {
262 262
                         return Utility::getCoverURL(['type' => 'movies', 'id' => $release->imdbid]);
263 263
                     }
264 264
                 );
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 
301 301
                 if ($rel->isNotEmpty()) {
302 302
                     $data = ReleaseNfo::getReleaseNfo($rel->id);
303
-                    if (! empty($data)) {
303
+                    if (!empty($data)) {
304 304
                         if ($request->has('o') && $request->input('o') === 'file') {
305
-                            return response()->streamDownload(function () use ($data) {
305
+                            return response()->streamDownload(function() use ($data) {
306 306
                                 echo $data['nfo'];
307 307
                             }, $rel['searchname'].'.nfo', ['Content-type:' => 'application/octet-stream']);
308 308
                         }
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             header('Content-type: text/xml');
345 345
         } else {
346 346
             // JSON encode the XMLWriter response
347
-            $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
347
+            $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR|JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
348 348
             header('Content-type: application/json');
349 349
         }
350 350
         if ($response === false) {
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                 'search' => ['available' => 'yes', 'supportedParams' => 'q'],
388 388
                 'tv-search' => ['available' => 'yes', 'supportedParams' => 'q,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'],
389 389
                 'movie-search' => ['available' => 'yes', 'supportedParams' => 'q,imdbid, tmdbid, traktid'],
390
-                'audio-search' => ['available' => 'no',  'supportedParams' => ''],
390
+                'audio-search' => ['available' => 'no', 'supportedParams' => ''],
391 391
             ],
392 392
             'categories' => $this->type === 'caps'
393 393
                 ? Category::getForMenu()
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
     {
403 403
         $maxAge = -1;
404 404
         if ($request->has('maxage')) {
405
-            if (! $request->filled('maxage')) {
405
+            if (!$request->filled('maxage')) {
406 406
                 return Utility::showApiError(201, 'Incorrect parameter (maxage must not be empty)');
407
-            } elseif (! is_numeric($request->input('maxage'))) {
407
+            } elseif (!is_numeric($request->input('maxage'))) {
408 408
                 return Utility::showApiError(201, 'Incorrect parameter (maxage must be numeric)');
409 409
             } else {
410 410
                 $maxAge = (int) $request->input('maxage');
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         if ($request->has('cat')) {
424 424
             $categoryIDs = urldecode($request->input('cat'));
425 425
             // Append Web-DL category ID if HD present for SickBeard / Sonarr compatibility.
426
-            if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) {
426
+            if (str_contains($categoryIDs, (string) Category::TV_HD) && !str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) {
427 427
                 $categoryIDs .= (','.Category::TV_WEBDL);
428 428
             }
429 429
             $categoryID = explode(',', $categoryIDs);
Please login to merge, or discard this patch.
app/Models/Predb.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@
 block discarded – undo
196 196
             return $predb;
197 197
         }
198 198
         $sql = self::query()->leftJoin('releases', 'releases.predb_id', '=', 'predb.id')->orderByDesc('predb.predate');
199
-        if (! empty($search)) {
199
+        if (!empty($search)) {
200 200
             if (config('nntmux.elasticsearch_enabled') === true) {
201 201
                 $ids = (new ElasticSearchSiteSearch)->predbIndexSearch($search);
202 202
             } else {
Please login to merge, or discard this patch.
app/Models/Release.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     public static function updateRelease($id, $name, $searchName, $fromName, $categoryId, $parts, $grabs, $size, $postedDate, $addedDate, $videoId, $episodeId, $imDbId, $aniDbId): void
276 276
     {
277 277
         $movieInfoId = null;
278
-        if (! empty($imDbId)) {
278
+        if (!empty($imDbId)) {
279 279
             $movieInfoId = MovieInfo::whereImdbid($imDbId)->first(['id']);
280 280
         }
281 281
         self::whereId($id)->update(
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 
527 527
         preg_match('/(^\w+[-_. ].+?\.(\d+p)).+/i', $rel['searchname'], $similar);
528 528
 
529
-        if (! empty($similar)) {
529
+        if (!empty($similar)) {
530 530
             if (config('nntmux.elasticsearch_enabled') === true) {
531 531
                 $searchResult = (new ElasticSearchSiteSearch)->indexSearch($similar[1], 10);
532 532
             } else {
533 533
                 $searchResult = (new ManticoreSearch)->searchIndexes('releases_rt', $similar[1]);
534
-                if (! empty($searchResult)) {
534
+                if (!empty($searchResult)) {
535 535
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
536 536
                 }
537 537
             }
Please login to merge, or discard this patch.