Passed
Push — master ( 1e32c6...392926 )
by Darko
11:49
created
app/Services/Runners/BaseRunner.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $process = Process::fromShellCommandline($command);
137 137
         $process->setTimeout(1800);
138
-        $process->run(function ($type, $buffer) {
138
+        $process->run(function($type, $buffer) {
139 139
             if ($type === Process::ERR) {
140 140
                 echo $buffer;
141 141
             }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $running = [];
179 179
         $queue = $tasks;
180 180
 
181
-        $startNext = function () use (&$queue, &$running, $timeout): ?string {
181
+        $startNext = function() use (&$queue, &$running, $timeout): ?string {
182 182
             if (empty($queue)) {
183 183
                 return null;
184 184
             }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 try {
203 203
                     $results[$key] = $callable();
204 204
                 } catch (\Throwable $e) {
205
-                    \Log::error("Task {$key} failed: " . $e->getMessage());
205
+                    \Log::error("Task {$key} failed: ".$e->getMessage());
206 206
                     $results[$key] = '';
207 207
                 }
208 208
             }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                 try {
232 232
                     $results[$key] = $callable();
233 233
                 } catch (\Throwable $e) {
234
-                    \Log::error("Task {$key} failed: " . $e->getMessage());
234
+                    \Log::error("Task {$key} failed: ".$e->getMessage());
235 235
                     $results[$key] = '';
236 236
                 }
237 237
             }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         $running = [];
257 257
         $queue = $commands;
258 258
 
259
-        $startNext = function () use (&$queue, &$running, $timeout) {
259
+        $startNext = function() use (&$queue, &$running, $timeout) {
260 260
             if (empty($queue)) {
261 261
                 return;
262 262
             }
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 
314 314
         $this->headerStart('postprocess: '.$desc, $total, $maxProcesses);
315 315
 
316
-        $startNext = function () use (&$queue, &$running, &$started) {
316
+        $startNext = function() use (&$queue, &$running, &$started) {
317 317
             if (empty($queue)) {
318 318
                 return;
319 319
             }
320 320
             $cmd = array_shift($queue);
321 321
             $proc = Process::fromShellCommandline($cmd);
322 322
             $proc->setTimeout((int) config('nntmux.multiprocessing_max_child_time', 1800));
323
-            $proc->start(function ($type, $buffer) {
323
+            $proc->start(function($type, $buffer) {
324 324
                 // Stream both STDOUT and STDERR
325 325
                 echo $buffer;
326 326
             });
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
         };
330 330
 
331 331
         // Prime initial processes
332
-        for ($i = 0; $i < $maxProcesses && ! empty($queue); $i++) {
332
+        for ($i = 0; $i < $maxProcesses && !empty($queue); $i++) {
333 333
             $startNext();
334 334
         }
335 335
 
336 336
         // Event loop
337
-        while (! empty($running)) {
337
+        while (!empty($running)) {
338 338
             foreach ($running as $key => $proc) {
339
-                if (! $proc->isRunning()) {
339
+                if (!$proc->isRunning()) {
340 340
                     // Print any remaining buffered output
341 341
                     $out = $proc->getIncrementalOutput();
342 342
                     $err = $proc->getIncrementalErrorOutput();
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                         $this->colorCli->primary('Finished task #'.($total - $finished + 1).' for '.$desc);
353 353
                     }
354 354
                     // Start next from queue if available
355
-                    if (! empty($queue)) {
355
+                    if (!empty($queue)) {
356 356
                         $startNext();
357 357
                     }
358 358
                 }
Please login to merge, or discard this patch.
app/Services/AdditionalProcessing/ArchiveExtractionService.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         }
72 72
 
73 73
         // Try ArchiveInfo for RAR/ZIP
74
-        if (! $this->archiveInfo->setData($compressedData, true)) {
74
+        if (!$this->archiveInfo->setData($compressedData, true)) {
75 75
             // Handle standalone video detection
76 76
             $videoType = $this->detectStandaloneVideo($compressedData);
77 77
             if ($videoType !== null) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         }
105 105
 
106 106
         // Check for encryption
107
-        if (! empty($this->archiveInfo->isEncrypted)
107
+        if (!empty($this->archiveInfo->isEncrypted)
108 108
             || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)
109 109
         ) {
110 110
             if ($this->config->debugMode) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
         // Get file list
128 128
         $files = $this->archiveInfo->getArchiveFileList();
129
-        if (! is_array($files) || count($files) === 0) {
129
+        if (!is_array($files) || count($files) === 0) {
130 130
             return $result;
131 131
         }
132 132
 
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
             'passwordStatus' => ReleaseBrowseService::PASSWD_NONE,
208 208
         ];
209 209
 
210
-        if (! $this->config->sevenZipPath) {
210
+        if (!$this->config->sevenZipPath) {
211 211
             return $result;
212 212
         }
213 213
 
214 214
         // Try listing with external 7z binary
215 215
         $listed = $this->listSevenZipEntries($compressedData, $tmpPath);
216
-        if (! empty($listed)) {
217
-            if (! empty($listed[0]['__any_encrypted__'])) {
216
+        if (!empty($listed)) {
217
+            if (!empty($listed[0]['__any_encrypted__'])) {
218 218
                 return [
219 219
                     'success' => false,
220 220
                     'files' => [],
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             }
225 225
 
226 226
             $files = $this->filterSevenZipFiles($listed);
227
-            if (! empty($files)) {
227
+            if (!empty($files)) {
228 228
                 return [
229 229
                     'success' => true,
230 230
                     'files' => $files,
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         // Fallback: scan for filenames in raw data
239 239
         $scannedNames = $this->scanSevenZipFilenames($compressedData);
240
-        if (! empty($scannedNames)) {
240
+        if (!empty($scannedNames)) {
241 241
             $files = array_map(fn($name) => [
242 242
                 'name' => $name,
243 243
                 'size' => 0,
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public function listSevenZipEntries(string $compressedData, string $tmpPath): array
266 266
     {
267
-        if (! $this->config->sevenZipPath) {
267
+        if (!$this->config->sevenZipPath) {
268 268
             return [];
269 269
         }
270 270
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $stderr = null;
281 281
             $ok = $this->execCommand($cmd, $exitCode, $stdout, $stderr);
282 282
 
283
-            if (! $ok || $exitCode !== 0 || empty($stdout)) {
283
+            if (!$ok || $exitCode !== 0 || empty($stdout)) {
284 284
                 // Try plain listing fallback
285 285
                 $plainResult = $this->listSevenZipPlain($tmpFile);
286 286
                 File::delete($tmpFile);
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         $stderr = null;
309 309
         $ok = $this->execCommand($cmd, $exitCode, $stdout, $stderr);
310 310
 
311
-        if (! $ok || $exitCode !== 0 || empty($stdout)) {
311
+        if (!$ok || $exitCode !== 0 || empty($stdout)) {
312 312
             return [];
313 313
         }
314 314
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         $filtered = [];
399 399
 
400 400
         foreach ($files as $entry) {
401
-            if (! empty($entry['__any_encrypted__'])) {
401
+            if (!empty($entry['__any_encrypted__'])) {
402 402
                 continue;
403 403
             }
404 404
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             }
409 409
 
410 410
             $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
411
-            if (! in_array($ext, $allowedExtensions, true)) {
411
+            if (!in_array($ext, $allowedExtensions, true)) {
412 412
                 continue;
413 413
             }
414 414
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
             }
461 461
             $candidate = trim($candidate, " .-\t\n\r");
462 462
             $lower = strtolower($candidate);
463
-            if (! isset($names[$lower])) {
463
+            if (!isset($names[$lower])) {
464 464
                 $names[$lower] = $candidate;
465 465
                 if (count($names) >= 80) {
466 466
                     break;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
             'passwordStatus' => ReleaseBrowseService::PASSWD_NONE,
484 484
         ];
485 485
 
486
-        if ($this->config->extractUsingRarInfo || ! $this->config->sevenZipPath) {
486
+        if ($this->config->extractUsingRarInfo || !$this->config->sevenZipPath) {
487 487
             return $result;
488 488
         }
489 489
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
             $marker = $markerMap[$type] ?? $type;
495 495
 
496 496
             $extractDir = $tmpPath.'un7z/'.uniqid('', true).'/';
497
-            if (! File::isDirectory($extractDir)) {
497
+            if (!File::isDirectory($extractDir)) {
498 498
                 File::makeDirectory($extractDir, 0777, true, true);
499 499
             }
500 500
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
             File::delete($fileName);
525 525
 
526
-            if (! empty($files)) {
526
+            if (!empty($files)) {
527 527
                 return [
528 528
                     'success' => true,
529 529
                     'files' => $this->filterExtractedFiles($files),
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
             $name = $file['name'] ?? '';
554 554
             $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
555 555
 
556
-            if (! in_array($ext, $allowedExtensions, true)) {
556
+            if (!in_array($ext, $allowedExtensions, true)) {
557 557
                 continue;
558 558
             }
559 559
 
@@ -635,14 +635,14 @@  discard block
 block discarded – undo
635 635
      */
636 636
     public function sortFilesWithNfoPriority(array $files): array
637 637
     {
638
-        usort($files, function ($a, $b) {
638
+        usort($files, function($a, $b) {
639 639
             $aIsNfo = $this->isNfoFile($a['name'] ?? '');
640 640
             $bIsNfo = $this->isNfoFile($b['name'] ?? '');
641 641
 
642
-            if ($aIsNfo && ! $bIsNfo) {
642
+            if ($aIsNfo && !$bIsNfo) {
643 643
                 return -1;
644 644
             }
645
-            if (! $aIsNfo && $bIsNfo) {
645
+            if (!$aIsNfo && $bIsNfo) {
646 646
                 return 1;
647 647
             }
648 648
 
@@ -664,12 +664,12 @@  discard block
 block discarded – undo
664 664
         try {
665 665
             if ($this->config->unrarPath) {
666 666
                 $unrarDir = $tmpPath.'unrar/';
667
-                if (! File::isDirectory($unrarDir)) {
667
+                if (!File::isDirectory($unrarDir)) {
668 668
                     File::makeDirectory($unrarDir, 0777, true, true);
669 669
                 }
670 670
             }
671 671
             $unzipDir = $tmpPath.'unzip/';
672
-            if (! File::isDirectory($unzipDir)) {
672
+            if (!File::isDirectory($unzipDir)) {
673 673
                 File::makeDirectory($unzipDir, 0777, true, true);
674 674
             }
675 675
         } catch (\Throwable $e) {
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 
689 689
         switch ($dataSummary['main_type']) {
690 690
             case ArchiveInfo::TYPE_RAR:
691
-                if (! $this->config->extractUsingRarInfo && $this->config->unrarPath) {
691
+                if (!$this->config->extractUsingRarInfo && $this->config->unrarPath) {
692 692
                     $fileName = $tmpPath.uniqid('', true).'.rar';
693 693
                     File::put($fileName, $compressedData);
694 694
                     runCmd($killString.$this->config->unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$tmpPath.'unrar/"');
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
                 return 'r';
698 698
 
699 699
             case ArchiveInfo::TYPE_ZIP:
700
-                if (! $this->config->extractUsingRarInfo && $this->config->unzipPath) {
700
+                if (!$this->config->extractUsingRarInfo && $this->config->unzipPath) {
701 701
                     $fileName = $tmpPath.uniqid('', true).'.zip';
702 702
                     File::put($fileName, $compressedData);
703 703
                     runCmd($this->config->unzipPath.' -o "'.$fileName.'" -d "'.$tmpPath.'unzip/"');
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
         if ($len >= 188 * 5) {
737 737
             $isTs = true;
738 738
             for ($i = 0; $i < 5; $i++) {
739
-                if (! isset($data[188 * $i]) || $data[188 * $i] !== "\x47") {
739
+                if (!isset($data[188 * $i]) || $data[188 * $i] !== "\x47") {
740 740
                     $isTs = false;
741 741
                     break;
742 742
                 }
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
         ];
784 784
 
785 785
         $process = @proc_open($cmd, $descriptorSpec, $pipes, null, null, ['bypass_shell' => true]);
786
-        if (! is_resource($process)) {
786
+        if (!is_resource($process)) {
787 787
             $exitCode = -1;
788 788
             return false;
789 789
         }
Please login to merge, or discard this patch.
app/Services/AdditionalProcessing/ReleaseFileManager.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             return false;
57 57
         }
58 58
 
59
-        if (! isset($file['name'])) {
59
+        if (!isset($file['name'])) {
60 60
             return false;
61 61
         }
62 62
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             $file['crc32'] ?? ''
117 117
         );
118 118
 
119
-        if (! empty($added)) {
119
+        if (!empty($added)) {
120 120
             $context->addedFileInfo++;
121 121
 
122 122
             // Check for codec spam
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 }
127 127
                 $context->releaseHasPassword = true;
128 128
                 $context->passwordStatus = ReleaseBrowseService::PASSWD_RAR;
129
-            } elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) {
129
+            } elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) {
130 130
                 // Run PreDB filename check
131 131
                 $context->release['filename'] = $file['name'];
132 132
                 $context->release['releases_id'] = $context->release->id;
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
         $passwordStatus = max([$context->passwordStatus]);
178 178
 
179 179
         // Set to no password if processing is off
180
-        if (! $processPasswords) {
180
+        if (!$processPasswords) {
181 181
             $context->releaseHasPassword = false;
182 182
         }
183 183
 
184 184
         // Update based on conditions
185
-        if (! $context->releaseHasPassword && $context->nzbHasCompressedFile && $releaseFilesCount === 0) {
185
+        if (!$context->releaseHasPassword && $context->nzbHasCompressedFile && $releaseFilesCount === 0) {
186 186
             Release::query()->where('id', $context->release->id)->update($updateRows);
187 187
         } else {
188 188
             $updateRows['passwordstatus'] = $processPasswords ? $passwordStatus : ReleaseBrowseService::PASSWD_NONE;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         $filesAdded = 0;
299 299
 
300 300
         foreach ($par2Info->getFileList() as $file) {
301
-            if (! isset($file['name'])) {
301
+            if (!isset($file['name'])) {
302 302
                 continue;
303 303
             }
304 304
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             }
330 330
 
331 331
             // Try to get a new name
332
-            if (! $foundName) {
332
+            if (!$foundName) {
333 333
                 $context->release->textstring = $file['name'];
334 334
                 $context->release->releases_id = $context->release->id;
335 335
                 if ($this->nameFixingService->checkName($context->release, $this->config->echoCLI, 'PAR2, ', true, true)) {
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
         // Alternative NFO filenames
394 394
         $nfoPatterns = [
395 395
             '/^(?:file[_-]?id|readme|release|info(?:rmation)?|about|notes?)\.(?:txt|diz)$/i',
396
-            '/^00-[a-z0-9_-]+\.nfo$/i',           // Scene: 00-group.nfo
397
-            '/^0+-[a-z0-9_-]+\.nfo$/i',           // Scene variations
396
+            '/^00-[a-z0-9_-]+\.nfo$/i', // Scene: 00-group.nfo
397
+            '/^0+-[a-z0-9_-]+\.nfo$/i', // Scene variations
398 398
             '/^[a-z0-9_-]+-[a-z0-9_.-]+\.nfo$/i', // Scene: group-release.nfo
399
-            '/info\.txt$/i',                      // info.txt (common alternative)
399
+            '/info\.txt$/i', // info.txt (common alternative)
400 400
         ];
401 401
 
402 402
         $basename = basename($filename);
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
             } elseif ($this->config->debugMode) {
495 495
                 Log::debug('RarInfo: Ignored low-quality candidate "'.$candidate.'" from inner file name.');
496 496
             }
497
-        } elseif (! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
497
+        } elseif (!empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
498 498
             // Try nested archive
499 499
             $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list'];
500 500
             $archiveFileName = array_column($archiveData, 'name');
Please login to merge, or discard this patch.