File tree Expand file tree Collapse file tree
Controller/Administration/Api Expand file tree Collapse file tree Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments