繁体   English   中英

站点在 Drupal 7 中停留在维护模式

[英]Site stuck in Maintenance mode in Drupal 7

我的网站是用 Drupal 7 开发的。最近我把我的网站置于维护模式。 现在我需要让这个网站重新上线。

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

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

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

        $conf['maintenance_mode'] = 0;

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

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

无需对数据库进行更改。

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

如果您可以访问该站点的 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';

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

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

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

参考

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

更新

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

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

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

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

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

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

您也可以通过编辑 index.php 并设置变量“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();

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

我推荐 Drupal 文档:

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

  • Drupal 4: 管理 » 设置 (admin/settings)
  • Drupal 5&6:管理 » 站点配置 » 站点维护(admin/settings/site-maintenance)。
  • Drupal 7:管理 » 配置 » 开发 » 维护模式:取消勾选“将站点置于维护模式”复选框

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

Website is Under Construction ....

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM