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); }
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(UpdatePluginCommand $command) { $plugin = $this->plugins->pusherPluginFromRepository($command->repository); $this->upgrader->upgradePlugin($plugin); do_action('wppusher_plugin_was_updated', new PluginWasUpdated($plugin)); }