当前位置: 首页 > 编程笔记 >

Drupal 8:从现有配置安装站点

辛承
2023-03-14
本文向大家介绍Drupal 8:从现有配置安装站点,包括了Drupal 8:从现有配置安装站点的使用技巧和注意事项,需要的朋友参考一下

当运行测试或没有数据库副本时,通过配置安装Drupal站点非常有用。您将获得Drupal网站的副本,其中没有任何内容与实时网站的行为相同。您可以使用默认内容之类的模块将内容添加到混音中,以便新安装的站点的行为有点像实时版本。

由于有一些先决条件才能启动和运行它,所以我想我会逐步了解如何使其开始工作以及如何运行它。

安装配置文件兼容性

首先,hook_install()关于安装配置文件的钩子存在一个小问题,这意味着您需要使用不包含安装配置文件的安装配置文件。这样做的原因是,在完成安装,导入配置和所需的模块后,安装挂钩将触发并可能更改刚刚安装的配置。为了限制更改的复杂性和范围,决定仅拒绝hook_install()使用包含挂钩的配置文件的功能。

如果您使用标准配置文件安装了网站(可能是这种情况),则会看到类似的错误。

  Configuration install: standard                                                                                  
 
  The selected profile has a hook_install() implementation and therefore can not be installed from configuration.

交换站点以使用最小配置文件使用最小安装配置文件或任何其他没有hook_install()钩子的安装配置文件。要在配置中执行此操作,您只需要打开core.extension.yml文件并在已安装模块的列表中更改配置文件设置和配置文件名称即可。即使它不是一个模块,它仍然会出现在这里,因此您需要更改两个实例。

您需要从以下更改core.extension.yml文件:

  menu_link_content: 1
  pathauto: 1
  content_translation: 10
  views: 10
  paragraphs: 11
  standard: 1000
theme:
  stable: 0
  classy: 0
  bartik: 0
  seven: 0
  adminimal_theme: 0
profile: standard
_core:
  default_config_hash: .....

对此:

  menu_link_content: 1
  pathauto: 1
  content_translation: 10
  views: 10
  paragraphs: 11
  minimal: 1000
theme:
  stable: 0
  classy: 0
  bartik: 0
  seven: 0
  adminimal_theme: 0
profile: minimal
_core:
  default_config_hash: .....

交换“标准”为“最小”。

顺便说一句,看来此要求将从将来的Drupal版本中删除(可能从9.1.0开始)。有关Drupal.org更多信息,请参见此问题。

导出配置

如果已经导出了配置,则可以跳过此步骤。

确保在站点settings.php文件中设置了config_sync_directory设置。这是Drupal所必需的,它可以知道您的配置将存放在哪里。

$settings['config_sync_directory'] = '../config/sync';

设置好位置并创建目录后,使用drush导出配置。

drush cex

这会将您的Drupal配置放到位于../config/sync的目录中。

运行安装

现在,您可以使用site:install drush命令以及--existing-config标志完全从头开始安装该站点。

drush site:install --existing-config

这将删除数据库中的所有表,并使用以前导出的配置重新安装站点。

这是正在运行的命令的一些示例输出。

$ drush site:install --existing-config
 
 You are about to:
 * DROP all tables in your 'drupal' database.
 
 Do you want to continue? (yes/no) [yes]:
 > yes
 
 [notice] Starting Drupal installation. This takes a while.
 [notice] Performed install task: install_select_language
 [notice] Performed install task: install_select_profile
 [notice] Performed install task: install_load_profile
 [notice] Performed install task: install_verify_requirements
 [notice] Performed install task: install_write_profile
 [notice] Performed install task: install_verify_database_ready
 [notice] Performed install task: install_base_system
 [notice] Performed install task: install_bootstrap_full
 [notice] Performed install task: install_config_import_batch
 [notice] Performed install task: install_config_download_translations
 [notice] Performed install task: install_config_revert_install_changes
 [notice] Performed install task: install_configure_form
 [notice] Cron run completed.
 [notice] Performed install task: install_finished
 [success] Installation complete.  User name: admin  User password: ....

如果要查看从现有配置安装Drupal的原始更改记录。

 类似资料:
  • 系统环境需求及注意事项 Win平台使用DedeAMPZ快速安装

  • 本文向大家介绍VS2019安装配置MFC(安装vs2019时没有安装mfc),包括了VS2019安装配置MFC(安装vs2019时没有安装mfc)的使用技巧和注意事项,需要的朋友参考一下 1.查看vs2019里面有没有配置MFC 新建项目,如果能在右边找到MFC应用则配置了,否则没有 2.*如果没有安装,将右边的的竖直移动条拉到底部,点击安装多个工具和供能* 3.选中在C++桌面开发==》在右侧选

  • WorkerMan实际上就是一个PHP代码包,如果你的PHP环境已经装好,只需要把WorkerMan源代码或者demo下载下来即可运行。 windows用户(必读) windows用户需要使用windows版本的workerman,windows版本workerman本身不依赖任何扩展,只需要配置好PHP环境变量即可,windows版本workerman安装及注意事项参见windows用户必看。

  • 主要内容:1. 在Windows上安装CouchDB,2. 在Linux系统上安装CouchDB在这篇文章中,我们主要介绍和演示如何下载和安装 CouchDB , 由于时间和篇幅的限制,这里只介绍在 Window 10 64位和Ubuntu的CouchDB安装配置。 1. 在Windows上安装CouchDB 下载CouchDB 访问CouchDB官方网站:http://couchdb.apache.org/ , 点击右上方的下载(Download)链接,就会跳到下载页面,CouchDB有各

  • 主要内容:Windows 上安装 Node.js,Linux 上安装 Node.js,Mac OS 上安装本章节我们将向大家介绍在 Windows 和 Linux 上安装 Node.js 的方法。 本安装教程以 Node.js v4.4.3 LTS(长期支持版本)版本为例。 Node.js 安装包及源码下载地址为:https://nodejs.org/zh-cn/download/。 你可以根据不同平台系统选择你需要的 Node.js 安装包。 Node.js 历史版本下载地址:https://

  • 在使用Git前我们需要先安装 Git。Git 目前支持 Linux/Unix、Solaris、Mac和 Windows 平台上运行。 Git 各平台安装包下载地址为:http://git-scm.com/downloads Linux 平台上安装 Git 的工作需要调用 curl,zlib,openssl,expat,libiconv 等库的代码,所以需要先安装这些依赖工具。 在有 yum 的系统