@@ -36,26 +36,18 @@ class Plugin implements PluginInterface, EventSubscriberInterface {
36
36
protected $ io ;
37
37
38
38
/**
39
- * The Composer Scaffold handler .
39
+ * Stores this plugin package object .
40
40
*
41
- * @var \Drupal\Composer\Plugin\Scaffold\Handler
41
+ * @var mixed|null
42
42
*/
43
- protected $ handler ;
44
-
45
- /**
46
- * Record whether the 'require' command was called.
47
- *
48
- * @var bool
49
- */
50
- protected $ drsIncluded ;
43
+ protected $ settingsPackage ;
51
44
52
45
/**
53
46
* {@inheritdoc}
54
47
*/
55
48
public function activate (Composer $ composer , IOInterface $ io ) {
56
49
$ this ->composer = $ composer ;
57
50
$ this ->io = $ io ;
58
- $ this ->drsIncluded = FALSE ;
59
51
}
60
52
61
53
/**
@@ -83,7 +75,7 @@ public static function getSubscribedEvents() {
83
75
}
84
76
85
77
/**
86
- * Marks Acquia Drupal Recommended Settings to be processed after an install or update command .
78
+ * Marks this plugin to be processed after package install or update event .
87
79
*
88
80
* @param \Composer\Installer\PackageEvent $event
89
81
* Event.
@@ -98,13 +90,14 @@ public function onPostPackageEvent(PackageEvent $event) {
98
90
}
99
91
100
92
/**
101
- * Execute Acquia Drupal Recommended Settings drs:update after update command has been executed .
93
+ * Includes Acquia recommended settings post composer update/install command.
102
94
*
103
95
* @throws \Exception
104
96
*/
105
97
public function onPostCmdEvent () {
106
- // Only install the template files if acquia/drupal-recommended-settings was installed.
107
- if (isset ($ this ->settingsPackage )) {
98
+ // Only install the template files, if the drupal-recommended-settings
99
+ // plugin is installed.
100
+ if ($ this ->settingsPackage ) {
108
101
$ settings = new Settings ($ this ->composer , $ this ->io , $ this ->settingsPackage );
109
102
$ settings ->hashSalt ();
110
103
$ settings ->generateSettings ();
@@ -133,25 +126,4 @@ protected function getSettingsPackage(OperationInterface $operation) {
133
126
return NULL ;
134
127
}
135
128
136
- /**
137
- * Hook for pre-package install.
138
- */
139
- public function prePackageInstall (PackageEvent $ event ) {
140
- if (!$ this ->drsIncluded ) {
141
- $ operations = $ event ->getOperations ();
142
- foreach ($ operations as $ operation ) {
143
- if ($ operation instanceof InstallOperation) {
144
- $ package = $ operation ->getPackage ();
145
- }
146
- elseif ($ operation instanceof UpdateOperation) {
147
- $ package = $ operation ->getTargetPackage ();
148
- }
149
- if (isset ($ package ) && $ package instanceof PackageInterface && $ package ->getName () == 'acquia/drupal-recommended-settings ' ) {
150
- $ this ->drsIncluded = TRUE ;
151
- break ;
152
- }
153
- }
154
- }
155
- }
156
-
157
129
}
0 commit comments