? d7_port_795574.patch
Index: maintenance_helper.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/maintenance_helper/maintenance_helper.info,v
retrieving revision 1.1
diff -u -p -r1.1 maintenance_helper.info
--- maintenance_helper.info 1 Aug 2008 15:47:36 -0000 1.1
+++ maintenance_helper.info 11 May 2010 06:38:44 -0000
@@ -1,4 +1,4 @@
 ; $Id: maintenance_helper.info,v 1.1 2008/08/01 15:47:36 greggles Exp $^M
 name = "Maintenance Helper"^M
 description = "Maintenance Helper that assists with performing migrations or other maintenance."^M
-core = "6.x"^M
+core = "7.x"^M
Index: maintenance_helper.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/maintenance_helper/maintenance_helper.module,v
retrieving revision 1.1
diff -u -p -r1.1 maintenance_helper.module
--- maintenance_helper.module 1 Aug 2008 15:47:36 -0000 1.1
+++ maintenance_helper.module 11 May 2010 06:38:44 -0000
@@ -1,12 +1,12 @@
 <?php
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function maintenance_helper_menu() {
   $items = array();
 
-  $items['admin/settings/maintenance_helper'] = array(
+  $items['admin/config/development/maintenance_helper'] = array(
     'title' => t('Maintenance Helper'),
     'description' => t('Configure the Maintenance Helper'),
     'page callback' => 'drupal_get_form',
@@ -18,7 +18,37 @@ function maintenance_helper_menu() {
 }
 
 /**
- * Implementation of hook_init().
+ * Implements hook_menu_alter().
+ */
+function maintenance_helper_menu_alter(&$items) {
+  if (variable_get('maintenance_helper_hide_login', FALSE)) {
+    unset($items['user']);
+    unset($items['user/login']);
+    unset($items['user/register']);
+  }
+  // Also remove comment reply page in case anonymous users have access.
+  unset($items['comment/reply/%node']);
+
+}
+
+/**
+ * Implements hook_block_info_alter().
+ */
+function maintenance_helper_mongodb_block_info_alter(&$blocks) {
+  if (variable_get('maintenance_helper_hide_login', FALSE)) {
+    $blocks['user_login']['status'] = 0;
+  }
+}
+
+/**
+ * Implements hook_entity_prepare_view().
+ */
+function maintenance_helper_node_view_alter(&$build) {
+  $build['comments']['comment_form']['#access'] = FALSE;
+}
+
+/**
+ * Implements hook_init().
  */
 function maintenance_helper_init() {
   if (variable_get('maintenance_helper_message_show', FALSE) && !count($_POST)) {
@@ -27,26 +57,22 @@ function maintenance_helper_init() {
 
   global $user;
   if(isset($user->uid) && $user->uid && !user_access('login to site')) {
-    global $user;
-
-    watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
-
-    // Destroy the current session:
-    session_destroy();
-    module_invoke_all('user', 'logout', NULL, $user);
-
-    // Load the anonymous user
-    $user = drupal_anonymous_user();
-
+    drupal_set_message(t('You do not currently have permission to log into this site, please try again later.'));
+    module_load_include('inc', 'user', 'user.pages');
+    user_logout();
     drupal_set_message(t('Sorry, you do not have the permission to login at this time.'), 'warning');
   }
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_perm().
  */
-function maintenance_helper_perm() {
-  return array('login to site');
+function maintenance_helper_permission() {
+  return array(
+    'login to site' => array(
+      'title' => 'Log into site',
+    ),
+  );
 }
 
 /**
@@ -83,4 +109,4 @@ function maintenance_helper_admin_settin
   */
 
   return system_settings_form($form);
-}
\ No newline at end of file

