/** * Execute the console command. * * @return mixed */ public function handle() { $plugin_name = $this->argument('plugin'); $error_line = <<<EOF Sorry but the plugin: '{$plugin_name}' doenst exists! EOF; $confirm_line = <<<EOF The plugin: '{$plugin_name}' doenst exists do you whish to sync plugins? [y|N] EOF; $success_line = <<<EOF <comment>{$plugin_name} installed success</comment> EOF; $this->pluginManager->init(); if ($plugin = $this->pluginManager->getPluginCollection()->get($plugin_name)) { $plugin->install(); $this->line($success_line); } else { if ($this->confirm($confirm_line, 'y')) { $this->pluginManager->sync(); if ($plugin = $this->pluginManager->getPluginCollection()->get($plugin_name)) { $plugin->install(); $this->line($success_line); } else { $this->error($error_line); } } } }
/** * Execute the console command. * * @return mixed */ public function handle() { $this->pluginManager->init(); $plugin = $this->pluginManager->getPluginCollection()->get($this->argument('plugin')); $plugin->deactivate(); $line = <<<EOF <comment>{$plugin->getName()} deactivated success</comment> EOF; $this->line($line); }
/** * Execute the console command. * * @return mixed */ public function handle() { $this->pluginManager->init(); $plugin = $this->pluginManager->getPluginCollection()->get($this->argument('plugin')); if ($plugin !== null) { if (!$plugin->isInstalled()) { $plugin->install(); } $plugin->activate(); $line = <<<EOF <comment>{$plugin->getName()} activated success</comment> EOF; $this->line($line); } else { $this->error(sprintf('The plugin: %s doesnt exists.', $this->argument('plugin'))); } }