protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $settings = new PhpParallelLint\Settings();
         //$output->writeln("Hola");
         if ($input->hasArgument("directory")) {
             $settings->paths = $input->getArgument("directory");
         }
         if ($input->hasOption("exclude")) {
             $settings->excluded = $input->getOption("exclude");
         }
         if ($input->hasOption("extension")) {
             $settings->extensions = $input->getOption("extension");
         }
         if ($input->hasOption("number-jobs")) {
             $settings->parallelJobs = $input->getOption("number-jobs");
         }
         if ($input->hasOption("no-colors")) {
             $settings->colors = false;
         }
         $manager = new PhpParallelLint\Manager();
         $result = $manager->run($settings);
     } catch (Exception $e) {
     }
 }
Example #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $application = $this->getApplication();
     $config = $application->getConfig();
     $global = false;
     if ($input->hasOption('global')) {
         $global = $input->getOption('global');
     }
     $project = $input->getOption('project');
     if ($global && $project) {
         throw new \Exception('Options `project` and `global` can not used in combination.');
     }
     if (!$global && (!$project || !in_array($project, $this->projects))) {
         throw new \Exception(sprintf('You must provide a valid project value (%s)', implode(',', $this->projects)));
     }
     $override = false;
     if ($input->hasOption('override')) {
         $override = $input->getOption('override');
     }
     if ($global) {
         $this->copyHomeDirectory($output, $config, $override);
     }
     if (!$global) {
         $this->copyCurrentDirectory($output, $config, $override, $project);
     }
 }
Example #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!is_dir($path = realpath($input->getArgument(self::ARGUMENT_PATH)))) {
         throw new \OutOfBoundsException("Could not find " . $input->getArgument(self::ARGUMENT_PATH));
     }
     $output->writeln("Analyze source code in {$path}");
     $project = new Project();
     $project->dataDir = $this->targetDir;
     $project->baseDir = $path;
     if ($input->hasOption(self::OPTION_EXCLUDE)) {
         $project->excludes = array_filter(array_map('trim', explode(',', $input->getOption(self::OPTION_EXCLUDE))));
     }
     if ($input->hasOption(self::OPTION_COVERAGE)) {
         $project->coverage = $input->getOption(self::OPTION_COVERAGE);
     }
     $this->filterHandlers($input);
     foreach ($this->handlers as $name => $handler) {
         $output->writeln(" * Running {$name}");
         try {
             $existingResult = $input->hasOption($name) ? $input->getOption($name) : null;
             if ($result = $handler->handle($project, $existingResult)) {
                 $project->analyzers[$name] = $this->copyResultFile($name, $result);
             }
         } catch (\Exception $exception) {
             $output->writeln('<error>' . $exception . '</error>');
             $result = null;
         }
     }
     file_put_contents($this->targetDir . '/project.json', json_encode($project));
     $output->writeln("Done");
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     global $prefs, $url_scheme, $url_host, $tikiroot, $url_port;
     $days = intval($input->getArgument('days')) ?: 7;
     if ($input->getOption('ssl')) {
         $url_scheme = 'https';
     }
     if ($input->hasOption('port')) {
         $url_port = (int) $input->getOption('port');
     }
     if ($input->hasOption('path')) {
         $tikiroot = $input->getOption('path');
         // Make sure slash before and after
         $tikiroot = rtrim($tikiroot, '/') . '/';
         $tikiroot = '/' . ltrim($tikiroot, '/');
     }
     $url_host = $input->getArgument('domain');
     $list = \TikiDb::get()->fetchAll("\n\t\t\tSELECT userId, login, email, IFNULL(p.value, ?) language\n\t\t\tFROM users_users u\n\t\t\t\tLEFT JOIN tiki_user_preferences p ON u.login = p.user AND p.prefName = 'language'", [$prefs['site_language']]);
     $monitormail = \TikiLib::lib('monitormail');
     $from = date('Y-m-d H:i:s', time() - $days * 24 * 3600);
     $to = date('Y-m-d H:i:s');
     foreach ($list as $info) {
         $success = $monitormail->sendDigest($info, $from, $to);
         if ($success) {
             $output->writeln("Digest sent to {$info['email']}");
         } else {
             $output->writeln("No data for {$info['email']}");
         }
     }
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $command = $this->getApplication()->find('chain');
     $arguments = ['command' => 'chain', '--file' => $this->file, '--placeholder' => $input->getOption('placeholder'), '--generate-inline' => $input->hasOption('generate-inline'), '--no-interaction' => $input->hasOption('no-interaction')];
     $commandInput = new ArrayInput($arguments);
     return $command->run($commandInput, $output);
 }
