From: Vincent Vanwaelscappel Date: Wed, 11 Mar 2020 13:52:18 +0000 (+0100) Subject: wip #3491 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=34849bd2ac15a2cb1b7a5b8e5d9970923c501902;p=cubist_cms-back.git wip #3491 --- diff --git a/composer.json b/composer.json index ca78d69..9ff7549 100644 --- a/composer.json +++ b/composer.json @@ -31,24 +31,24 @@ "cubist/cms-front": "dev-master", "cubist/util": "dev-master", "cubist/locale": "dev-master", + "cubist/laravel-backpack-dropzone-field": "dev-master", "fideloper/proxy": "^4.2", "predis/predis": "^1.1", - "spatie/laravel-translatable": "^4.2", - "venturecraft/revisionable": "^1.33", - "cubist/laravel-backpack-dropzone-field": "dev-master", - "cviebrock/eloquent-sluggable": "^6.0", + "spatie/laravel-translatable": "^4.3", + "venturecraft/revisionable": "^1.34", + "cviebrock/eloquent-sluggable": "^7.0", "lavary/laravel-menu": "^1.7", - "graham-campbell/markdown": "^11.0", + "graham-campbell/markdown": "^12.0", "barryvdh/laravel-debugbar": "^3.2", "league/commonmark-ext-autolink": "^1.0", - "cviebrock/laravel-elasticsearch": "^4.1", - "spatie/laravel-honeypot": "^1.4", + "cviebrock/laravel-elasticsearch": "^4.2", + "spatie/laravel-honeypot": "^2.1", "chrisjean/php-ico": "^1.0", "swayok/alternative-laravel-cache": "^5.4" }, "require-dev": { "filp/whoops": "^2.7", - "laravel/tinker": "^2.1", + "laravel/tinker": "^2.2", "barryvdh/laravel-ide-helper": "^2.6" }, "extra": { diff --git a/src/app/Console/Commands/CubistCommand.php b/src/app/Console/Commands/CubistCommand.php index 0384e53..aa3ff2b 100644 --- a/src/app/Console/Commands/CubistCommand.php +++ b/src/app/Console/Commands/CubistCommand.php @@ -3,12 +3,7 @@ namespace Cubist\Backpack\app\Console\Commands; - -use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel; -use Cubist\Util\Files\Files; -use Cubist\Util\PHP; use Illuminate\Console\Command; -use Illuminate\Support\Facades\App; use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; @@ -18,7 +13,7 @@ class CubistCommand extends Command /** * Run a SSH command. * - * @param string $command The SSH command that needs to be run + * @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 * @@ -28,7 +23,11 @@ class CubistCommand extends Command { $this->echo('info', $beforeNotice ? ' ' . $beforeNotice : $command); - $process = new Process($command, null, null, null, 180, null); + if (is_string($command)) { + $command = [$command]; + } + + $process = new Process($command, null, null, null, 180); $process->run(function ($type, $buffer) { if (Process::ERR === $type) { $this->echo('comment', $buffer); @@ -60,29 +59,4 @@ class CubistCommand extends Command $this->{$type}($content); } } - - protected function _handleMagicFolder($callback) - { - $magic = app_path() . '/Models'; - - $this->line('Environment ' . App::environment()); - - $iterator = Files::getDirectoryIterator($magic, true); - foreach ($iterator as $item) { - $this->line('Testing ' . $item); - /** @var $item \SplFileInfo */ - if ($item->isFile() && $item->getExtension() == 'php') { - try { - $class = PHP::instanciateClassInFile($item); - if ($class instanceof CubistMagicAbstractModel) { - if (is_callable($callback)) { - call_user_func($callback, $class); - } - } - } catch (\Exception $e) { - $this->line($e->getMessage()); - } - } - } - } } diff --git a/src/app/Console/Commands/CubistMagicCommand.php b/src/app/Console/Commands/CubistMagicCommand.php new file mode 100644 index 0000000..de6a69f --- /dev/null +++ b/src/app/Console/Commands/CubistMagicCommand.php @@ -0,0 +1,37 @@ +line('Environment ' . App::environment()); + + $iterator = Files::getDirectoryIterator($magic, true); + foreach ($iterator as $item) { + $this->line('Testing ' . $item); + /** @var $item \SplFileInfo */ + if ($item->isFile() && $item->getExtension() == 'php') { + try { + $class = PHP::instanciateClassInFile($item); + if ($class instanceof CubistMagicAbstractModel) { + if (is_callable($callback)) { + call_user_func($callback, $class); + } + } + } catch (\Exception $e) { + $this->line($e->getMessage()); + } + } + } + } +} diff --git a/src/app/Console/Commands/GenerateCommand.php b/src/app/Console/Commands/GenerateCommand.php index 4191c85..936fd2d 100644 --- a/src/app/Console/Commands/GenerateCommand.php +++ b/src/app/Console/Commands/GenerateCommand.php @@ -5,7 +5,7 @@ namespace Cubist\Backpack\app\Console\Commands; use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel; use Cubist\Backpack\app\Magic\Util; -class GenerateCommand extends CubistCommand +class GenerateCommand extends CubistMagicCommand { /** * The name and signature of the console command. diff --git a/src/app/Console/Commands/MigrateCommand.php b/src/app/Console/Commands/MigrateCommand.php index 669f7b4..1d1469d 100644 --- a/src/app/Console/Commands/MigrateCommand.php +++ b/src/app/Console/Commands/MigrateCommand.php @@ -1,15 +1,13 @@