From f50c7bbd8e21e2aff41636795a5af049b17da87b Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Fri, 1 Sep 2023 12:33:52 -0400 Subject: [PATCH] Avoid redirect to install.php when DB is down --- composer.json | 1 + composer.lock | 49 ++++++++++++++++++++++++++- conf/drupal/config/core.extension.yml | 1 + docroot/index.php | 3 +- 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 305cc376b3..252742bbe6 100644 --- a/composer.json +++ b/composer.json @@ -233,6 +233,7 @@ "drupal/pathologic": "^1", "drupal/prepopulate": "^2.0", "drupal/private_files_download_permission": "^3", + "drupal/prod_no_redirect": "dev-1.0.x", "drupal/purge": "^3", "drupal/purge_queues": "^2", "drupal/queue_unique": "^3", diff --git a/composer.lock b/composer.lock index 3e9e550002..144a73de24 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "df4d2f9c2d929837136d29e0c587f02c", + "content-hash": "d1f4a26ea4b89e1f3aab3ec12aa1ccc5", "packages": [ { "name": "akamai-open/edgegrid-auth", @@ -8507,6 +8507,52 @@ "source": "https://git.drupalcode.org/project/private_files_download_permission" } }, + { + "name": "drupal/prod_no_redirect", + "version": "dev-1.0.x", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/prod_no_redirect.git", + "reference": "a50d574b2214cdc89e1b96ad38f4c26f5fbb65f1" + }, + "require": { + "drupal/core": "^9 || ^10" + }, + "type": "drupal-module", + "extra": { + "branch-alias": { + "dev-1.0.x": "1.0.x-dev" + }, + "drupal": { + "version": "1.0.x-dev", + "datestamp": "1693583408", + "security-coverage": { + "status": "not-covered", + "message": "Project has not opted into security advisory coverage!" + } + } + }, + "autoload": { + "classmap": [ + "lib" + ] + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "moshe weitzman", + "homepage": "https://www.drupal.org/user/23" + } + ], + "description": "Production must never redirect to install.php", + "homepage": "https://www.drupal.org/project/prod_no_redirect", + "support": { + "source": "https://git.drupalcode.org/project/prod_no_redirect" + } + }, { "name": "drupal/purge", "version": "3.4.0", @@ -23761,6 +23807,7 @@ "drupal/focal_point": 20, "drupal/openid_connect": 20, "drupal/openid_connect_windows_aad": 20, + "drupal/prod_no_redirect": 20, "drupal/require_on_publish": 20, "drupal/views_taxonomy_term_name_into_id": 15, "furf/jquery-ui-touch-punch": 20, diff --git a/conf/drupal/config/core.extension.yml b/conf/drupal/config/core.extension.yml index eff769fa1d..477597ace3 100644 --- a/conf/drupal/config/core.extension.yml +++ b/conf/drupal/config/core.extension.yml @@ -182,6 +182,7 @@ module: pathologic: 0 pfdp: 0 prepopulate: 0 + prod_no_redirect: 0 purge: 0 purge_drush: 0 purge_processor_cron: 0 diff --git a/docroot/index.php b/docroot/index.php index 750dc282dc..8dd1ccd99d 100644 --- a/docroot/index.php +++ b/docroot/index.php @@ -9,11 +9,12 @@ */ use Drupal\Core\DrupalKernel; +use Drupal\prod_no_redirect\ProdNoRedirectDrupalKernel; use Symfony\Component\HttpFoundation\Request; $autoloader = require_once 'autoload.php'; -$kernel = new DrupalKernel('prod', $autoloader); +$kernel = new ProdNoRedirectDrupalKernel('prod', $autoloader); $request = Request::createFromGlobals(); $response = $kernel->handle($request);