Example #6
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $pageIdentifiers = array();
     if ($input->hasOption('pageid')) {
         foreach ($input->getOption('pageid') as $pageId) {
             $pageIdentifiers[] = new PageIdentifier(null, (int) $pageId);
         }
     } elseif ($input->hasOption('title')) {
         foreach ($input->getOption('title') as $title) {
             $pageIdentifiers[] = new PageIdentifier(new Title($title));
         }
     } else {
         throw new \RuntimeException('No titles or pageids were set!');
     }
     $wiki = $input->getOption('wiki');
     $wikiDetails = $this->appConfig->offsetGet('wikis.' . $wiki);
     $api = new MediawikiApi($wikiDetails['url']);
     $mwFactory = new MediawikiFactory($api);
     $purger = $mwFactory->newPagePurger();
     /** @var PageIdentifier $identifier */
     foreach ($pageIdentifiers as $identifier) {
         if ($identifier->getId() != null) {
             $output->writeln('Purging page with id ' . $identifier->getId());
         } elseif ($identifier->getTitle() != null) {
             $output->writeln('Purging page with title ' . $identifier->getTitle()->getText());
         }
         $purger->purge(new Page($identifier));
     }
     $output->writeln('Done');
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $yes = $input->hasOption('yes') ? $input->getOption('yes') : false;
     // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration
     if (!$this->confirmGeneration($io, $yes)) {
         return;
     }
     $learning = $input->hasOption('learning') ? $input->getOption('learning') : false;
     $module = $input->getOption('module');
     $class = $input->getOption('class');
     $routes = $input->getOption('routes');
     $test = $input->getOption('test');
     $services = $input->getOption('services');
     $routes = $this->inlineValueAsArray($routes);
     $input->setOption('routes', $routes);
     // @see use Drupal\Console\Command\ServicesTrait::buildServices
     $build_services = $this->buildServices($services);
     // Controller machine name
     $classMachineName = $this->getStringHelper()->camelCaseToMachineName($class);
     $generator = $this->getGenerator();
     $generator->setLearning($learning);
     $generator->generate($module, $class, $routes, $test, $build_services, $classMachineName);
     $this->getChain()->addCommand('router:rebuild');
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $environment = $input->getOption('env');
     try {
         $schema = $input->hasOption('schema') ? $input->getOption('schema') : UniqueIdGenerator::SCHEMA_UUID;
         $qty = $input->hasOption('quantity') ? $input->getOption('quantity') : 1;
         $ver = 5;
         //$input->hasOption('version') ? $input->getOption('version') : 5;
         $generator = UniqueIdGenerator::instance();
         for ($i = 0; $i < $qty; $i++) {
             $id = $generator->generate($schema, $ver);
             $output->writeln($id);
         }
     } catch (\Exception $ex) {
         $exception = new OutputFormatterStyle('red');
         $output->getFormatter()->setStyle('exception', $exception);
         $output->writeln("\n\n");
         $output->writeln('<exception>[Exception in: ' . get_class($this) . ']</exception>');
         $output->writeln('<exception>Exception: ' . get_class($ex) . ' with message: ' . $ex->getMessage() . '</exception>');
         $output->writeln('<exception>Stack Trace:</exception>');
         $output->writeln('<exception>' . $ex->getTraceAsString() . '</exception>');
         exit(1);
     }
     exit(0);
 }
Example #9
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $doctrine = $this->getContainer()->get('doctrine');
     $username = $input->getArgument('username');
     $password = $input->getArgument('password');
     $user = new User($username, $password);
     $roles = ['ROLE_USER', 'ROLE_API'];
     if ($input->hasOption('roles')) {
         $roles = array_merge($roles, $input->getOption('roles'));
     }
     $user->setRoles($roles);
     if ($input->hasOption('firstName')) {
         $user->setFirstName($input->getOption('firstName'));
     }
     if ($input->hasOption('lastName')) {
         $user->setLastName($input->getOption('lastName'));
     }
     if ($input->hasOption('email')) {
         $user->setEmail($input->getOption('email'));
     }
     $manager = $doctrine->getManager();
     $manager->persist($user);
     $manager->flush($user);
     $output->writeln(sprintf('New user: <info>%s</info>, with password: <info>%s</info> created', $username, $password));
 }
