Esempio n. 1
0
 /**
  * @return \DrupalPatchUtils\Config
  */
 protected function getConfig()
 {
     if (!is_object($this->config)) {
         $this->config = new Config();
         $this->config->load();
     }
     return $this->config;
 }
Esempio n. 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = new Config();
     $config->load();
     $question_helper = new QuestionHelper();
     try {
         $default = $config->getCacheDir();
     } catch (\Exception $e) {
         $default = FALSE;
     }
     $question = new Question("Enter path to cache dir ({$default}): ", $default);
     $question->setValidator(array($this, 'validateCacheDir'));
     $cache_dir = $question_helper->ask($input, $output, $question);
     try {
         $default = $config->getDrupalRepoDir();
     } catch (\Exception $e) {
         $default = FALSE;
     }
     $question = new Question("Enter path to Drupal repository ({$default}): ", $default);
     $question->setValidator(array($this, 'validateDrupalRepo'));
     $repo_dir = $question_helper->ask($input, $output, $question);
     try {
         $default = $config->getDrupalUser();
     } catch (\Exception $e) {
         $default = FALSE;
     }
     $question = new Question("Enter username to use on d.o ({$default}): ", $default);
     $douser = $question_helper->ask($input, $output, $question);
     try {
         $default = $config->getHoneypotSleepTime();
     } catch (\Exception $e) {
         $default = 20;
     }
     $question = new Question("Enter honeypot sleep time ({$default}): ", $default);
     $honeypot_sleep_time = $question_helper->ask($input, $output, $question);
     $config->setCacheDir($cache_dir)->setDrupalRepoDir($repo_dir)->setDrupalUser($douser)->setHoneypotSleepTime($honeypot_sleep_time)->write();
 }