Skip to content

Commit 5c06103

Browse files
authored
Merge pull request #27 from acquia/ACMS-3478
ACMS-3478: Update README.md file.
2 parents dd0bcf8 + 01b51ac commit 5c06103

File tree

4 files changed

+77
-16
lines changed

4 files changed

+77
-16
lines changed

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,23 @@ It allows your websites to be easily installed in both Acquia Cloud IDE & local
1212
and deployable on Acquia Cloud.
1313

1414
## Installation
15+
### Install using Composer
1516

16-
### Include Acquia Global Command in DRS for multisite functionality
17-
To use global command with DRS for multisite functionality please add below in
18-
your root composer.json file.
1917
```
20-
"repositories": {
21-
"acquia_global_commands": {
22-
"type": "vcs",
23-
"url": "[email protected]:vishalkhode1/acquia_global_commands.git"
24-
}
25-
}
18+
composer require acquia/drupal-recommended-settings
2619
```
27-
28-
You can also install this using Composer like so:
29-
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.
3024
```
31-
composer require acquia/drupal-recommended-settings
25+
drush site:install --uri site1
3226
```
3327

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+
3432
# Quick examples
3533
## Generate settings for a given site
3634
```
@@ -51,7 +49,8 @@ $settings = new Settings(DRUPAL_ROOT, $siteUri);
5149
try {
5250
// Call generate method.
5351
$settings->generate();
54-
} catch (SettingsException $e) {
52+
}
53+
catch (SettingsException $e) {
5554
echo $e->getMessage();
5655
}
5756
```
@@ -77,7 +76,7 @@ $settings = new Settings(DRUPAL_ROOT, $siteUri);
7776
$dbSpec = [
7877
'drupal' => [
7978
'db' => [
80-
'database' => 'drupal',
79+
'database' => 'drupal', // In case of multi-site database name is replaced with the site name.
8180
'username' => 'drupal',
8281
'password' => 'drupal',
8382
'host' => 'localhost',
@@ -89,7 +88,8 @@ $dbSpec = [
8988
try {
9089
// Call generate method passing database details.
9190
$settings->generate($dbSpec);
92-
} catch (SettingsException $e) {
91+
}
92+
catch (SettingsException $e) {
9393
echo $e->getMessage();
9494
}
9595
```
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## About
2+
Provides an example implemention of events provided by DRS.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "example/example-drush-command",
3+
"description": "Example custom drush commands.",
4+
"keywords": [
5+
"drush",
6+
"drupal"
7+
],
8+
"license": "GPL-2.0-or-later",
9+
"require": {
10+
"acquia/drupal-recommended-settings": "*"
11+
},
12+
"autoload": {
13+
"psr-4": {
14+
"Example\\": "src"
15+
}
16+
},
17+
"config": {
18+
"allow-plugins": {
19+
"acquia/drupal-recommended-settings": true
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Example\Drush\Commands;
4+
5+
use Acquia\Drupal\RecommendedSettings\Drush\Commands\MultisiteDrushCommands;
6+
use Consolidation\AnnotatedCommand\CommandData;
7+
use Consolidation\AnnotatedCommand\Hooks\HookManager;
8+
use Drush\Attributes as CLI;
9+
use Drush\Commands\DrushCommands;
10+
11+
/**
12+
* An example drush command file.
13+
*/
14+
class ExampleDrushCommands extends DrushCommands {
15+
16+
/**
17+
* Do not generate settings.php file to site1.
18+
*/
19+
#[CLI\Hook(type: HookManager::ON_EVENT, target: MultisiteDrushCommands::VALIDATE_GENERATE_SETTINGS)]
20+
public function skipQuestionForSite(CommandData $commandData): bool {
21+
// DO NOT ask question for site: `site1`.
22+
if ($commandData->input()->getOption("uri") == "site1") {
23+
return FALSE;
24+
}
25+
return TRUE;
26+
}
27+
28+
/**
29+
* Display successful message, after settings files are generated/updated.
30+
*/
31+
#[CLI\Hook(type: HookManager::ON_EVENT, target: MultisiteDrushCommands::POST_GENERATE_SETTINGS)]
32+
public function showSuccessMessage(CommandData $commandData): void {
33+
$uri = $commandData->input()->getOption("uri");
34+
$this->io()->info("The settings.php generated successfully for site `" . $uri . "`.");
35+
}
36+
37+
}

0 commit comments

Comments
 (0)