Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 04c67dc

Browse files
author
Dan Cryer
committed
Update installer to support new worker functionality. Closes #1094
1 parent 4b8d25c commit 04c67dc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

PHPCI/Command/InstallCommand.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use b8\Store\Factory;
1717
use PHPCI\Helper\Lang;
1818
use Symfony\Component\Console\Command\Command;
19+
use Symfony\Component\Console\Helper\DialogHelper;
1920
use Symfony\Component\Console\Input\InputInterface;
2021
use Symfony\Component\Console\Input\InputOption;
2122
use Symfony\Component\Console\Output\OutputInterface;
@@ -46,6 +47,9 @@ protected function configure()
4647
->addOption('admin-pass', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_pass'))
4748
->addOption('admin-mail', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_email'))
4849
->addOption('config-path', null, InputOption::VALUE_OPTIONAL, Lang::get('config_path'), $defaultPath)
50+
->addOption('queue-disabled', null, InputOption::VALUE_NONE, 'Don\'t ask for queue details')
51+
->addOption('queue-server', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue server hostname')
52+
->addOption('queue-name', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue name')
4953
->setDescription(Lang::get('install_phpci'));
5054
}
5155

@@ -229,10 +233,37 @@ protected function getPhpciConfigInformation(InputInterface $input, OutputInterf
229233
}
230234

231235
$phpci['url'] = $url;
236+
$phpci['worker'] = $this->getQueueInformation($input, $output, $dialog);
232237

233238
return $phpci;
234239
}
235240

241+
/**
242+
* If the user wants to use a queue, get the necessary details.
243+
* @param InputInterface $input
244+
* @param OutputInterface $output
245+
* @param DialogHelper $dialog
246+
* @return array
247+
*/
248+
protected function getQueueInformation(InputInterface $input, OutputInterface $output, DialogHelper $dialog)
249+
{
250+
if ($input->getOption('queue-disabled')) {
251+
return null;
252+
}
253+
254+
$rtn = [];
255+
256+
if (!$rtn['host'] = $input->getOption('queue-server')) {
257+
$rtn['host'] = $dialog->ask($output, 'Enter your beanstalkd hostname [localhost]: ', 'localhost');
258+
}
259+
260+
if (!$rtn['queue'] = $input->getOption('queue-name')) {
261+
$rtn['queue'] = $dialog->ask($output, 'Enter the queue (tube) name to use [phpci]: ', 'phpci');
262+
}
263+
264+
return $rtn;
265+
}
266+
236267
/**
237268
* Load configuration for DB form CLI options or ask info to user.
238269
*

0 commit comments

Comments
 (0)