From: Vincent Vanwaelscappel Date: Wed, 11 Mar 2020 18:33:58 +0000 (+0100) Subject: wip #3490 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=af5bad2ebec6c5a1262d3a75bc831e08bfd76fd1;p=cubist_cms-back.git wip #3490 @1 --- diff --git a/src/app/Console/Commands/CubistCommand.php b/src/app/Console/Commands/CubistCommand.php index 2e39184..f95e2e4 100644 --- a/src/app/Console/Commands/CubistCommand.php +++ b/src/app/Console/Commands/CubistCommand.php @@ -10,18 +10,27 @@ use Symfony\Component\Process\Process; class CubistCommand extends Command { + public function executeProcessQuiet($command) + { + return $this->executeProcess($command, '', '', false); + } + + /** * Run a SSH command. * * @param string|array $command The SSH command that needs to be run * @param bool $beforeNotice Information for the user before the command is run * @param bool $afterNotice Information for the user after the command is run + * @param bool $output * * @return mixed Command-line output */ - public function executeProcess($command, $beforeNotice = false, $afterNotice = false) + public function executeProcess($command, $beforeNotice = false, $afterNotice = false, $output = true) { - $this->echo('info', $beforeNotice ? ' ' . $beforeNotice : $command); + if ($output) { + $this->echo('info', $beforeNotice ? ' ' . $beforeNotice : $command); + } if (is_string($command)) { $process = Process::fromShellCommandline($command, null, null, null, 180); @@ -30,11 +39,13 @@ class CubistCommand extends Command } - $process->run(function ($type, $buffer) { - if (Process::ERR === $type) { - $this->echo('comment', $buffer); - } else { - $this->echo('line', $buffer); + $process->run(function ($type, $buffer) use ($output) { + if ($output) { + if (Process::ERR === $type) { + $this->echo('comment', $buffer); + } else { + $this->echo('line', $buffer); + } } }); @@ -43,7 +54,7 @@ class CubistCommand extends Command throw new ProcessFailedException($process); } - if ($afterNotice) { + if ($afterNotice && $output) { $this->echo('info', $afterNotice); } } diff --git a/src/app/Magic/Models/CubistMagicAuthenticable.php b/src/app/Magic/Models/CubistMagicAuthenticable.php new file mode 100644 index 0000000..4d1dc92 --- /dev/null +++ b/src/app/Magic/Models/CubistMagicAuthenticable.php @@ -0,0 +1,21 @@ +