/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $modules = $input->getArgument('module'); $composer = $input->getOption('composer'); $simulate = $input->getOption('simulate'); if (!$composer) { $io->error($this->trans('commands.module.update.messages.only-composer')); return 1; } if (!$modules) { $io->error($this->trans('commands.module.update.messages.missing-module')); return 1; } if (count($modules) > 1) { $modules = " drupal/" . implode(" drupal/", $modules); } else { $modules = " drupal/" . current($modules); } if ($composer) { // Register composer repository $command = "composer config repositories.drupal composer https://packagist.drupal-composer.org"; $this->shellProcess->exec($command, $this->root); $command = 'composer update ' . $modules . ' --optimize-autoloader --prefer-dist --no-dev --root-reqs '; if ($simulate) { $command .= " --dry-run"; } if ($this->shellProcess->exec($command, $this->root)) { $io->success(sprintf($this->trans('commands.module.update.messages.composer'), trim($modules))); } } return 0; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $database = $input->getArgument('database'); $file = $input->getOption('file'); $learning = $input->getOption('learning'); $databaseConnection = $this->resolveConnection($io, $database); if (!$file) { $date = new \DateTime(); $file = sprintf('%s/%s-%s.sql', $this->appRoot, $databaseConnection['database'], $date->format('Y-m-d-h-i-s')); } $command = null; if ($databaseConnection['driver'] == 'mysql') { $command = sprintf('mysqldump --user=%s --password=%s --host=%s --port=%s %s > %s', $databaseConnection['username'], $databaseConnection['password'], $databaseConnection['host'], $databaseConnection['port'], $databaseConnection['database'], $file); } elseif ($databaseConnection['driver'] == 'pgsql') { $command = sprintf('PGPASSWORD="******" pg_dumpall -w -U %s -h %s -p %s -l %s -f %s', $databaseConnection['password'], $databaseConnection['username'], $databaseConnection['host'], $databaseConnection['port'], $databaseConnection['database'], $file); } if ($learning) { $io->commentBlock($command); } if ($this->shellProcess->exec($command, $this->appRoot)) { $io->success(sprintf('%s %s', $this->trans('commands.database.dump.messages.success'), $file)); } return 0; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $modules = $input->getArgument('module'); $latest = $input->getOption('latest'); $path = $input->getOption('path'); $composer = $input->getOption('composer'); $unstable = true; if ($composer) { foreach ($modules as $module) { if (!$latest) { $versions = $this->drupalApi->getPackagistModuleReleases($module, 10, $unstable); if (!$versions) { $io->error(sprintf($this->trans('commands.module.download.messages.no-releases'), $module)); return 1; } else { $version = $io->choice($this->trans('commands.site.new.questions.composer-release'), $versions); } } else { $versions = $this->drupalApi->getPackagistModuleReleases($module, 10, $unstable); if (!$versions) { $io->error(sprintf($this->trans('commands.module.download.messages.no-releases'), $module)); return 1; } else { $version = current($this->drupalApi->getPackagistModuleReleases($module, 1, $unstable)); } } // Register composer repository $command = "composer config repositories.drupal composer https://packagist.drupal-composer.org"; $this->shellProcess->exec($command, $this->root); $command = sprintf('composer require drupal/%s:%s --prefer-dist --optimize-autoloader --sort-packages --update-no-dev', $module, $version); if ($this->shellProcess->exec($command, $this->root)) { $io->success(sprintf($this->trans('commands.module.download.messages.composer'), $module)); } } } else { $this->downloadModules($io, $modules, $latest, $path); } return true; }
/** * @return string */ public function getOutput() { return $this->process->getOutput(); }