The aim of this module is to provide functionality to prevent users to login to a page and displays them a message with countdown that the site is scheduled for the maintenance and will be turned off. This gives the site users ability to safely finish and save their work.

This module will disable following forms:

Disable user login
Disable user registration form
Disable user change password form
The module provides a way for site administrators and everyone with permission to force the login. Simply add “?forceLogin” to /user/login url and if you are site admin or have permission you will be allowed to log in.

Links

Link to project: http://drupal.org/sandbox/barancekk/1937700
Git repository: git.drupal.org:sandbox/barancekk/1937700.git

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxbarancekk1937700git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and 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.

he0x410’s picture

Hello Karol,

In common:
After I have enabled module it has started maintenance immediately and I was surprised. - In my opinion you should definitely add an option to enable/disable it and do not enable countdown right after module was enabled.
I suggests additional features:

  1. Enable/disable countdown
  2. Ability to change activation time
  3. Ability to change display message
  4. Nothing happens after activation time is reached. Add an option to put site in maintenance mode.

Also, you are just unsetting form elements from login/registration forms, which is not correct, because of three reasons:

  1. You should set ['#access'] = FALSE instead of just unsetting element
  2. On registration page can be not only base login and email fields, most sites have additional user fields like 'First Name', 'Last Name', etc.
  3. Many sites using services like Janrain

Manual review:

site_maintenance.install
  • 12 |
      $current_time = time();
      $activate_time = $current_time + (30 * 60);
    

    Avoid extra variables:

      $activate_time = time() + (30 * 60);
    
site_maintenance.module
  • 49 |
      $if (!in_array('administrator', $account->roles) && !user_access('site_maintenance_force_login')) { 

    "administrator" role name can be changed on "admin/people/permissions/roles/edit/3", you need to use a role id.

  • 52 | drupal_goto('/'); - I assume it is home page, so use drupal_goto(); or drupal_goto('');
  • 122 | Avoid extra variables, just return an array:
      $perms = array(
        'site_maintenance_force_login' => array(
          'title' => t('Can login when Site Maintenance module is enabled.'),
        ),
      );
      return $perms;
    
      return array(
        'site_maintenance_force_login' => array(
          'title' => t('Can login when Site Maintenance module is enabled.'),
        ),
      );
    
  • 124 | permission name looks to long, I suggest to make it shorter and define description
  • 113 | extra varbiable
countdown.js
  • Use a wrapper (function ($) { })(jQuery);
  • 11 | Drupal.settings.site_maintenance.html_id - check if variables exist
  • 22 | Use Drupal.t for translation compatibility
barancekk’s picture

Dear Artem,

Thank you very much for the hints and review. I updated the code style using your hints.

Also, thank you very much for the proposed features. We plan to add these and other features in next weeks. Our plan was to start with module that will provide basic functionality and people can start using it. In next steps we plan to add a settings form to provide way to set the texts, time and possibility to postpone the start of the countdown.

SamChez’s picture

Looks to be a very solid module and I look forward to seeing the features you've mentioned above implemented. There are a couple suggestions that I have purely as a user:

  • Refresh the countdown every minute or so instead of having the user refresh the page in order to see how much time they have left.
  • When the site is preparing to undergo maintenance there should be a message that tells all users that are not logged in they will not be able to login to the site.
  • Implement a "Site Is Undergoing Maintenance" redirect page when the timer has reached 0 so that if you break anything while editing the site the user cannot see it.

All in all a very useful module that I'll probably use/recommend in the future.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

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

PA robot’s picture

Issue summary: View changes

Updating git repository path - removing the username from path. Also removing git clone line, that has username it in.