Skip to content

Commit 3168b50

Browse files
Merge pull request #667 from nextcloud/fix/self-test/no-mounts
2 parents 4bf1eba + e2f3e19 commit 3168b50

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

lib/SelfTest.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,22 @@ public function test(string $server, OutputInterface $output, bool $ignoreProxyE
7575

7676
// test if the push server can load storage mappings from the db
7777
[$storageId, $count] = $this->getStorageIdForTest();
78-
try {
79-
$retrievedCount = (int)$this->client->get($server . '/test/mapping/' . $storageId, ['nextcloud' => ['allow_local_address' => true], 'verify' => false])->getBody();
80-
} catch (\Exception $e) {
81-
$msg = $e->getMessage();
82-
$output->writeln("<error>🗴 can't connect to push server: $msg</error>");
83-
return self::ERROR_OTHER;
84-
}
78+
// If no admin user was created during the installation, there are no oc_filecache and oc_mounts entries yet, so this check has to be skipped.
79+
if ($storageId !== null) {
80+
try {
81+
$retrievedCount = (int)$this->client->get($server . '/test/mapping/' . $storageId, ['nextcloud' => ['allow_local_address' => true], 'verify' => false])->getBody();
82+
} catch (\Exception $e) {
83+
$msg = $e->getMessage();
84+
$output->writeln("<error>🗴 can't connect to push server: $msg</error>");
85+
return self::ERROR_OTHER;
86+
}
8587

86-
if ((int)$count === $retrievedCount) {
87-
$output->writeln('<info>✓ push server can load mount info from database</info>');
88-
} else {
89-
$output->writeln("<error>🗴 push server can't load mount info from database</error>");
90-
return self::ERROR_OTHER;
88+
if ((int)$count === $retrievedCount) {
89+
$output->writeln('<info>✓ push server can load mount info from database</info>');
90+
} else {
91+
$output->writeln("<error>🗴 push server can't load mount info from database</error>");
92+
return self::ERROR_OTHER;
93+
}
9194
}
9295

9396
// test if the push server can reach nextcloud by having it request the cookie

0 commit comments

Comments
 (0)