Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new9.06 KB

There we go.

Status: Needs review » Needs work

The last submitted patch, 1: maintainance_site_is_offline-2214209-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new8.73 KB
new832 bytes

Damn.

Status: Needs review » Needs work

The last submitted patch, 3: maintainance_site_is_offline-2214209-3.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new8.74 KB
new906 bytes

This should be it.

Status: Needs review » Needs work

The last submitted patch, 5: maintainance_site_is_offline-2214209-5.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new8.41 KB
new2.58 KB

This is it.

dawehner’s picture

Status: Needs review » Needs work

The last submitted patch, 7: maintainance_site_is_offline-2214209-7.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new8.31 KB

Rerolled.

dawehner’s picture

Priority: Normal » Major

This is one more step to get rid of menu.inc

Status: Needs review » Needs work

The last submitted patch, 10: maintainance_site_is_offline-2214209-10.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new8.52 KB

Maybe now

Status: Needs review » Needs work

The last submitted patch, 13: 2214209-13.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new8.41 KB
new1.25 KB

There we go.

dawehner’s picture

StatusFileSize
new8.66 KB

Rerolled

ParisLiakos’s picture

  1. +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -30,7 +93,7 @@ class MaintenanceModeSubscriber implements EventSubscriberInterface {
    -    $is_offline = _menu_site_is_offline() ? MENU_SITE_OFFLINE : MENU_SITE_ONLINE;
    +    $is_offline = $this->isSiteOffline($request) ? MENU_SITE_OFFLINE : MENU_SITE_ONLINE;
    

    what about also moving those constants here?

  2. +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -47,14 +110,62 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +            $this->drupalSetMessage($this->translation->translate('Operating in maintenance mode.'), 'status', FALSE);
    

    $this->t()

dawehner’s picture

StatusFileSize
new12.05 KB
new5.55 KB

Thank you for the review

There we go.

Status: Needs review » Needs work

The last submitted patch, 18: 2214209-18.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new12.81 KB
new1.12 KB

MIssed some spots.

ParisLiakos’s picture

Looks good!

+++ b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/EventSubscriber/MaintenanceModeSubscriber.php
@@ -25,8 +25,8 @@ class MaintenanceModeSubscriber implements EventSubscriberInterface {
+    if ($request->attributes->get('_maintenance') == \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_OFFLINE && $request->attributes->get('_system_path') == 'menu_login_callback') {
+      $request->attributes->set('_maintenance', \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_ONLINE);

+++ b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
@@ -28,7 +28,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
+    if ($site_status == \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_OFFLINE) {

@@ -46,12 +46,12 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
+            $request->attributes->set('_maintenance', \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_ONLINE);
...
+              $request->attributes->set('_maintenance', \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_ONLINE);

lets add use statements and make those less ugly, so i can rtbc this:P

dawehner’s picture

The reason why I skipped it was that we always have the same classname in there, so it would be a use as statement, which seemed a bit bad :(

tim.plunkett’s picture

  1. +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -44,17 +127,65 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +    if ($this->state->get('system.maintenance_mode')) {
    +      if ($this->account->hasPermission('access site in maintenance mode')) {
    +        // Ensure that the maintenance mode message is displayed only once
    +        // (allowing for page redirects) and specifically suppress its display on
    +        // the maintenance mode settings page.
    +        if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) != 'system.site_maintenance_mode') {
    

    That's three ifs that could be combined if desired. Only the fourth has an else...

  2. +++ b/core/modules/system/tests/modules/menu_test/lib/Drupal/menu_test/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -25,8 +25,8 @@ class MaintenanceModeSubscriber implements EventSubscriberInterface {
    +    if ($request->attributes->get('_maintenance') == \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_OFFLINE && $request->attributes->get('_system_path') == 'menu_login_callback') {
    +      $request->attributes->set('_maintenance', \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_ONLINE);
    
    +++ b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -28,7 +28,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +    if ($site_status == \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_OFFLINE) {
    
    @@ -46,12 +46,12 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +            $request->attributes->set('_maintenance', \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_ONLINE);
    ...
    +              $request->attributes->set('_maintenance', \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::SITE_ONLINE);
    

    I also think we should have a use statement, but it really is just preference.

dawehner’s picture

StatusFileSize
new13.28 KB
new5.92 KB

That's three ifs that could be combined if desired. Only the fourth has an else...

Good idea!

dawehner’s picture

24: 2214209-24.patch queued for re-testing.

ParisLiakos’s picture

Status: Needs review » Needs work
  1. +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -44,17 +127,62 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +    if ($this->state->get('system.maintenance_mode') && $this->account->hasPermission('access site in maintenance mode')
    +      // Ensure that the maintenance mode message is displayed only once
    +      // (allowing for page redirects) and specifically suppress its display on
    +      // the maintenance mode settings page.
    +      && $request->attributes->get(RouteObjectInterface::ROUTE_NAME) != 'system.site_maintenance_mode') {
    

    Can we make this if more readable by assigning this check to each variable?
    so this ends up to be like:

    if ($is_maintanance && $can_access_maintance && !$is_maintenance_route) {
    
    }
  2. +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -44,17 +127,62 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +  protected function t($string, array $args = array(), array $options = array()) {
    

    this needs the StringTranslationTrait now

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new13.13 KB
new3.26 KB

Fixed all those points.

ParisLiakos’s picture

+++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
@@ -44,17 +130,55 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
+    if ($is_maintanance && $can_access_maintance && $is_maintenance_route) {

$is_maintenance_route should have NOT in front of it:)

dawehner’s picture

StatusFileSize
new13.13 KB

Just hacked the patch file. ups...

The last submitted patch, 27: 2214209-27.patch, failed testing.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

catch’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -44,17 +130,55 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +    $can_access_maintance = $this->account->hasPermission('access site in maintenance mode');
    +    $is_maintanance = $this->state->get('system.maintenance_mode');
    +    // Ensure that the maintenance mode message is displayed only once
    +    // (allowing for page redirects) and specifically suppress its display on
    +    // the maintenance mode settings page.
    +    $is_maintenance_route = $request->attributes->get(RouteObjectInterface::ROUTE_NAME) == 'system.site_maintenance_mode';
    +    if ($is_maintanance && $can_access_maintance && !$is_maintenance_route) {
    +      if ($this->account->hasPermission('administer site configuration')) {
    +        $this->drupalSetMessage($this->t('Operating in maintenance mode. <a href="@url">Go online.</a>', array('@url' => $this->urlGenerator->generate('system.site_maintenance_mode'))), 'status', FALSE);
    

    s/can_access_maintance/can_access_maintenance/

  2. +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
    @@ -44,17 +130,55 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
    +  protected function isSiteOffline() {
    

    Should we make this isSiteInMaintenance or something? Not sure we really use 'offline' anywhere much now.

ParisLiakos’s picture

Status: Needs work » Needs review
StatusFileSize
new13.14 KB
new1.53 KB

I am sorry, "maintenance" is a hard word:P

Should we make this isSiteInMaintenance or something? Not sure we really use 'offline' anywhere much now.

Dunno, the constants are named offline and online.
Its a protected method anyway so we can change its name anytime we want..
Also #2239005: Remove the '_maintenance' request attribute discuss about turning this thing to a standalone service, so we could figure out the naming there

Status: Needs review » Needs work

The last submitted patch, 33: 2214209-33.patch, failed testing.

ParisLiakos’s picture

33: 2214209-33.patch queued for re-testing.

The last submitted patch, 33: 2214209-33.patch, failed testing.

ParisLiakos’s picture

33: 2214209-33.patch queued for re-testing.

ParisLiakos’s picture

Status: Needs work » Needs review
dawehner’s picture

Should we make this isSiteInMaintenance or something? Not sure we really use 'offline' anywhere much now.

The suggested method name makes is clearer to understand, indeed.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

The suggested method name makes is clearer to understand, indeed.

But yeah the method is not touched by this patch, back to RTBC

catch’s picture

Status: Reviewed & tested by the community » Needs work

But yeah the method is not touched by this patch

The method is introduced by the patch.

dawehner’s picture

damnit, never trust me!

ParisLiakos’s picture

Status: Needs work » Needs review
StatusFileSize
new1.6 KB
new13.01 KB

fine. lets rename it...lets also get rid of the translation property declaration since its registered in the trait

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you

xjm’s picture

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

  • Commit 34c6f66 on 8.x by catch:
    Issue #2214209 by dawehner, ParisLiakos, xjm: Move _menu_site_is_offine...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.