1

我的网站是在 Drupal 7 中开发的。最近我将我的网站置于维护模式。现在我需要让这个网站恢复运行。

不幸的是,我无法以管理员身份登录和“上网”(由于用户登录表单中的一些修改)。我还尝试通过数据库查询更新“site_offline”变量。但这也没有用。令我惊讶的是,db 中没有像“site_offline”这样的变量。为什么会这样?

任何人都可以帮助解决这个问题吗?任何帮助或建议将不胜感激。

4

9 回答 9

4

我也遇到了同样的问题,我在 settings.php 文件的末尾添加了以下语句。它奏效了。

        $conf['maintenance_mode'] = 0;

来源:https ://www.drupal.org/node/276457#comment-9364023

于 2014-12-11T07:23:22.573 回答
4

无需对数据库进行更改。

只需添加$conf['maintenance_mode'] = 0; 到您的settings.php文件。这将覆盖默认设置。

于 2016-01-29T05:20:48.073 回答
3

如果您注销后无法重新登录,只需/?q=user在您的网站地址后添加,您将返回用户登录页面。

于 2014-05-12T10:50:41.507 回答
2

最后我找到了解决这个问题的方法。我使用以下代码通过管理员以编程方式登录到应用程序,

global $user;
$user = user_load(1);
drupal_session_regenerate();
drupal_goto('user');

参考

登录后,我从 admin/config/development/maintenance 更改了维护配置。

更新

一旦网站从维护模式恢复,请确保删除上述代码。否则,这将为访问该网站的任何用户提供管理访问权限。

于 2014-02-05T07:13:20.400 回答
2

如果您有权访问该站点的 crush shell,则可以简单地运行:

# from drupal root (/path/to/index.php)
drush vset maintenance_mode 0;
drush c all;

如果没有,或者这不起作用,请将变量表中的“maintenance_mode”属性更新为“i:0;” (不是 0,因为 drupal 将这些设置存储和解析为长 blob)。

#sql statement
UPDATE `variable` SET `value` = 'i:0;' WHERE `name` = 'maintenance_mode';

注意:如果您只能访问数据库,则可能需要手动清除所有缓存表。

于 2014-02-03T09:35:44.120 回答
2

我发现解决方案是简单地导航到 yoursitename/user/login

只需以站点管理员身​​份登录并关闭维护模式即可。

它比搞乱上面的代码建议要简单得多......

令人讨厌的是,这个“简单”的修复花了我一个小时的谷歌搜索,并浏览了其他论坛上建议的各种兔子洞。

也许我们(作为开发人员)应该花一些时间来学习如何使用我们被要求支持的产品?

于 2020-03-11T11:55:25.173 回答
0

You can also put it manually out of maintenance mode by editing index.php and setting the variable "maintenance_mode"

<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* The routines here dispatch control to the appropriate handler, which then
* prints the appropriate page.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*/


/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());


require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
variable_set('maintenance_mode', 0);
menu_execute_active_handler();

source: https://www.drupal.org/node/2072055#comment-7784641

于 2014-11-13T19:55:56.743 回答
0

我推荐 Drupal 文档:

它基本上说明了 Alexander Farber 发布的内容,但也表明一旦您登录,您将导航到管理页面,根据 Drupal 版本,转到以下链接:

  • Drupal 4: 管理 » 设置 (admin/settings)
  • Drupal 5&6:管理 » 站点配置 » 站点维护(管理员/设置/站点维护)。
  • Drupal 7:管理 » 配置 » 开发 » 维护模式:删除框“将站点置于维护模式”上的复选标记
于 2015-01-12T13:52:31.370 回答
0

这可能听起来很疯狂,但在某些 Apache 版本中,Web 服务器打开的默认文件是.html ,并且Drupal 7 根目录中有一个index.html ,其内容是:

Website is Under Construction ....

所以只需将该文件重命名为 index 以外的名称,然后您的 Web 服务器将打开 index.php 。

于 2018-08-21T17:03:34.210 回答