是否可以使用 Drush 使 Drupal 站点离线?

发布于 2024-09-30 00:47:58 字数 34 浏览 4 评论 0原文

是否可以使用 Drush 使 Drupal 站点离线?

Is it possible to take a Drupal site offline using Drush?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

你在我安 2024-10-07 00:47:58

是的。 drush vset site_offline 1 将其设置为离线,然后 drush vdel site_offline 将其恢复。

或者,您可以在 drupal.org 上查看我的维护文件模块,如果出现以下情况,该模块会将您的站点设置为离线状态:它在目录中查找特定文件。

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.

归属感 2024-10-07 00:47:58

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

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

它还有助于在每个命令后添加一点 drush cc all,以确保用户即时看到更改。

Just in case anyone needs to do this with Drupal 7, the commands are:

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

It also helps to add a little drush cc all after each of those commands to ensure that the change appears instantaneous to users.

你是我的挚爱i 2024-10-07 00:47:58

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

theunraveler's solution is the best if you're running a single site. We were running a very large multisite drupal installation, with hundreds of sites. Taking them offline that way via drush takes several seconds per site which was unacceptable. The fastest way to take a site offline is to break the db connection by for example renaming the settings.php file. Then just assign a default theme that has a basic template that doesn't require the db, saying "Site Offline" or something. After upgrading you can just repair the settings.php file and you're good to go.

时光沙漏 2024-10-07 00:47:58

在 D7 上使用站点别名:

drush @site_alias -y vset maintenance_mode 1    # Take site offline
drush @site_alias -y vset maintenance_mode 0    # Take site online

With a site alias on D7:

drush @site_alias -y vset maintenance_mode 1    # Take site offline
drush @site_alias -y vset maintenance_mode 0    # Take site online
≈。彩虹 2024-10-07 00:47:58

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

drush vset maintenance_mode 1

It's quite easy in fact, simply set the variable of maintenance mode to 1 (0 to restore default value):

drush vset maintenance_mode 1
烟沫凡尘 2024-10-07 00:47:58

德鲁帕尔 6

drush vset site_offline 1

德鲁帕尔 7

drush vset maintenance_mode 1

Drupal 6

drush vset site_offline 1

Drupal 7

drush vset maintenance_mode 1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文