eaudeweb / heavy-lifter
为您的 Drupal 项目提供的常用命令,助您快速上手
Requires
- php: >=7.3
- ext-json: *
- eaudeweb/robo-curl: 2.0.0-alpha3
- webflo/drupal-finder: ^1.2
Suggests
- eaudeweb/gdpr-dump: 1.0.6
- dev-master
- 2.x-dev
- 2.0.0-alpha4
- 2.0.0-alpha3
- 2.0.0-alpha2
- 2.0.0-alpha1
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-20661-drush-deploy-v2
- dev-20661-drush-deploy
- dev-2.x-hook-deploy
- dev-Anthelixes-integrity-check
- dev-9184-robo-optional
- dev-3-maintenance-mode
- dev-15-fix-docroot-reference
- dev-19-fix-commands-ordering
- dev-6467-windows-server
- dev-6395-sql-dump-anonymize
- dev-6408_update_readme
- dev-6345-fix-site-update
- dev-6345_fix_site_update
- dev-develop
- dev-6138_robo_yml_refactorization
- dev-6156_enhancement_for_site_develop
- dev-post-command-scripts
- dev-5871_improvements
- dev-sql-sync
This package is auto-updated.
Last update: 2024-09-14 12:49:40 UTC
README
为本地 Drupal 开发承担重任。
安装
https://packagist.org.cn/packages/eaudeweb/heavy-lifter
Drupal 8
-
使用 composer 安装 heavy-lifter:
composer require eaudeweb/heavy-lifter
-
执行 heavy-lifter 的配置脚本:
./vendor/bin/robo site:config
-
将
example.robo.yml
复制到robo.yml
,根据系统管理员提供的用户名和密码进行自定义 -
(可选) 您可以在
robo.yml
中为 heavy-lifter 的任何 robo 命令添加要排除的 drush 命令
示例
site:
update:
excluded_commands:
- locale:check
- yyy
- (可选) 您可以在
robo.yml
中为 heavy-lifter 的任何 robo 命令添加额外的 drush 命令
示例
site:
update:
extra_commands:
- locale:update
- 执行
./vendor/bin/robo sql:sync
以查看安装是否成功
Drupal 7
Drupal 7 上的安装指南与 Drupal 8 相同,只需注意以下几点
- 并非所有可用的 robo 命令都适用于 Drupal 7 网站。(一些命令仅对 Drupal 8 网站可用,因此尚未在 Drupal 7 上实现/测试)
如何在项目中使用它
注意:您需要在项目的根目录中运行所有命令(即存储 web/
文件夹的地方)。
-
将
example.robo.yml
复制到robo.yml
并根据系统管理员提供的用户名和密码进行自定义 -
获取数据库转储并导入:
./vendor/bin/robo sql:sync
-
更新网站的配置和数据库:
./vendor/bin/robo site:update
-
获取文件存档:
./vendor/bin/robo files:sync
-
将文件目录的存档创建到指定的路径:
/vendor/bin/robo files:dump [destination]
-
启用开发模式:
./vendor/bin/robo site:develop
-
从远程存储下载数据库转储,而不导入它:
/vendor/bin/robo sql:download [destination]
自定义开发脚本
如果您想在 site:develop 命令的末尾运行自定义 drush 脚本,请将这些脚本添加到 PROJECT/etc/scripts/develop 文件夹中。
数据库匿名化
- 运行
composer require eaudeweb/gdpr-dump
- 在项目根目录(与 robo.yml 同一文件夹)中定义您的匿名化模式 schema.yml 文件
- 运行
./vendor/bin/robo sql:dump --anonymize
在 ignored_values 下列出的行值将不会进行匿名化。
anonymize.schema.yml 示例
users_field_data:
name:
formatter: email
exclude: # the rows that have these values will NOT be anonymized
uid: [1, 76, 228, 81, 116, 117, 149, 393]
telephone:
formatter: phoneNumber
mail:
formatter: email
unique: true
exclude:
uid: [1, 76, 228, 81, 116, 117, 149, 393]
conditions_action: ignore
pass:
formatter: password
preferred_admin_langcode:
formatter: clear
table2:
column1:
formatter: randomText
include: # only the rows that have these values will be anonymized
name: ['Name to anonymize']
rand_num
formatter: randomNumber
arguments: [6] # argument passed to the randomNumber() function from the Faker library, max 6 digits
taxonomy_term_field_revision:
name:
formatter: company
include: # you can also use SELECT queries to define your list of included rows. The select query MUST only select ONE column
tid: SELECT tid FROM taxonomy_term_field_data WHERE vid = "partners"
...
格式化类型
- name - 生成一个名称
- phoneNumber - 生成一个电话号码
- username - 生成一个随机用户名
- password - 生成一个随机密码
- email - 生成一个随机电子邮件地址
- date - 生成一个日期
- longText - 生成一个句子
- number - 生成一个数字
- randomText - 生成一个句子
- text - 生成一个段落
- uri - 生成一个 URI
- clear - 生成一个空字符串
有关可用的格式化程序的更多信息,请参阅 https://github.com/fzaninotto/Faker#formatters
Windows 环境的观察
- 仅可用命令
sql:dump
- robo 路径为
./vendor/consolidation/robo/robo
多站点
对于多站点,在 robo.yml
中的 sites
下创建另一个密钥,并按照 sites:default
进行配置。
要在子站点上运行命令,使用 --site SITE
参数。
示例
robo.yml
sites:
default:
...
subsite:
...
./vendor/bin/robo sql:sync --site subsite