Skip to content

Commit 29c517d

Browse files
authored
Merge pull request #30 from acquia/develop
Merge `develop` into `main`
2 parents dd7ba79 + 5c06103 commit 29c517d

33 files changed

+1094
-6778
lines changed

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "composer"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
# Use Indian Standard Time (UTC +05:30)
8+
timezone: "Asia/Kolkata"
9+
time: "09:00"
10+
# Raise pull requests for version updates
11+
# to pip against the `develop` branch
12+
target-branch: "develop"

.github/workflows/drs_ci.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: drupal-recommended-settings CI
2+
on:
3+
# schedule:
4+
# "At minute 0 past hour 4 and 8 UTC."
5+
# - cron: '0 4,8 * * *'
6+
push:
7+
branches: [ develop, main, ACMS* ]
8+
paths-ignore:
9+
- README.md
10+
pull_request:
11+
branches: [ develop ]
12+
paths-ignore:
13+
- README.md
14+
env:
15+
ORCA_SUT_NAME: acquia/drupal-recommended-settings
16+
ORCA_SUT_BRANCH: develop
17+
ORCA_VERSION: ^4
18+
ORCA_PACKAGES_CONFIG_ALTER: ../drupal-recommended-settings/tests/packages_alter.yml
19+
ORCA_ENABLE_NIGHTWATCH: "FALSE"
20+
ORCA_PHPCS_STANDARD: AcquiaPHP
21+
COMPOSER_PROCESS_TIMEOUT: 1800
22+
jobs:
23+
STATIC_CODE_ANALYSIS:
24+
name: "Static Code Analysis"
25+
runs-on: ubuntu-latest
26+
env:
27+
ORCA_JOB: STATIC_CODE_ANALYSIS
28+
steps:
29+
- uses: actions/checkout@v3
30+
- uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: 8.2
33+
coverage: xdebug
34+
- name: Download ORCA
35+
run: composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n
36+
- name: Before Install
37+
run: ../orca/bin/ci/before_install.sh
38+
- name: Install
39+
run: ../orca/bin/ci/install.sh
40+
- name: Before script
41+
run: ../orca/bin/ci/before_script.sh
42+
- name: Script
43+
run: ../orca/bin/ci/script.sh
44+
- name: After script
45+
run: |
46+
../orca/bin/ci/after_success.sh
47+
../orca/bin/ci/after_failure.sh
48+
../orca/bin/ci/after_script.sh
49+
PHPUNIT_TESTS:
50+
name: "Execute PHPUnit tests"
51+
runs-on: ubuntu-latest
52+
env:
53+
ORCA_FIXTURE_DIR: "/home/runner/work/drupal-recommended-settings/orca-build"
54+
CI: TRUE
55+
steps:
56+
- uses: actions/checkout@v3
57+
- uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: 8.2
60+
coverage: xdebug
61+
- name: Download ORCA
62+
run: composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n
63+
- name: Before Install
64+
run: ../orca/bin/ci/before_install.sh
65+
- name: Install
66+
run: ../orca/bin/ci/install.sh
67+
- name: Before script
68+
run: ../orca/bin/ci/before_script.sh
69+
- name: Run PHPUnit tests
70+
run: |
71+
composer install
72+
./vendor/bin/phpunit tests
73+
- name: After script
74+
run: |
75+
../orca/bin/ci/after_success.sh
76+
../orca/bin/ci/after_failure.sh
77+
../orca/bin/ci/after_script.sh

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
vendor
22
.idea/
3+
.DS_Store
4+
composer.lock

README.md

+82-34
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,108 @@
11
# Acquia Drupal Recommended Settings
2-
The Acquia Drupal Recommended Settings plugin adds the recommended settings to the Drupal project, so developers won't have to edit settings.php manually.
2+
The Acquia Drupal Recommended Settings plugin adds the recommended settings to
3+
the Drupal project, so developers won't have to edit settings.php manually.
34

