Merge pull request #402 from creative-commoners/pulls/2.2/subsites-is-off-the-table-or-maybe-its-on-it-now-idk

FIX Catching situation where database has no tables but it exists
This commit is contained in:
Dylan Wagstaff 2018-11-08 12:26:59 +13:00 committed by GitHub
commit ce9dd1a856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,8 +44,10 @@ class InitStateMiddleware implements HTTPMiddleware
return $delegate($request); return $delegate($request);
} catch (DatabaseException $ex) { } catch (DatabaseException $ex) {
$message = $ex->getMessage(); $message = $ex->getMessage();
if (strpos($message, 'No database selected') !== false) { if (strpos($message, 'No database selected') !== false
// Database is not ready, ignore and continue || preg_match('/\s*(table|relation) .* does(n\'t| not) exist/i', $message)
) {
// Database is not ready, ignore and continue. Either it doesn't exist or it has no tables
return $delegate($request); return $delegate($request);
} }
throw $ex; throw $ex;