@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | $this->processWork(); |
274 | 274 | $maxWork = \count($this->work); |
275 | 275 | foreach ($this->work as $group) { |
276 | - $pool->add(function () use ($group) { |
|
276 | + $pool->add(function() use ($group) { |
|
277 | 277 | return $this->_executeCommand(PHP_BINARY.' misc/update/backfill.php '.$group->name.(isset($group->max) ? (' '.$group->max) : '')); |
278 | - }, 2000000)->then(function ($output) use ($group, $maxWork) { |
|
278 | + }, 2000000)->then(function($output) use ($group, $maxWork) { |
|
279 | 279 | echo $output; |
280 | 280 | $this->colorCli->primary('Task #'.$maxWork.' Backfilled group '.$group->name); |
281 | - })->catch(function (\Throwable $exception) { |
|
281 | + })->catch(function(\Throwable $exception) { |
|
282 | 282 | echo $exception->getMessage(); |
283 | - })->catch(static function (SerializableException $serializableException) { |
|
283 | + })->catch(static function(SerializableException $serializableException) { |
|
284 | 284 | //we do nothing here just catch the error and move on |
285 | 285 | }); |
286 | 286 | $maxWork--; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | ); |
347 | 347 | |
348 | 348 | $count = 0; |
349 | - if (! empty($data) && isset($data[0]->name)) { |
|
349 | + if (!empty($data) && isset($data[0]->name)) { |
|
350 | 350 | $this->safeBackfillGroup = $data[0]->name; |
351 | 351 | |
352 | 352 | $count = ($data[0]->our_first - $data[0]->their_first); |
@@ -368,14 +368,14 @@ discard block |
||
368 | 368 | |
369 | 369 | $this->processWork(); |
370 | 370 | foreach ($queues as $queue) { |
371 | - $pool->add(function () use ($queue) { |
|
371 | + $pool->add(function() use ($queue) { |
|
372 | 372 | return $this->_executeCommand($this->dnr_path.$queue.'"'); |
373 | - }, 2000000)->then(function ($output) { |
|
373 | + }, 2000000)->then(function($output) { |
|
374 | 374 | echo $output; |
375 | 375 | $this->colorCli->primary('Backfilled group '.$this->safeBackfillGroup); |
376 | - })->catch(function (\Throwable $exception) { |
|
376 | + })->catch(function(\Throwable $exception) { |
|
377 | 377 | echo $exception->getMessage(); |
378 | - })->catch(static function (SerializableException $serializableException) { |
|
378 | + })->catch(static function(SerializableException $serializableException) { |
|
379 | 379 | //we do nothing here just catch the error and move on |
380 | 380 | }); |
381 | 381 | } |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | |
409 | 409 | $this->processWork(); |
410 | 410 | foreach ($this->work as $group) { |
411 | - $pool->add(function () use ($group) { |
|
411 | + $pool->add(function() use ($group) { |
|
412 | 412 | return $this->_executeCommand(PHP_BINARY.' misc/update/update_binaries.php '.$group->name.' '.$group->max); |
413 | - }, 2000000)->then(function ($output) use ($group, $maxWork) { |
|
413 | + }, 2000000)->then(function($output) use ($group, $maxWork) { |
|
414 | 414 | echo $output; |
415 | 415 | $this->colorCli->primary('Task #'.$maxWork.' Updated group '.$group->name); |
416 | - })->catch(function (\Throwable $exception) { |
|
416 | + })->catch(function(\Throwable $exception) { |
|
417 | 417 | echo $exception->getMessage(); |
418 | - })->catch(static function (SerializableException $serializableException) { |
|
418 | + })->catch(static function(SerializableException $serializableException) { |
|
419 | 419 | //we do nothing here just catch the error and move on |
420 | 420 | }); |
421 | 421 | $maxWork--; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | ORDER BY a.last_record DESC' |
443 | 443 | ); |
444 | 444 | |
445 | - if (! empty($this->work)) { |
|
445 | + if (!empty($this->work)) { |
|
446 | 446 | $i = 1; |
447 | 447 | $queues = []; |
448 | 448 | foreach ($this->work as $group) { |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | $this->processWork(); |
476 | 476 | foreach ($queues as $queue) { |
477 | 477 | preg_match('/alt\..+/i', $queue, $hit); |
478 | - $pool->add(function () use ($queue) { |
|
478 | + $pool->add(function() use ($queue) { |
|
479 | 479 | return $this->_executeCommand($this->dnr_path.$queue.'"'); |
480 | - }, 2000000)->then(function ($output) use ($hit) { |
|
481 | - if (! empty($hit)) { |
|
480 | + }, 2000000)->then(function($output) use ($hit) { |
|
481 | + if (!empty($hit)) { |
|
482 | 482 | echo $output; |
483 | 483 | $this->colorCli->primary('Updated group '.$hit[0]); |
484 | 484 | } |
485 | - })->catch(function (\Throwable $exception) { |
|
485 | + })->catch(function(\Throwable $exception) { |
|
486 | 486 | echo $exception->getMessage(); |
487 | - })->catch(static function (SerializableException $serializableException) { |
|
487 | + })->catch(static function(SerializableException $serializableException) { |
|
488 | 488 | //we do nothing here just catch the error and move on |
489 | 489 | }); |
490 | 490 | } |
@@ -547,14 +547,14 @@ discard block |
||
547 | 547 | |
548 | 548 | $this->processWork(); |
549 | 549 | foreach ($this->work as $queue) { |
550 | - $pool->add(function () use ($queue) { |
|
550 | + $pool->add(function() use ($queue) { |
|
551 | 551 | return $this->_executeCommand(PHP_BINARY.' misc/update/tmux/bin/groupfixrelnames.php "'.$queue.'"'.' true'); |
552 | - }, 2000000)->then(function ($output) use ($maxWork) { |
|
552 | + }, 2000000)->then(function($output) use ($maxWork) { |
|
553 | 553 | echo $output; |
554 | 554 | $this->colorCli->primary('Task #'.$maxWork.' Finished fixing releases names'); |
555 | - })->catch(function (\Throwable $exception) { |
|
555 | + })->catch(function(\Throwable $exception) { |
|
556 | 556 | echo $exception->getMessage(); |
557 | - })->catch(static function (SerializableException $serializableException) { |
|
557 | + })->catch(static function(SerializableException $serializableException) { |
|
558 | 558 | //we do nothing here just catch the error and move on |
559 | 559 | }); |
560 | 560 | $maxWork--; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | foreach ($work as $group) { |
576 | 576 | try { |
577 | 577 | $query = DB::select(sprintf('SELECT id FROM collections WHERE groups_id = %d LIMIT 1', $group->id)); |
578 | - if (! empty($query)) { |
|
578 | + if (!empty($query)) { |
|
579 | 579 | $uGroups[] = ['id' => $group->id, 'name' => $group->name]; |
580 | 580 | } |
581 | 581 | } catch (\PDOException $e) { |
@@ -593,14 +593,14 @@ discard block |
||
593 | 593 | |
594 | 594 | $this->processWork(); |
595 | 595 | foreach ($uGroups as $group) { |
596 | - $pool->add(function () use ($group) { |
|
596 | + $pool->add(function() use ($group) { |
|
597 | 597 | return $this->_executeCommand($this->dnr_path.'releases '.$group['id'].'"'); |
598 | - }, 2000000)->then(function ($output) use ($maxWork) { |
|
598 | + }, 2000000)->then(function($output) use ($maxWork) { |
|
599 | 599 | echo $output; |
600 | 600 | $this->colorCli->primary('Task #'.$maxWork.' Finished performing release processing'); |
601 | - })->catch(function (\Throwable $exception) { |
|
601 | + })->catch(function(\Throwable $exception) { |
|
602 | 602 | echo $exception->getMessage(); |
603 | - })->catch(static function (SerializableException $serializableException) { |
|
603 | + })->catch(static function(SerializableException $serializableException) { |
|
604 | 604 | //we do nothing here just catch the error and move on |
605 | 605 | }); |
606 | 606 | $maxWork--; |
@@ -637,16 +637,16 @@ discard block |
||
637 | 637 | $this->processWork(); |
638 | 638 | foreach ($releases as $release) { |
639 | 639 | if ($type !== '') { |
640 | - $pool->add(function () use ($release, $type) { |
|
640 | + $pool->add(function() use ($release, $type) { |
|
641 | 641 | return $this->_executeCommand(PHP_BINARY.' misc/update/postprocess.php '.$type.$release->id); |
642 | - }, 2000000)->then(function ($output) use ($desc, $count) { |
|
642 | + }, 2000000)->then(function($output) use ($desc, $count) { |
|
643 | 643 | echo $output; |
644 | 644 | $this->colorCli->primary('Finished task #'.$count.' for '.$desc); |
645 | - })->catch(function (\Throwable $exception) { |
|
645 | + })->catch(function(\Throwable $exception) { |
|
646 | 646 | echo $exception->getMessage(); |
647 | - })->catch(static function (SerializableException $serializableException) { |
|
647 | + })->catch(static function(SerializableException $serializableException) { |
|
648 | 648 | //we do nothing here just catch the error and move on |
649 | - })->timeout(function () use ($count) { |
|
649 | + })->timeout(function() use ($count) { |
|
650 | 650 | $this->colorCli->notice('Task #'.$count.': Timeout occurred.'); |
651 | 651 | }); |
652 | 652 | $count--; |
@@ -894,15 +894,15 @@ discard block |
||
894 | 894 | $pool = Pool::create()->concurrency($maxProcess)->timeout(config('nntmux.multiprocessing_max_child_time')); |
895 | 895 | $this->processWork(); |
896 | 896 | foreach ($this->work as $group) { |
897 | - $pool->add(function () use ($group) { |
|
897 | + $pool->add(function() use ($group) { |
|
898 | 898 | return $this->_executeCommand($this->dnr_path.'update_per_group '.$group->id.'"'); |
899 | - }, 2000000)->then(function ($output) use ($group) { |
|
899 | + }, 2000000)->then(function($output) use ($group) { |
|
900 | 900 | echo $output; |
901 | 901 | $name = UsenetGroup::getNameByID($group->id); |
902 | 902 | $this->colorCli->primary('Finished updating binaries, processing releases and additional postprocessing for group:'.$name); |
903 | - })->catch(function (\Throwable $exception) { |
|
903 | + })->catch(function(\Throwable $exception) { |
|
904 | 904 | echo $exception->getMessage(); |
905 | - })->catch(static function (SerializableException $serializableException) { |
|
905 | + })->catch(static function(SerializableException $serializableException) { |
|
906 | 906 | echo $serializableException->asThrowable()->getMessage(); |
907 | 907 | }); |
908 | 908 | } |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | { |
919 | 919 | $process = Process::fromShellCommandline($command); |
920 | 920 | $process->setTimeout(1800); |
921 | - $process->run(function ($type, $buffer) { |
|
921 | + $process->run(function($type, $buffer) { |
|
922 | 922 | if (Process::ERR === $type) { |
923 | 923 | echo $buffer; |
924 | 924 | } |