Skip to content

Commit 82aad72

Browse files
committed
Merge branch '4.1' into 'main'
2 parents d0374a2 + c397556 commit 82aad72

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

phpmyfaq/src/phpMyFAQ/Controller/Administration/Api/UpdateController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,18 @@ public function updateDatabase(): JsonResponse
249249
{
250250
$this->userHasPermission(PermissionType::CONFIGURATION_EDIT);
251251

252-
$this->update->version = System::getVersion();
252+
$this->update->version = $this->configuration->get('main.currentVersion');
253253

254254
try {
255255
if ($this->update->applyUpdates()) {
256256
$this->configuration->set('main.maintenanceMode', 'false');
257257
return new JsonResponse(['success' => 'Database successfully updated.'], Response::HTTP_OK);
258258
}
259259

260+
$this->configuration->set('main.maintenanceMode', 'false');
260261
return new JsonResponse(['error' => 'Update database failed.'], Response::HTTP_BAD_GATEWAY);
261-
} catch (Exception $exception) {
262+
} catch (Exception|\Exception $exception) {
263+
$this->configuration->set('main.maintenanceMode', 'false');
262264
return new JsonResponse([
263265
'error' => 'Update database failed: ' . $exception->getMessage(),
264266
], Response::HTTP_BAD_GATEWAY);

phpmyfaq/src/phpMyFAQ/Setup/UpdateRunner.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,14 @@ private function taskUpdateDatabase(SymfonyStyle $symfonyStyle): int
449449
return Command::SUCCESS;
450450
}
451451

452+
$this->configuration->set(key: 'main.maintenanceMode', value: 'false');
452453
$this->displayMigrationResults($symfonyStyle, $update->migrationResults);
453454
$symfonyStyle->error(message: 'Update database failed.');
454455
return Command::FAILURE;
455-
} catch (Exception $exception) {
456+
} catch (Exception|\Exception $exception) {
456457
$progressBar->finish();
457458
$symfonyStyle->newLine(count: 2);
459+
$this->configuration->set(key: 'main.maintenanceMode', value: 'false');
458460
$symfonyStyle->error(message: 'Update database failed: ' . $exception->getMessage());
459461
return Command::FAILURE;
460462
}

0 commit comments

Comments
 (0)