示例#1
0
 public function handle(InstallThemeCommand $command)
 {
     $theme = new Theme();
     $repository = $this->repositoryFactory->build($command->type, $command->repository);
     if ($command->private and $this->pusher->hasValidLicenseKey()) {
         $repository->makePrivate();
     }
     $repository->setBranch($command->branch);
     $theme->setRepository($repository);
     $theme->setSubdirectory($command->subdirectory);
     $command->dryRun ?: $this->upgrader->installTheme($theme);
     if ($command->subdirectory) {
         $slug = end(explode('/', $command->subdirectory));
     } else {
         $slug = $repository->getSlug();
     }
     $theme = $this->themes->fromSlug($slug);
     $theme->setRepository($repository);
     $theme->setPushToDeploy($command->ptd);
     $theme->setSubdirectory($command->subdirectory);
     $this->themes->store($theme);
     do_action('wppusher_theme_was_installed', new ThemeWasInstalled($theme));
 }
示例#2
0
 public function handle(UpdateThemeCommand $command)
 {
     $theme = $this->themes->pusherThemeFromRepository($command->repository);
     $this->upgrader->upgradeTheme($theme);
     do_action('wppusher_theme_was_updated', new ThemeWasUpdated($theme));
 }