Example #10
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /**
      * set context inside container
      */
     $this->container->register(new LoggerProvider($output));
     try {
         /** @var LoggerInterface $logger */
         $logger = $this->container['logger'];
         $connection = ['host' => $input->getArgument('host'), 'port' => $input->getArgument('port'), 'user' => $input->getArgument('username'), 'password' => $input->getArgument('password')];
         $client = $this->container['curl_client_factory']->createClient($connection);
         $queueManager = $this->container['manager_rabbitmq_queue'];
         $exchangeManager = $this->container['manager_rabbitmq_exchange'];
         $policygeManager = $this->container['manager_rabbitmq_policy'];
         $manager = new DeleteManager($exchangeManager, $queueManager, $policygeManager, $logger);
         if ($input->hasOption('queues') && null !== $input->getOption('queues')) {
             $queueManager->setClient($client);
             $manager->deleteQueues($input->getOption('vhost'), $input->getOption('queues'));
         }
         if ($input->hasOption('exchanges') && null !== $input->getOption('exchanges')) {
             $exchangeManager->setClient($client);
             $manager->deleteExchanges($input->getOption('vhost'), $input->getOption('exchanges'));
         }
         if ($input->hasOption('policies') && null !== $input->getOption('policies')) {
             $policygeManager->setClient($client);
             $manager->deletePolicies($input->getOption('vhost'), $input->getOption('policies'));
         }
     } catch (\Exception $e) {
         $logger->critical($e->getMessage());
         return 1;
     }
     return 0;
 }
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->hasOption('key')) {
         $key = $input->getOption('key');
     } else {
         $key = null;
     }
     if ($input->hasOption('secret')) {
         $secret = $input->getOption('secret');
     } else {
         $secret = null;
     }
     try {
         /**
          * @var $authenticator \WeavingTheWeb\Bundle\TwitterBundle\Security\ApplicationAuthenticator
          */
         $authenticator = $this->getContainer()->get('weaving_the_web_twitter.application_authenticator');
         $authenticationResult = $authenticator->authenticate($key, $secret);
         $key = $authenticationResult['consumer_key'];
         /**
          * @var \Symfony\Component\Translation\Translator $translator
          */
         $translator = $this->getContainer()->get('translator');
         $output->writeln($translator->trans('twitter.success.authentication', ['{{ consumer_key }}' => $key]));
     } catch (\Exception $exception) {
         $this->getContainer()->get('logger')->error($exception->getMessage());
         return 1;
     }
     return 0;
 }
Example #12
0
 private function setupQueue(InputInterface $input)
 {
     $container = $this->getContainer();
     if ($input->hasOption('host') && ($host = $input->getOption('host'))) {
         $container[BeanstalkKeys::HOST] = $host;
     }
     if ($input->hasOption('port') && ($port = $input->getOption('port'))) {
         $container[BeanstalkKeys::PORT] = $port;
     }
     $logger = $this->logger;
     if ($container instanceof \Pimple) {
         $container[BeanstalkKeys::QUEUE] = $container->share($container->extend(BeanstalkKeys::QUEUE, function (QueueInterface $queue) use($logger) {
             $queue->setLogger($logger);
             return $queue;
         }));
     } elseif ($container instanceof \Pimple\Container) {
         $container->extend(BeanstalkKeys::QUEUE, function (QueueInterface $queue) use($logger) {
             $queue->setLogger($logger);
             return $queue;
         });
     } else {
         $queue = $container[BeanstalkKeys::QUEUE];
         $queue->setLogger($logger);
         $container[BeanstalkKeys::QUEUE] = $queue;
     }
 }
Example #13
0
 /**
  * @param ExampleEvent $event
  *
  * @throws \PhpSpec\Exception\Example\StopOnFailureException
  */
 public function afterExample(ExampleEvent $event)
 {
     if (!$this->input->hasOption('stop-on-failure') || !$this->input->getOption('stop-on-failure')) {
         return;
     }
     if ($event->getResult() === ExampleEvent::FAILED || $event->getResult() === ExampleEvent::BROKEN) {
         throw new StopOnFailureException('Example failed');
     }
 }
 /**
  * Get default parameters
  *
  * @return array
  */
 protected function getDefaultParams()
 {
     $defaultParams = ['--no-debug' => true];
     if ($this->input->hasOption('env')) {
         $defaultParams['--env'] = $this->input->getOption('env');
     }
     if ($this->input->hasOption('verbose') && $this->input->getOption('verbose') === true) {
         $defaultParams['--verbose'] = true;
     }
     return $defaultParams;
 }
