public function handle(UpdatePackageFromWebhookCommand $command)
 {
     $package = false;
     // Plugin?
     try {
         $package = $this->plugins->pusherPluginFromRepository($command->repository);
         $updateCommand = new UpdatePlugin(array('file' => $package->file, 'repository' => $package->repository));
     } catch (PluginNotFound $e) {
         // No plugins...
     }
     // Or theme?
     try {
         $package = $this->themes->pusherThemeFromRepository($command->repository);
         $updateCommand = new UpdateTheme(array('stylesheet' => $package->stylesheet, 'repository' => $package->repository));
     } catch (ThemeNotFound $e) {
         // ... and no themes.
     }
     if (!$package) {
         throw new PushToDeployFailed("Push-to-Deploy failed. Couldn't find matching package.");
     }
     // Check if push to deploy is enabled before executing
     if (!$package->pushToDeploy) {
         throw new PushToDeployFailed("Push-to-Deploy failed. Push-to-Deploy was not enabled for package '{$package->name}'");
     }
     $this->dashboard->execute($updateCommand);
 }
Example #2
0
 public function handle(EditPluginCommand $command)
 {
     $repository = new Repository($command->repository);
     $repository->setBranch($command->branch);
     $this->plugins->editPlugin($command->file, array('repository' => $repository, 'branch' => $repository->getBranch(), 'status' => $command->status, 'ptd' => $command->pushToDeploy, 'subdirectory' => $command->subdirectory));
     do_action('wppusher_plugin_was_edited', new PluginWasEdited());
 }
Example #3
0
 public function getPlugins()
 {
     if (isset($_GET['repo'])) {
         try {
             $plugin = $this->plugins->pusherPluginFromRepository($_GET['repo']);
             return $this->render('plugins/edit', compact('plugin'));
         } catch (PluginNotFound $e) {
             // Plugin doesn't exist, show index instead
         }
     }
     $data['plugins'] = $this->plugins->allPusherPlugins();
     return $this->render('plugins/index', $data);
 }
 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));
 }
 public function handle(UpdatePluginCommand $command)
 {
     $plugin = $this->plugins->pusherPluginFromRepository($command->repository);
     $this->upgrader->upgradePlugin($plugin);
     do_action('wppusher_plugin_was_updated', new PluginWasUpdated($plugin));
 }
 public function handle(UnlinkPluginCommand $command)
 {
     $this->plugins->unlink($command->file);
     do_action('wppusher_plugin_was_unlinked', new PluginWasUnlinked());
 }