45
The recommended settings includes:
5-
- the required database credentials
6-
- configuration sync directory path.
7-
- public/private etc. file directory path.
6+
- The required database credentials.
7+
- Configuration sync directory path.
8+
- File directory path i.e public/private etc.
89
- Acquia site studio sync directory path.
9-
- Includes Drupal module [Config sync without site uuid](https://www.drupal.org/project/config_sync_without_site_uuid) features.
1010

11-
It allows your websites to be easily installed in both Acquia Cloud IDE & local and deployable on Acquia Cloud.
11+
It allows your websites to be easily installed in both Acquia Cloud IDE & local
12+
and deployable on Acquia Cloud.
1213

1314
## Installation
14-
15-
You can also install this using Composer like so:
15+
### Install using Composer
1616

1717
```
1818
composer require acquia/drupal-recommended-settings
1919
```
20-
21-
## Steps to switch from BLT to Acquia Drupal Recommended Settings
22-
This plugin doesn't work with the acquia/blt plugin. If the plugin exists, it must be removed.
23-
24-
- Remove BLT plugin using below command
20+
### Multi-site features with Acquia DRS
21+
The Drupal Recommended Settings offer the multi-site feature out of the box.
22+
To configure a multi-site, run the following command, and the plugin will
23+
automatically generate the settings.php in the backend.
2524
```
26-
composer remove acquia/blt
25+
drush site:install --uri site1
2726
```
2827

29-
- Remove BLT reference from settings.php file located at
30-
``/docroot/sites/default/settings.php``.
31-
```php
32-
require DRUPAL_ROOT . "/../vendor/acquia/blt/settings/blt.settings.php";
28+
The plugin offers various events that allow you to implement custom logic based
29+
on when these events are triggered. You can find the examples of such
30+
implementations from [here](examples).
31+
32+
# Quick examples
33+
## Generate settings for a given site
34+
```
35+
<?php
36+
3337
/**
34-
* IMPORTANT.
35-
*
36-
* Do not include additional settings here. Instead, add them to settings
37-
* included by `blt.settings.php`. See BLT's documentation for more detail.
38-
*
39-
* @link https://docs.acquia.com/blt/
38+
* @file
39+
* Include DRS settings.
4040
*/
41-
```
4241
43-
- Require Acquia Drupal Recommended Settings plugin using
42+
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
43+
use Acquia\Drupal\RecommendedSettings\Settings;
44+
45+
// Create settings object.
46+
$siteUri = "site1";
47+
$settings = new Settings(DRUPAL_ROOT, $siteUri);
48+
49+
try {
50+
// Call generate method.
51+
$settings->generate();
52+
}
53+
catch (SettingsException $e) {
54+
echo $e->getMessage();
55+
}
4456
```
45-
composer require acquia/drupal-recommended-settings
57+
58+
## Generate settings for a given site passing database credentials
59+
4660
```
47-
48-
- Update `default.local.settings.php` and `local.settings.php` to use the Environment Detector provided by this plugin instead of BLT:
49-
```diff
50-
- use Acquia\Blt\Robo\Common\EnvironmentDetector;
51-
+ use Acquia\Drupal\RecommendedSettings\Helpers\EnvironmentDetector;
61+
<?php
62+
63+
/**
64+
* @file
65+
* Include DRS settings.
66+
*/
67+
68+
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
69+
use Acquia\Drupal\RecommendedSettings\Settings;
70+
71+
// Create settings object.
72+
$siteUri = "site1";
73+
$settings = new Settings(DRUPAL_ROOT, $siteUri);
74+
75+
// Database details.
76+
$dbSpec = [
77+
'drupal' => [
78+
'db' => [
79+
'database' => 'drupal', // In case of multi-site database name is replaced with the site name.
80+
'username' => 'drupal',
81+
'password' => 'drupal',
82+
'host' => 'localhost',
83+
'port' => '3306',
84+
],
85+
],
86+
];
87+
88+
try {
89+
// Call generate method passing database details.
90+
$settings->generate($dbSpec);
91+
}
92+
catch (SettingsException $e) {
93+
echo $e->getMessage();
94+
}
5295
```
5396

5497
# License
5598

5699
Copyright (C) 2023 Acquia, Inc.
57100

58-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
101+
This program is free software: you can redistribute it and/or modify it under
102+
the terms of the GNU General Public License version 2 as published by the
103+
Free Software Foundation.
59104

60-
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
105+
This program is distributed in the hope that it will be useful,
106+
but WITHOUT ANY WARRANTY; without even the implied warranty of
107+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
108+
See the GNU General Public License for more details.

composer.json

+28-29
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,50 @@
11
{
22
"name": "acquia/drupal-recommended-settings",
3-
"type": "composer-plugin",
43
"description": "The composer plugin for adding drupal-recommended-settings for Acquia Cloud.",
4+
"license": "GPL-2.0-only",
5+
"type": "composer-plugin",
56
"keywords": [
67
"drupal",
78
"acquia",
89
"drupal-recommended-settings"
910
],
10-
"license": "GPL-2.0-only",
1111
"authors": [
1212
{
1313
"name": "Vishal Khode",
1414
"email": "[email protected]"
1515
}
1616
],
17+
"support": {
18+
"issues": "https://github.com/acquia/drupal-recommended-settings/issues",
19+
"docs": "https://docs.acquia.com/drupal-recommended-settings/"
20+
},
1721
"require": {
18-
"php": ">=7.4",
22+
"php": ">=8.1",
1923
"composer-plugin-api": "^2",
2024
"acquia/drupal-environment-detector": "^1.5.3",
21-
"composer/composer": "^2.5",
22-
"consolidation/config": "^1.0.0 || ^2.0.0",
23-
"dflydev/dot-access-data": "^1.1.0 || ^2 || ^3",
24-
"drupal/config_sync_without_site_uuid": "^1.0",
25-
"grasmash/yaml-expander": "^3",
26-
"loophp/phposinfo": "^1.7.1",
27-
"symfony/filesystem": "^6.2",
28-
"symfony/yaml": "^4.4 || ^5 || ^6"
29-
},
30-
"conflict": {
31-
"acquia/blt": "*"
25+
"consolidation/config": "^2.0.0",
26+
"grasmash/yaml-expander": "^3.0",
27+
"loophp/phposinfo": "^1.7.1"
3228
},
3329
"require-dev": {
34-
"acquia/coding-standards": "^1.0",
35-
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
36-
"ergebnis/composer-normalize": "~2.15.0",
37-
"phpro/grumphp-shim": "^1.5"
30+
"acquia/coding-standards": "^2.0",
31+
"composer/composer": "^2.2",
32+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
33+
"ergebnis/composer-normalize": "^2.30.2",
34+
"phpro/grumphp-shim": "^2.2",
35+
"phpunit/phpunit": "^9 || ^10"
36+
},
37+
"minimum-stability": "dev",
38+
"prefer-stable": true,
39+
"autoload": {
40+
"psr-4": {
41+
"Acquia\\Drupal\\RecommendedSettings\\": "src/"
42+
}
43+
},
44+
"autoload-dev": {
45+
"psr-4": {
46+
"Acquia\\Drupal\\RecommendedSettings\\Tests\\": "tests/src"
47+
}
3848
},
3949
"config": {
4050
"allow-plugins": {
@@ -45,16 +55,5 @@
4555
},
4656
"extra": {
4757
"class": "Acquia\\Drupal\\RecommendedSettings\\Plugin"
48-
},
49-
"autoload": {
50-
"psr-4": {
51-
"Acquia\\Drupal\\RecommendedSettings\\": "src/"
52-
}
53-
},
54-
"minimum-stability": "dev",
55-
"prefer-stable": true,
56-
"support": {
57-
"issues": "https://github.com/acquia/drupal-recommended-settings/issues",
58-
"docs": "https://docs.acquia.com/drupal-recommended-settings/"
5958
}
6059
}

0 commit comments

Comments
 (0)