Example #15
0
 /**
  * @param InputInterface $input
  * @param bool           $alsoDisable
  * @param bool           $includeRemote
  * @param string|null    $factory
  * @param int|null       $signal
  *
  * @throws Exception\InvalidArgumentException
  */
 private function parseCommandLine(InputInterface $input, &$alsoDisable, &$includeRemote, &$factory, &$signal)
 {
     $alsoDisable = $input->getOption('also-disable');
     $includeRemote = $input->getOption('include-remote');
     $factory = $input->hasOption('factory') ? $input->getOption('factory') : null;
     $signal = $input->hasOption('signal') ? $input->getOption('signal') : null;
     if ($signal !== null) {
         $includeRemote = false;
         $signal = self::parseSignal($signal);
     }
 }
Example #16
0
 /**
  * @param InputInterface $input
  **/
 protected function setupEnvironment(InputInterface $input)
 {
     if ($input->hasOption('path')) {
         $this->env = new Environment($input->getOption('path'));
     } else {
         if ($input->hasOption('use-current-dir')) {
             $this->env = new Environment(getcwd());
         } else {
             $this->env = new Environment();
         }
     }
 }
 /**
  * Ask the user to confirm an action.
  *
  * @param string          $questionText
  * @param InputInterface  $input
  * @param OutputInterface $output
  * @param bool            $default
  *
  * @return bool
  */
 public function confirm($questionText, InputInterface $input, OutputInterface $output, $default = true)
 {
     $yes = $input->hasOption('yes') && $input->getOption('yes');
     $no = $input->hasOption('no') && $input->getOption('no');
     if ($yes && !$no) {
         return true;
     } elseif ($no && !$yes) {
         return false;
     }
     $questionText .= ' <question>' . ($default ? '[Y/n]' : '[y/N]') . '</question> ';
     $question = new ConfirmationQuestion($questionText, $default);
     return $this->ask($input, $output, $question);
 }
Example #18
0
 /**
  * @param InputInterface $input
  * @return Factory
  */
 protected function configureFileFactory(InputInterface $input)
 {
     $factory = $this->doxport->getFileFactory();
     if ($input->hasArgument('data-dir') && $input->getArgument('data-dir')) {
         $factory->setPath($input->getArgument('data-dir'));
     } elseif ($input->hasOption('data-dir') && $input->getOption('data-dir')) {
         $factory->setPath($input->getOption('data-dir'));
     }
     if ($input->hasOption('format') && $input->getOption('format')) {
         $factory->setFormat($input->getOption('format'));
     }
     return $factory;
 }
 /**
  * {@inheritdoc}
  */
 public function ask(InputInterface $input, OutputInterface $output, Question $question)
 {
     if ($question instanceof ConfirmationQuestion) {
         $yes = $input->hasOption('yes') && $input->getOption('yes');
         $no = $input->hasOption('no') && $input->getOption('no');
         if ($yes && !$no) {
             return true;
         } elseif ($no && !$yes) {
             return false;
         }
     }
     return parent::ask($input, $output, $question);
 }
 function it_should_use_passed_options_rather_than_default_params(InputInterface $input, Application $application)
 {
     $input->hasOption('no-interaction')->willReturn(true);
     $input->getOption('no-interaction')->willReturn(false);
     $input->hasOption('env')->willReturn(true);
     $input->getOption('env')->willReturn('dev');
     $input->hasOption('verbose')->willReturn(true);
     $input->getOption('verbose')->willReturn(true);
     $arrayInput = new ArrayInput(array('command' => 'command', '--no-debug' => true, '--env' => 'dev', '--no-interaction' => true, '--verbose' => true));
     $application->setAutoExit(false)->shouldBeCalled();
     $application->run($arrayInput, new NullOutput())->willReturn(0);
     $this->runCommand('command', array('--no-interaction' => true));
 }
