Repository: pimcore/pimcore (language: php)

Issue:
[Bug]: Install error on 11.1.0-RC1
### Pimcore version

11.1.0-RC1

### Steps to reproduce

Run the installer, you're getting this error when the installer calls some Symfony commands: 

```
> Pimcore\Composer::postUpdate
> Pimcore\Composer::clearCache
08:39:21 EMERGENCY [pimcore] PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pimcore.tmp_store' doesn't exist in /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130
Stack trace:
#0 /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Statement.php(130): PDOStatement->execute(NULL)
#1 /var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php(69): Doctrine\DBAL\Driver\PDO\Statement->execute(NULL)
#2 /var/www/html/vendor/doctrine/dbal/src/Logging/Statement.php(98): Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware->execute(NULL)
#3 /var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php(69): Doctrine\DBAL\Logging\Statement->execute(NULL)
#4 /var/www/html/vendor/symfony/doctrine-bridge/Middleware/Debug/Statement.php(68): Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware->execute(NULL)
#5 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1098): Symfony\Bridge\Doctrine\Middleware\Debug\Statement->execute()
#6 /var/www/html/vendor/doctrine/dbal/src/Connection.php(587): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM t...', Array, Array)
#7 /var/www/html/dev/pimcore/pimcore/models/Tool/TmpStore/Dao.php(59): Doctrine\DBAL\Connection->fetchAssociative('SELECT * FROM t...', Array)
#8 [internal function]: Pimcore\Model\Tool\TmpStore\Dao->getById('maintenace_mode')
#9 /var/www/html/dev/pimcore/pimcore/lib/Model/AbstractModel.php(220): call_user_func_array(Array, Array)
#10 /var/www/html/dev/pimcore/pimcore/models/Tool/TmpStore.php(117): Pimcore\Model\AbstractModel->__call('getById', Array)
#11 /var/www/html/dev/pimcore/pimcore/lib/Tool/MaintenanceModeHelper.php(73): Pimcore\Model\Tool\TmpStore::get('maintenace_mode')
#12 /var/www/html/dev/pimcore/pimcore/lib/Tool/MaintenanceModeHelper.php(56): Pimcore\Tool\MaintenanceModeHelper->getEntry()
#13 /var/www/html/dev/pimcore/pimcore/lib/Console/Application.php(71): Pimcore\Tool\MaintenanceModeHelper->isActive()
#14 /var/www/html/vendor/symfony/event-dispatcher/Debug/WrappedListener.php(116): Pimcore\Console\Application->Pimcore\Console\{closure}(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#15 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(220): Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#16 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'console.command', Object(Symfony\Component\Console\Event\ConsoleCommandEvent))  
#17 /var/www/html/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php(139): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command')
#18 /var/www/html/vendor/symfony/console/Application.php(1078): Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command')
#19 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(91): Symfony\Component\Console\Application->doRunCommand(Object(Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
#23 /var/www/html/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(54): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
#25 /var/www/html/bin/console(20): require_once('/var/www/html/v...')
#26 {main}

```

Regression of https://github.com/pimcore/pimcore/pull/15954

We need to consider a missing DB connection here. 

### Actual Behavior

-

### Expected Behavior

-
[Bug]: Install error on 11.1.0-RC1
### Pimcore version

11.1.0-RC1

### Steps to reproduce

Run the installer, you're getting this error when the installer calls some Symfony commands: 

