From 0be119fd872f5a8282d5882fe34885710ae785ff Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 25 Nov 2016 12:24:14 +0100 Subject: [PATCH] Don't run updater if the instance is not installed Signed-off-by: Morris Jobke --- lib/Updater.php | 2 ++ tests/features/bootstrap/FeatureContext.php | 9 +++++++-- tests/features/cli.feature | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Updater.php b/lib/Updater.php index 18e60546..17d5f235 100644 --- a/lib/Updater.php +++ b/lib/Updater.php @@ -191,6 +191,8 @@ private function getExpectedElementsList() { 'robots.txt', '.htaccess', 'AUTHORS', + 'CHANGELOG.md', + 'COPYING', 'COPYING-AGPL', 'occ', 'db_structure.xml', diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index 6e25f03e..e6570437 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -53,9 +53,9 @@ public function stopUpdateServer() } /** - * @Given /the current installed version is ([0-9.]+)/ + * @Given /the current (installed )?version is ([0-9.]+)/ */ - public function theCurrentInstalledVersionIs($version) + public function theCurrentInstalledVersionIs($installed, $version) { // recursive deletion of server folder if(file_exists($this->serverDir)) { @@ -100,6 +100,11 @@ public function theCurrentInstalledVersionIs($version) throw new \Exception('Cant handle ZIP file. Error code is: '.$zipState); } + if($installed === '') { + // the instance should not be installed + return; + } + chdir($this->serverDir . 'nextcloud'); shell_exec('chmod +x occ'); exec('./occ maintenance:install --admin-user=admin --admin-pass=admin 2>&1', $output, $returnCode); diff --git a/tests/features/cli.feature b/tests/features/cli.feature index 9b41d08c..33881e20 100644 --- a/tests/features/cli.feature +++ b/tests/features/cli.feature @@ -1,5 +1,9 @@ Feature: CLI updater + Scenario: No update is available - 10.0.0 + Given the current version is 10.0.0 + When the CLI updater is run successfully + Scenario: No update is available - 10.0.0 Given the current installed version is 10.0.0 And there is no update available