Example #21
0
 /**
  * Get default parameters.
  *
  * @return array
  */
 protected function getDefaultParameters()
 {
     $defaultParameters = array('--no-debug' => true);
     if ($this->input->hasOption('env')) {
         $defaultParameters['--env'] = $this->input->hasOption('env') ? $this->input->getOption('env') : Kernel::ENV_DEV;
     }
     if ($this->input->hasOption('no-interaction') && true === $this->input->getOption('no-interaction')) {
         $defaultParameters['--no-interaction'] = true;
     }
     if ($this->input->hasOption('verbose') && true === $this->input->getOption('verbose')) {
         $defaultParameters['--verbose'] = true;
     }
     return $defaultParameters;
 }
Example #22
0
 /**
  * Get default parameters.
  *
  * @return array
  */
 protected function getDefaultParameters()
 {
     $defaultParameters = ['--no-debug' => true];
     if ($this->input->hasOption('env')) {
         $defaultParameters['--env'] = $this->input->hasOption('env') ? $this->input->getOption('env') : 'dev';
     }
     if ($this->input->hasOption('no-interaction') && true === $this->input->getOption('no-interaction')) {
         $defaultParameters['--no-interaction'] = true;
     }
     if ($this->input->hasOption('verbose') && true === $this->input->getOption('verbose')) {
         $defaultParameters['--verbose'] = true;
     }
     return $defaultParameters;
 }
 /**
  * @param InputInterface $input
  * @return array
  */
 protected function getTokens(InputInterface $input)
 {
     if ($input->hasOption('oauth_secret') && !is_null($input->getOption('oauth_secret'))) {
         $secret = $input->getOption('oauth_secret');
     } else {
         $secret = $this->getContainer()->getParameter('weaving_the_web_twitter.oauth_secret.default');
     }
     if ($input->hasOption('oauth_token') && !is_null($input->getOption('oauth_token'))) {
         $token = $input->getOption('oauth_token');
     } else {
         $token = $this->getContainer()->getParameter('weaving_the_web_twitter.oauth_token.default');
     }
     return ['secret' => $secret, 'token' => $token];
 }
Example #24
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $interactive = false;
     $learning = $input->hasOption('learning') ? $input->getOption('learning') : false;
     $file = null;
     if ($input->hasOption('file')) {
         $file = $input->getOption('file');
     }
     if (!$file) {
         $io->error($this->trans('commands.chain.messages.missing_file'));
         return;
     }
     if (strpos($file, '~') === 0) {
         $home = rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/');
         $file = realpath(preg_replace('/~/', $home, $file, 1));
     }
     if (!(strpos($file, '/') === 0)) {
         $file = sprintf('%s/%s', getcwd(), $file);
     }
     if (!file_exists($file)) {
         $io->error(sprintf($this->trans('commands.chain.messages.invalid_file'), $file));
         return;
     }
     $configData = $this->getApplication()->getConfig()->getFileContents($file);
     $commands = [];
     if (array_key_exists('commands', $configData)) {
         $commands = $configData['commands'];
     }
     foreach ($commands as $command) {
         $moduleInputs = [];
         $arguments = !empty($command['arguments']) ? $command['arguments'] : [];
         $options = !empty($command['options']) ? $command['options'] : [];
         foreach ($arguments as $key => $value) {
             $moduleInputs[$key] = is_null($value) ? '' : $value;
         }
         foreach ($options as $key => $value) {
             $moduleInputs['--' . $key] = is_null($value) ? '' : $value;
         }
         $parameterOptions = $input->getOptions();
         unset($parameterOptions['file']);
         foreach ($parameterOptions as $key => $value) {
             if ($value === true) {
                 $moduleInputs['--' . $key] = true;
             }
         }
         $this->getChain()->addCommand($command['command'], $moduleInputs, $interactive, $learning);
     }
 }
 /**
  * Ask the user to confirm an action.
  *
  * @param string          $questionText
  * @param bool            $default
  *
  * @return bool
  */
 public function confirm($questionText, $default = true)
 {
     $questionText .= ' <question>' . ($default ? '[Y/n]' : '[y/N]') . '</question> ';
     $yes = $this->input->hasOption('yes') && $this->input->getOption('yes');
     $no = $this->input->hasOption('no') && $this->input->getOption('no');
     if ($yes && !$no) {
         $this->output->writeln($questionText . 'y');
         return true;
     } elseif ($no && !$yes) {
         $this->output->writeln($questionText . 'n');
         return false;
     }
     $question = new ConfirmationQuestion($questionText, $default);
     return $this->ask($this->input, $this->output, $question);
 }
 /**
  * @param string $value
  *
  * @return string
  */
 protected function formatDate($value)
 {
     $format = null;
     if (isset($this->input) && $this->input->hasOption('date-fmt')) {
         $format = $this->input->getOption('date-fmt');
     }
     $format = $format ?: self::DEFAULT_DATE_FORMAT;
     // Workaround for the ssl.expires_on date, which is currently a
     // timestamp in milliseconds.
     if (substr($value, -3) === '000' && strlen($value) === 13) {
         $value = substr($value, 0, 10);
     }
     $timestamp = is_numeric($value) ? $value : strtotime($value);
     return date($format, $timestamp);
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $url = $input->getArgument('url');
     $depth = $input->hasOption('depth') ? $input->getOption('depth') : $this->defaultParameters['depth'];
     $indexName = $input->hasOption('index') ? $input->getOption('index') : $this->defaultParameters['index'];
     $dontClean = $input->hasOption('dont-clean') ? $input->getOption('dont-clean') : $this->defaultParameters['dont-clean'];
     $force = $input->hasOption('force') ? $input->getOption('force') : $this->defaultParameters['force'];
     $indexing = $input->hasOption('indexing') ? $input->getOption('indexing') : $this->defaultParameters['indexing'];
     $output->writeln(sprintf('Starting from "%s" at %s', $url, date('d.m.Y H:i:s')));
     $crawler = $this->getContainer()->get('symbio_fulltext_search.crawler');
     $crawler->setIndexName($indexName);
     $crawler->setLogger($output);
     $crawler->createIndex($url, $depth !== false ?: false, $force, !$dontClean, $indexing);
     $output->writeln(sprintf('Finished crawling at %s', date('d.m.Y H:i:s')));
 }
