Adding verification to the install and update commands to check whether PHPCI is installed.
This commit is contained in:
parent
9f182aad91
commit
65f51cff4a
|
@ -43,6 +43,8 @@ class InstallCommand extends Command
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$this->verifyNotInstalled($output);
|
||||||
|
|
||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
$output->writeln('<info>******************</info>');
|
$output->writeln('<info>******************</info>');
|
||||||
$output->writeln('<info> Welcome to PHPCI</info>');
|
$output->writeln('<info> Welcome to PHPCI</info>');
|
||||||
|
@ -278,4 +280,17 @@ class InstallCommand extends Command
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function verifyNotInstalled(OutputInterface $output)
|
||||||
|
{
|
||||||
|
if (file_exists(PHPCI_DIR . 'PHPCI/config.yml')) {
|
||||||
|
$content = file_get_contents(PHPCI_DIR . 'PHPCI/config.yml');
|
||||||
|
|
||||||
|
if (!empty($content)) {
|
||||||
|
$output->writeln('<error>PHPCI/config.yml exists and is not empty.</error>');
|
||||||
|
$output->writeln('<error>If you were trying to update PHPCI, please use phpci:update instead.</error>');
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,30 @@ class UpdateCommand extends Command
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$this->verifyInstalled($output);
|
||||||
|
|
||||||
|
$output->writeln('Updating PHPCI database.');
|
||||||
|
|
||||||
// Update the database:
|
// Update the database:
|
||||||
$gen = new \b8\Database\Generator(\b8\Database::getConnection(), 'PHPCI', './PHPCI/Model/Base/');
|
$gen = new \b8\Database\Generator(\b8\Database::getConnection(), 'PHPCI', './PHPCI/Model/Base/');
|
||||||
$gen->generate();
|
$gen->generate();
|
||||||
|
|
||||||
|
$output->writeln('<info>Done!</info>');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function verifyInstalled(OutputInterface $output)
|
||||||
|
{
|
||||||
|
if (!file_exists(PHPCI_DIR . 'PHPCI/config.yml')) {
|
||||||
|
$output->writeln('<error>PHPCI does not appear to be installed.</error>');
|
||||||
|
$output->writeln('<error>Please install PHPCI via phpci:install instead.</error>');
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = file_get_contents(PHPCI_DIR . 'PHPCI/config.yml');
|
||||||
|
if (empty($content)) {
|
||||||
|
$output->writeln('<error>PHPCI does not appear to be installed.</error>');
|
||||||
|
$output->writeln('<error>Please install PHPCI via phpci:install instead.</error>');
|
||||||
|
die;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue