Skip to content

Commit

Permalink
Don't run updater if the instance is not installed
Browse files Browse the repository at this point in the history
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
  • Loading branch information
MorrisJobke committed Nov 25, 2016
1 parent fa5579b commit 0be119f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ private function getExpectedElementsList() {
'robots.txt',
'.htaccess',
'AUTHORS',
'CHANGELOG.md',
'COPYING',
'COPYING-AGPL',
'occ',
'db_structure.xml',
Expand Down
9 changes: 7 additions & 2 deletions tests/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions tests/features/cli.feature
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0be119f

Please sign in to comment.