Example #28
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $yes = $input->hasOption('yes') ? $input->getOption('yes') : false;
     // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration
     if (!$this->confirmGeneration($io, $yes)) {
         return;
     }
     $module = $this->validator->validateModuleName($input->getOption('module'));
     $modulePath = $this->appRoot . $input->getOption('module-path');
     $modulePath = $this->validator->validateModulePath($modulePath, true);
     $machineName = $this->validator->validateMachineName($input->getOption('machine-name'));
     $description = $input->getOption('description');
     $core = $input->getOption('core');
     $package = $input->getOption('package');
     $moduleFile = $input->getOption('module-file');
     $featuresBundle = $input->getOption('features-bundle');
     $composer = $input->getOption('composer');
     // Modules Dependencies, re-factor and share with other commands
     $dependencies = $this->validator->validateModuleDependencies($input->getOption('dependencies'));
     // Check if all module dependencies are available
     if ($dependencies) {
         $checked_dependencies = $this->checkDependencies($dependencies['success']);
         if (!empty($checked_dependencies['no_modules'])) {
             $io->warning(sprintf($this->trans('commands.generate.module.warnings.module-unavailable'), implode(', ', $checked_dependencies['no_modules'])));
         }
         $dependencies = $dependencies['success'];
     }
     $this->generator->generate($module, $machineName, $modulePath, $description, $core, $package, $moduleFile, $featuresBundle, $composer, $dependencies);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $module = $input->getOption('module');
     $permissions = $input->getOption('permissions');
     $learning = $input->hasOption('learning');
     $this->generator->generate($module, $permissions, $learning);
 }
Example #30
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $database = $input->getArgument('database');
     $file = $input->getOption('file');
     $learning = $input->hasOption('learning') ? $input->getOption('learning') : false;
     $databaseConnection = $this->resolveConnection($io, $database);
     if (!$file) {
         $date = new \DateTime();
         $file = sprintf('%s/%s-%s.sql', $this->getSite()->getSiteRoot(), $databaseConnection['database'], $date->format('Y-m-d-h-i-s'));
     }
     $command = sprintf('mysqldump --user=%s --password=%s --host=%s --port=%s %s > %s', $databaseConnection['username'], $databaseConnection['password'], $databaseConnection['host'], $databaseConnection['port'], $databaseConnection['database'], $file);
     if ($learning) {
         $io->commentBlock($command);
     }
     $processBuilder = new ProcessBuilder(['–lock-all-tables']);
     $process = $processBuilder->getProcess();
     $process->setTty('true');
     $process->setCommandLine($command);
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
     $io->success(sprintf('%s %s', $this->trans('commands.database.dump.messages.success'), $file));
 }