diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php
index 4cfc818e..6e846ab6 100644
--- a/PHPCI/Command/InstallCommand.php
+++ b/PHPCI/Command/InstallCommand.php
@@ -43,6 +43,8 @@ class InstallCommand extends Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $this->verifyNotInstalled($output);
+
$output->writeln('');
$output->writeln('******************');
$output->writeln(' Welcome to PHPCI');
@@ -278,4 +280,17 @@ class InstallCommand extends Command
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('PHPCI/config.yml exists and is not empty.');
+ $output->writeln('If you were trying to update PHPCI, please use phpci:update instead.');
+ die;
+ }
+ }
+ }
}
diff --git a/PHPCI/Command/UpdateCommand.php b/PHPCI/Command/UpdateCommand.php
index 855ca893..127b272e 100644
--- a/PHPCI/Command/UpdateCommand.php
+++ b/PHPCI/Command/UpdateCommand.php
@@ -48,8 +48,30 @@ class UpdateCommand extends Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $this->verifyInstalled($output);
+
+ $output->writeln('Updating PHPCI database.');
+
// Update the database:
$gen = new \b8\Database\Generator(\b8\Database::getConnection(), 'PHPCI', './PHPCI/Model/Base/');
$gen->generate();
+
+ $output->writeln('Done!');
+ }
+
+ protected function verifyInstalled(OutputInterface $output)
+ {
+ if (!file_exists(PHPCI_DIR . 'PHPCI/config.yml')) {
+ $output->writeln('PHPCI does not appear to be installed.');
+ $output->writeln('Please install PHPCI via phpci:install instead.');
+ die;
+ }
+
+ $content = file_get_contents(PHPCI_DIR . 'PHPCI/config.yml');
+ if (empty($content)) {
+ $output->writeln('PHPCI does not appear to be installed.');
+ $output->writeln('Please install PHPCI via phpci:install instead.');
+ die;
+ }
}
}