16

是否可以使用 Drush 使 Drupal 站点脱机?

4

6 回答 6

22

Yep. drush vset site_offline 1 will set it offline, then drush vdel site_offline will bring it back.

Alternatively, you can check out my Maintenance File module on drupal.org, which will set your site to offline if it finds a specific file in the directory.

于 2010-10-28T18:20:21.737 回答
15

以防万一有人需要使用 Drupal 7 执行此操作,命令是:

drush vset maintenance_mode 1 --yes   # Take site offline 
drush vset maintenance_mode 0 --yes   # Put site back online

它还有助于drush cc all在每个命令之后添加一点,以确保更改对用户来说是即时的。

于 2011-03-15T01:18:14.440 回答
4

如果您运行的是单个站点,theunraveler 的解决方案是最好的。我们正在运行一个非常大的多站点 drupal 安装,其中包含数百个站点。通过 drush 以这种方式使它们离线每个站点需要几秒钟,这是不可接受的。使站点脱机的最快方法是通过例如重命名 settings.php 文件来中断数据库连接。然后只需分配一个默认主题,该主题具有不需要数据库的基本模板,例如“Site Offline”或其他内容。升级后,您只需修复 settings.php 文件即可。

于 2010-10-28T18:29:29.677 回答
0

在 D7 上使用站点别名:

drush @site_alias -y vset maintenance_mode 1    # Take site offline
drush @site_alias -y vset maintenance_mode 0    # Take site online
于 2014-08-20T08:30:40.117 回答
0

其实很简单,只需将维护模式的变量设置为1(0恢复默认值):

drush vset maintenance_mode 1
于 2014-08-20T12:14:43.257 回答
0

Drupal 6

drush vset site_offline 1

德鲁巴 7

drush vset maintenance_mode 1
于 2014-08-20T21:10:06.360 回答