This module sends out a notification when the site is set to maintenance mode or set back to live from maintenance.

Features of this module

  1. Sends out a mail to the selected user emails when put in maintenance mode.
  2. Sends out a mail to the selected user emails when removed from maintenance mode.
  3. Can select a different email templates for both the above scenarios

Maintenance Notifications

Project page: https://www.drupal.org/sandbox/sandeepreddyg/2745699
Git url: git clone --branch 8.x-1.x https://git.drupal.org/sandbox/sandeepreddyg/2745699.git maintenance_notifications
PAreview: http://pareview.sh/pareview/httpsgitdrupalorgsandboxsandeepreddyg2745699...

Reviews for Other Projects:
https://www.drupal.org/node/2603436#comment-11327869
https://www.drupal.org/node/2706919#comment-11328187
https://www.drupal.org/node/2804009#comment-11652335

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sandeepreddyg created an issue. See original summary.

sandeepguntaka’s picture

Issue summary: View changes
FileSize
24.68 KB
PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

Anonymous’s picture

Issue summary: View changes
FileSize
101.28 KB

Hi sandeepreddyg! First off, I think this is a great idea for a module. Below is a list of issues I came across when trying to use it.

Missing Folder Name in Git Url:

In the issue description where you put the Git clone command the folder name was missing from the end of the command. Because of that when I used the command the folder name was '2745699'. I've gone ahead and updated the description for you.

Add Module Descriptions:

It's best practice to make sure your module has a good description so that people know exactly what it does when installing it. You should go ahead and add a description to line 3 of your "maintenance_notifications.info.yml" file and line 3 of your "maintenance_notifications.links.menu.yml" file.

Add a Configuration Link:

Since the module has a configuration page you should add it to the "maintenance_notifications.info.yml" file using the "config". For your module I think you would add "config: maintenance_notifications.form".

Message Typos:

These are just small grammar issues that could be improved.

  • Line 43 of MaintenanceNotification.php should say, "Email(s) to send notification to"
  • Line 108 of MaintenanceNotification.php should say, "The fields highlighted below are required"

Unable to Save Settings:

When I tried to save my custom notification settings I got an error that said, "Below highlighted Fields are required". All of the fields are highlighted red even though I did fill them out. I've attached a screenshot here.

I hope this helps!

sandeepguntaka’s picture

Thanks for reviewing @keeganhr. I ve commited the suggested changes.

sandeepguntaka’s picture

Issue summary: View changes
sandeepguntaka’s picture

Issue summary: View changes
visabhishek’s picture

Status: Needs review » Needs work

Hi sandeepreddyg,

Module looks good. Some suggestions are :

1: Follow the Readme template for the readme.txt https://www.drupal.org/node/2181737
2: Please add configuration and permission links in info file.
3: Add hook_help().
4: To find configure link is difficult So You can add a local.task for maintenance "base_route:admin/config/development/maintenance"

poojasharmaece’s picture

Hi sandeepreddyg,

I tried to test your module , Its working fine only one functionality is not working which is

1: Not accepting multiple emails on configuration form, Please see the attachement

sandeepguntaka’s picture

Thanks for the reviews @visabhishek and @poojasharmaece. The things are fixed and commited.

sandeepguntaka’s picture

Status: Needs work » Needs review
anavarre’s picture

Status: Needs review » Needs work

In maintenance_notifications.info.yml you don't need:

config: maintenance_notifications.form
# version: VERSION

In maintenance_notifications.permissions.yml

You can drop description: 'Configration Maintenance Notification' completely as it doesn't bring any different help message than the permission title.

Also, I think your permission machine name is wrong either in this file or in maintenance_notifications.routing.yml which has _permission: 'administer maintenance_notifications'

In maintenance_notifications.module

In hook_help()

You have a typo line 19: maintennance -> maintenance
You can drop default: altogether (line 22)

Your parameters for hook_form_FORM_ID_alter() are wrong (D7, not D8). See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21fo...

In hook_mail(), you should not invoke Drupal\Component\Utility\SafeMarkup directly. Instead, having a use statement at the top of the file would be recommended. Also SafeMarkup is deprecated so you should consider replacing it.

In MaintenanceNotification.php

Perhaps you could replace valid_email_address($maintenance_user) by \Drupal::service('email.validator')->isValid($maintenance_user)

Also, in submitForm(), you could simplify your code. E.g.

$config = $this->config('maintenance_notifications.settings');
$config->set('send_mail', $form_state->getValue('send_mail'))->save();
$config->set('users_list', $form_state->getValue('users_list'))->save();
etc.

Could become:

$this->config('maintenance_notifications.settings');
  ->set('send_mail', $form_state->getValue('send_mail'))->save();
  ->set('users_list', $form_state->getValue('users_list'))->save();
  etc.
  ->save();
poojasharmaece’s picture

Hi sandeepreddyg,

In updated code when i am putting my site in maintenance i am not getting any mail or messages. (I checked on Screen and logger both places.

And i am getting following error : "The website encountered an unexpected error. Please try again later."

Error log message is :

Error : Recoverable fatal error: Object of class Drupal\\Core\\Language\\Language could not be converted to string in /var/www/html/drupal-8/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php on line 37, referer: http://localhost/drupal-8/admin/config/development/maintenance

Please correct me , if i am doing something wrong.

Thanks

sandeepguntaka’s picture

Status: Needs work » Needs review

@poojasharmaece Thanks for review again, The issue is now fixed. Please have a check now. @anavarre I Thanks for the suggestions. I've implemented them now, please make some time to review.

poojasharmaece’s picture

Status: Needs review » Reviewed & tested by the community

I think we don't have any blockers now. So i am marking as RTBC.

anavarre’s picture

Thanks for the quick fixes, @sandeepreddyg.

One nitpick I have is you could use Drupal\Core\Form\FormStateInterface; to invoke FormStateInterface $form_state instead of \Drupal\Core\Form\FormStateInterface $form_state in hook_form_FORM_ID_alter() - Also, it's missing a whitespace between the 1st and 2nd parameters.

sandeepguntaka’s picture

@anavarre Thanks for reviewing again. I've added them to the code.

sandeepguntaka’s picture

Issue summary: View changes
apaderno’s picture

Assigned: Unassigned » apaderno
Status: Reviewed & tested by the community » Fixed

I will update your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thank you, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks go the dedicated reviewer(s) as well.

sandeepguntaka’s picture

Thanks for the update @kiamlaluno

Status: Fixed » Closed (fixed)

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