```
> Pimcore\Composer::postUpdate
> Pimcore\Composer::clearCache
08:39:21 EMERGENCY [pimcore] PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pimcore.tmp_store' doesn't exist in /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130
Stack trace:
#0 /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Statement.php(130): PDOStatement->execute(NULL)
#1 /var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php(69): Doctrine\DBAL\Driver\PDO\Statement->execute(NULL)
#2 /var/www/html/vendor/doctrine/dbal/src/Logging/Statement.php(98): Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware->execute(NULL)
#3 /var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php(69): Doctrine\DBAL\Logging\Statement->execute(NULL)
#4 /var/www/html/vendor/symfony/doctrine-bridge/Middleware/Debug/Statement.php(68): Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware->execute(NULL)
#5 /var/www/html/vendor/doctrine/dbal/src/Connection.php(1098): Symfony\Bridge\Doctrine\Middleware\Debug\Statement->execute()
#6 /var/www/html/vendor/doctrine/dbal/src/Connection.php(587): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM t...', Array, Array)
#7 /var/www/html/dev/pimcore/pimcore/models/Tool/TmpStore/Dao.php(59): Doctrine\DBAL\Connection->fetchAssociative('SELECT * FROM t...', Array)
#8 [internal function]: Pimcore\Model\Tool\TmpStore\Dao->getById('maintenace_mode')
#9 /var/www/html/dev/pimcore/pimcore/lib/Model/AbstractModel.php(220): call_user_func_array(Array, Array)
#10 /var/www/html/dev/pimcore/pimcore/models/Tool/TmpStore.php(117): Pimcore\Model\AbstractModel->__call('getById', Array)
#11 /var/www/html/dev/pimcore/pimcore/lib/Tool/MaintenanceModeHelper.php(73): Pimcore\Model\Tool\TmpStore::get('maintenace_mode')
#12 /var/www/html/dev/pimcore/pimcore/lib/Tool/MaintenanceModeHelper.php(56): Pimcore\Tool\MaintenanceModeHelper->getEntry()
#13 /var/www/html/dev/pimcore/pimcore/lib/Console/Application.php(71): Pimcore\Tool\MaintenanceModeHelper->isActive()
#14 /var/www/html/vendor/symfony/event-dispatcher/Debug/WrappedListener.php(116): Pimcore\Console\Application->Pimcore\Console\{closure}(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#15 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(220): Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#16 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'console.command', Object(Symfony\Component\Console\Event\ConsoleCommandEvent))  
#17 /var/www/html/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php(139): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command')
#18 /var/www/html/vendor/symfony/console/Application.php(1078): Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(Object(Symfony\Component\Console\Event\ConsoleCommandEvent), 'console.command')
#19 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(91): Symfony\Component\Console\Application->doRunCommand(Object(Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
#23 /var/www/html/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(54): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
#25 /var/www/html/bin/console(20): require_once('/var/www/html/v...')
#26 {main}

```

Regression of https://github.com/pimcore/pimcore/pull/15954

We need to consider a missing DB connection here. 

### Actual Behavior

-

### Expected Behavior

-


Discussion / hints:

Fix patch:
diff --git a/lib/Tool/MaintenanceModeHelper.php b/lib/Tool/MaintenanceModeHelper.php
index ead47e8d4a4..2fb35d60b94 100644
--- a/lib/Tool/MaintenanceModeHelper.php
+++ b/lib/Tool/MaintenanceModeHelper.php
@@ -16,6 +16,7 @@
 
 namespace Pimcore\Tool;
 
+use Doctrine\DBAL\Connection;
 use Pimcore\Event\SystemEvents;
 use Pimcore\Model\Tool\TmpStore;
 use Symfony\Component\EventDispatcher\GenericEvent;
@@ -25,7 +26,7 @@ class MaintenanceModeHelper implements MaintenanceModeHelperInterface
 {
     protected const ENTRY_ID = 'maintenace_mode';
 
-    public function __construct(protected RequestStack $requestStack)
+    public function __construct(protected RequestStack $requestStack, protected Connection $db)
     {
     }
 
@@ -53,7 +54,7 @@ public function deactivate(): void
 
     public function isActive(string $matchSessionId = null): bool
     {
-        if ($maintenanceModeEntry = $this->getEntry()) {
+        if ($this->db->isConnected() && $maintenanceModeEntry = $this->getEntry()) {
             if ($matchSessionId && $matchSessionId !== $maintenanceModeEntry) {
                 return true;
             }


Test patch:
diff --git a/.github/ci/files/config/packages/test/config.yaml b/.github/ci/files/config/packages/test/config.yaml
index 26996348173..d6e54ee400f 100644
--- a/.github/ci/files/config/packages/test/config.yaml
+++ b/.github/ci/files/config/packages/test/config.yaml
@@ -16,6 +16,7 @@ doctrine:
     dbal:
         connections:
             default:
+                server_version: '10.11'
                 url: '%pimcore_test.db.dsn%'
                 host: ~
                 port: ~