Skip to content

Commit ad7b818

Browse files
jrockowitzjrockowitz
jrockowitz
authored andcommitted
Issue #2959281 by jrockowitz: Add disable-tsl options to drush webform-composer commands
1 parent 8e1ce89 commit ad7b818

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

drush/webform.drush.inc

+6
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ function webform_drush_command() {
124124
'8+',
125125
),
126126
'bootstrap' => 1,
127+
'options' => array(
128+
'disable-tls' => 'If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed.',
129+
),
127130
'examples' => array(
128131
'webform-libraries-composer' => "Generates the Webform module's composer.json with libraries as repositories.",
129132
),
@@ -205,6 +208,9 @@ function webform_drush_command() {
205208
'8+',
206209
),
207210
'bootstrap' => 1,
211+
'options' => array(
212+
'disable-tls' => 'If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed.',
213+
),
208214
'examples' => array(
209215
'webform-composer-update' => "Updates the Drupal installation's composer.json to include the Webform module's selected libraries as repositories.",
210216
),

src/Commands/WebformCliService.php

+32
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ public function webform_drush_command() {
184184
'description' => "Generates the Webform module's composer.json with libraries as repositories.",
185185
'core' => ['8+'],
186186
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
187+
'options' => [
188+
'disable-tls' => '[boolean] If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed.',
189+
],
187190
'examples' => [
188191
'webform-libraries-composer' => "Generates the Webform module's composer.json with libraries as repositories.",
189192
],
@@ -257,6 +260,9 @@ public function webform_drush_command() {
257260
'description' => "Updates the Drupal installation's composer.json to include the Webform module's selected libraries as repositories.",
258261
'core' => ['8+'],
259262
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
263+
'options' => [
264+
'disable-tls' => '[boolean] If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed.',
265+
],
260266
'examples' => [
261267
'webform-composer-update' => "Updates the Drupal installation's composer.json to include the Webform module's selected libraries as repositories.",
262268
],
@@ -617,6 +623,9 @@ public function drush_webform_libraries_composer() {
617623
}
618624
}', TRUE);
619625

626+
// Set disable tls.
627+
$this->drush_webform_composer_set_disable_tls($data);
628+
620629
// Set libraries.
621630
$data['repositories'] = [];
622631
$data['require'] = [];
@@ -949,6 +958,9 @@ public function drush_webform_composer_update() {
949958
}
950959
}
951960

961+
// Set disable tls.
962+
$this->drush_webform_composer_set_disable_tls($data);
963+
952964
// Set libraries.
953965
$this->drush_webform_composer_set_libraries($repositories, $require);
954966

@@ -959,6 +971,25 @@ public function drush_webform_composer_update() {
959971
$this->drush_print('Make sure to run `composer update`.');
960972
}
961973

974+
975+
/**
976+
* Set composer disable tls.
977+
*
978+
* This is needed when CKEditor's HTTPS server's SSL is not working properly.
979+
*
980+
* @param array $data
981+
* Composer JSON data.
982+
*/
983+
protected function drush_webform_composer_set_disable_tls(array &$data) {
984+
// Remove disable-tls config.
985+
if (isset($data['config']) && isset($data['config']['disable-tls'])) {
986+
unset($data['config']['disable-tls']);
987+
}
988+
if ($this->drush_get_option('disable-tls')) {
989+
$data['config']['disable-tls'] = TRUE;
990+
}
991+
}
992+
962993
/**
963994
* Set composer libraries.
964995
*
@@ -1006,6 +1037,7 @@ protected function drush_webform_composer_set_libraries(array &$repositories, ar
10061037
ksort($repositories);
10071038
ksort($require);
10081039
}
1040+
10091041
/******************************************************************************/
10101042
// Generate commands.
10111043
/******************************************************************************/

src/Commands/WebformCommands.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,12 @@ public function drush_webform_libraries_make() {
161161
* Generates the Webform module's composer.json with libraries as repositories.
162162
*
163163
* @command webform:libraries:composer
164+
* @option disable-tls If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed.
164165
* @usage webform-libraries-composer
165166
* Generates the Webform module's composer.json with libraries as repositories.
166167
* @aliases wflc
167168
*/
168-
public function drush_webform_libraries_composer() {
169+
public function drush_webform_libraries_composer(array $options = ['disable-tls' => FALSE]) {
169170
$this->cliService->drush_webform_libraries_composer();
170171
}
171172

@@ -288,11 +289,12 @@ public function drush_webform_composer_update_validate(CommandData $commandData)
288289
* Updates the Drupal installation's composer.json to include the Webform module's selected libraries as repositories.
289290
*
290291
* @command webform:composer:update
292+
* @option disable-tls If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed.
291293
* @usage webform-composer-update
292294
* Updates the Drupal installation's composer.json to include the Webform module's selected libraries as repositories.
293295
* @aliases wfcu
294296
*/
295-
public function drush_webform_composer_update() {
297+
public function drush_webform_composer_update(array $options = ['disable-tls' => FALSE]) {
296298
$this->cliService->drush_webform_composer_update();
297299
}
298300

0 commit comments

Comments
 (0)