Esempio n. 1
0
 public function handle(InstallPluginCommand $command)
 {
     $plugin = new Plugin();
     $repository = $this->repositoryFactory->build($command->type, $command->repository);
     if ($command->private and $this->pusher->hasValidLicenseKey()) {
         $repository->makePrivate();
     }
     $repository->setBranch($command->branch);
     $plugin->setRepository($repository);
     $plugin->setSubdirectory($command->subdirectory);
     $command->dryRun ?: $this->upgrader->installPlugin($plugin);
     if ($command->subdirectory) {
         $slug = end(explode('/', $command->subdirectory));
     } else {
         $slug = $repository->getSlug();
     }
     $plugin = $this->plugins->fromSlug($slug);
     $plugin->setRepository($repository);
     $plugin->setPushToDeploy($command->ptd);
     $plugin->setSubdirectory($command->subdirectory);
     $this->plugins->store($plugin);
     do_action('wppusher_plugin_was_installed', new PluginWasInstalled($plugin));
 }
Esempio n. 2
0
 public function handle(UpdatePluginCommand $command)
 {
     $plugin = $this->plugins->pusherPluginFromRepository($command->repository);
     $this->upgrader->upgradePlugin($plugin);
     do_action('wppusher_plugin_was_updated', new PluginWasUpdated($plugin));
 }