- ๐ซ๐ทFrance O'Briat Nantes
Hi
I just crossed the perfect example on why this issue should be taken much seriously: a admin user saw the "outdated message", so thinking doing the right thing he follows the link and follow the update process putting the site in maintenance mode... The update failed but he didn't notice was still in maintenance mode because he was already logged in.
He do it twice over several months...
It take a while to debug it since there is no drupal log, and webserver log didn't show any visit to maintenance page.Ok, the fault is mainly on the dev team side (update module enable on production site and bad permissions) but still I think this issue shoul get a higher priority (or the first patch should be accepted)
- ๐บ๐ธUnited States DamienMcKenna NH, USA
FWIW the last patch still applies cleanly against 9.5.x.
- ๐ซ๐ทFrance O'Briat Nantes
Thanks, I just add it to my `composer.json`.
So the patch number 17 could be marked as RTBTC
- Status changed to Needs review
almost 2 years ago 5:57pm 11 April 2023 - ๐บ๐ธUnited States markdorison
The patch still applies cleanly. I don't see any outstanding requests for changes. Switching this to 'needs review.'
- Status changed to Needs work
almost 2 years ago 10:26pm 11 April 2023 - ๐บ๐ธUnited States smustgrave
The issue summary is pretty bare.
Also could use some kind of test coverage. Even simply coverage.
- ๐ซ๐ฎFinland heikkiy Oulu
I am running core version 9.5.11 I tested the patch from #21. I was not able to get anything in logs when setting the maintenance mode through the UI. I tried clearing caches with Drush a few times but it didn't have any effect.
Patch from #17 also applies cleanly and now I got log messages when it was set. But I think the solution in #21 would be better if it worked because we also set maintenance mode with Drush and would be good to catch those also.
- Status changed to Needs review
over 1 year ago 6:13am 4 October 2023 - last update
over 1 year ago Patch Failed to Apply - ๐ฎ๐ณIndia sumit_saini
As maintenance mode is stored in state, it is good to log message in Drupal\Core\State::set() method. So, moving the fix given in #21 to State.php. This way, there will be a log for both cases - drush and form save. Verified the attached patch with Drupal 10.1.4
- Status changed to Needs work
over 1 year ago 6:52am 4 October 2023 - ๐ธ๐ฐSlovakia poker10
@sumit_saini Thanks for the patch - tests are still needed, so moving back to Needs Work.
- ๐ฎ๐ณIndia AditiVB
Aditi Saraf โ made their first commit to this issueโs fork.
- Status changed to Needs review
over 1 year ago 11:46am 13 October 2023 - last update
over 1 year ago 30,397 pass - Status changed to Needs work
over 1 year ago 1:41pm 13 October 2023 - ๐ธ๐ฐSlovakia poker10
The last patch is still missing the test(s).
And it would be great to update to update the issue summary (see #42). We should also include the summary of possible solutions (
State::set()
vsCacheCollector:set()
vsSiteMaintenanceModeForm
..), as there are multiple patches with different approaches, so better to have this summarized. Thanks! - Status changed to Needs review
about 1 year ago 9:05am 16 December 2023 - Status changed to Needs work
about 1 year ago 2:28pm 18 December 2023 - ๐บ๐ธUnited States smustgrave
For the issue summary update and tests.
- last update
about 1 year ago 25,923 pass, 1,813 fail - ๐ซ๐ฎFinland heikkiy Oulu
We encountered an error when using this patch in core with Redirect 404 submodule of Redirect.
After upgrading to Drupal 10.2, I get the following error when trying to disable the maintenance mode in en/admin/config/development/maintenance:
The website encountered an unexpected error. Try again later. TypeError: Drupal\system\Form\SiteMaintenanceModeForm::__construct(): Argument #1 ($logger_factory) must be of type Drupal\Core\Logger\LoggerChannelFactory, Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /var/www/html/web/core/modules/system/src/Form/SiteMaintenanceModeForm.php on line 74 in Drupal\system\Form\SiteMaintenanceModeForm->__construct() (line 58 of core/modules/system/src/Form/SiteMaintenanceModeForm.php). Drupal\system\Form\SiteMaintenanceModeForm::create(Object) (Line: 28) Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('\Drupal\system\Form\SiteMaintenanceModeForm') (Line: 48) Drupal\Core\Controller\HtmlFormController->getFormObject(Object, '\Drupal\system\Form\SiteMaintenanceModeForm') (Line: 58) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
- First commit to issue fork.
- Merge request !10761Issue #229778: Add note to log when site put into and taken out of Offline mode โ (Open) created by vidorado
- ๐ช๐ธSpain vidorado Pamplona (Navarra)
Iโm not convinced by the solution proposed in #21. While itโs nice that the message is logged when the site is put into maintenance mode using Drush, I donโt believe the
State
class should be responsible for that. Perhaps we could handle it inDrupal\Core\EventSubscriber\MaintenanceModeSubscriber
by introducing a second state variable to store the last logged action, which would help prevent log flooding.In the meantime, Iโve refined the
SiteMaintenanceModeForm
solution slightly and added a kernel test.Do you think we should invest effort into covering the Drush case?
- ๐ช๐ธSpain vidorado Pamplona (Navarra)
Thanks for the review @smustgrave :)
All threads resolved!