au-vic-gov-dpc / user-management
此模块允许您根据用户可用的电子邮件地址分组用户,并为用户添加多个电子邮件地址。
Requires
- php: ^7.3
- drewm/mailchimp-api: ^2.5
- drupal/group: ^1.4
Requires (Dev)
- drupal/admin_toolbar: ^3.0
- drupal/console: ^1.9
- drupal/core-composer-scaffold: ^8.9.18
- drupal/core-dev: ^8.9.18
- drupal/core-recommended: ^8.9.18
- drupal/devel: ^4.1
- drupal/mailsystem: ^4.3
- drupal/phpmailer_smtp: ^2.0
Conflicts
This package is auto-updated.
Last update: 2023-07-23 00:33:36 UTC
README
DPC用户管理模块的Drupal模块
模块开发
我们假设以下开发风格(使用docker术语将您的计算机称为“主机”,以区分容器)
- 文件使用您选择的编辑器在您的主机系统上编辑。
- 所有 命令(
composer
、npm
、drush
、phpunit
等)都通过各自的容器通过docker-compose exec
运行。
此模板有一个单独的(单个命令)步骤来安装Drupal,您必须在启动容器之后运行此步骤(见下文)。
我们这样做是为了避免将数据库凭据等东西烘焙到镜像中。如果您决定将一些步骤烘焙到镜像中,则可以将命令从dev/config/services/drupal/root/setup.sh
移动到Dockerfile.drupal.dev
。
dev/config/
目录首先按服务组织(见docker-compose.yml
以获取服务列表),然后按容器内文件的路径组织,即。
dev/config/services/{NAME_OF_DOCKER_COMPOSE_SERVICE}/{PATH_THAT_FILE_IS_COPIED_OR_MOUNTED_IN_THE_SERVICE}
入门
请注意,以下每个命令都带有shell提示,告诉您该命令应在您的docker主机(以下为your-computer
)上运行还是在容器上运行。
# IMPORTANT: All the commands below are assumed to be run from the root directory ## Terminal 1 ######## ## start all the services (add --detach arg to this command if you ## want it to return control of your terminal to you) you@your-computer$ docker-compose up --build ## Terminal 2 ######## ## install Drupal (edit config/services/drupal/root/setup.sh if you want to ## change how Drupal is installed e.g. download and enable modules etc.) you@your-computer$ docker-compose exec drupal /root/setup.sh ## Now your drupal site should be available. ## To run commands e.g. composer or mysql, we open a shell in the drupal ## container and run them from there you@your-computer$ docker-compose exec drupal bash ## When you have a shell in the drupal container you can ... ## ... follow along with the nginx logs drupal-container$ tail -f /var/log/nginx/error.log drupal-container$ tail -f /var/log/nginx/access.log ## ... connect to mysql drupal-container$ mysql ## ... working with JS drupal-container$ cd html/modules/custom/dpc_user_management drupal-container$ npm run sass # or whatever commands you have defined in npm
如果您愿意,可以直接通过docker-compose运行命令,而无需首先打开bash shell,例如。
## Alternatively you can pass the command you want to run directly to ## `docker-compose exec` e.g. run mysql CLI client you@your-computer$ docker-compose exec drupal mysql
安装Drupal后(见上文),以下内容应在您的网络浏览器中可用
- https://:8080/(
drupal
容器中的Drupal) - https://:3001/(
frontend
容器中的Browsersync)
添加外部第三方Drupal依赖项
如果您需要添加无法通过composer管理的自定义依赖项,请相应地将其添加到./dev/modules/custom
或./dev/themes/custom
中。
如果您的自定义模块位于单独的git存储库中,则可以将其克隆到该目录中,这也可以。
您还需要在docker-compose.yml
文件中取消注释适当的行
访问主机上的依赖项
Composer和docker-compose已配置,以便将依赖项安装到项目中的./html/
和./vendor/
下,而不必弄乱您的项目代码库,也不影响容器的工作空间
you@your-computer$ composer install
手动运行测试
you@your-computer$ docker-compose exec drupal bash ## NB: VERY IMPORTANT: YOU MUST RUN TESTS AS www-data USER ## We have to run PHPUnit as a non-root user (otherwise it seems to fall back to ## running as the 'nobody' user who has no permissions to do anything) root@drupal-container> su www-data www-data@drupal-container> cd /var/www www-data@drupal-container> phpunit --verbose modules/custom/my-module-under-development/
像CI一样运行测试
这将以与CI相同的方式运行所有测试。
you@your-computer$ docker-compose exec drupal /root/run-ci.sh
在本地审计您的依赖项
CI 为每个 PR 执行这些检查,但您可以像这样运行它们
PHP
you@your-computer$ docker run --rm -v `pwd`:/opt/php/ oxcom/php-security-checker:alpine --
NodeJS
you@your-computer$ npx audit-app
Drupal 管理员凭据
默认凭据(由 docker-compose.yml
中的环境变量设置)为
Username: admin
Password: admin
文档
- Drupal API 参考 https://api.drupal.org/api/drupal
- Drupal 编码标准 https://www.drupal.org/docs/develop/standards/coding-standards
- Drupal 核心变更日志 https://www.drupal.org/list-changes/drupal
注意事项
- 为了简化模板/前端开发,Drupal 网站处于缓存禁用模式。
- 即使是本地开发设置已启用,匿名用户访问网站仍然会使用缓存。您必须登录才能在禁用缓存的情况下查看您的网站。
清理
## clean up (-v also deletes the volume that stores the MySQL data so only use
## it if that's the result you want)
you@your-computer$ docker-compose down -v