From 1b8dea09d220e4ee43e59a57e1473dad0e7f1440 Mon Sep 17 00:00:00 2001 From: xjm Date: Wed, 22 Nov 2017 16:29:01 -0600 Subject: [PATCH] =?UTF-8?q?Issue=20#2907863=20by=20tucho,=20Sutharsan,=20G?= =?UTF-8?q?=C3=A1bor=20Hojtsy:=20Prefer=20HTTPS=20protocol=20over=20HTTP?= =?UTF-8?q?=20when=20fetching=20translations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../locale/config/install/locale.settings.yml | 2 +- core/modules/locale/locale.install | 12 ++++++++++++ core/modules/locale/locale.module | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/modules/locale/config/install/locale.settings.yml b/core/modules/locale/config/install/locale.settings.yml index 857a36935172..a6cd4f30439d 100644 --- a/core/modules/locale/config/install/locale.settings.yml +++ b/core/modules/locale/config/install/locale.settings.yml @@ -5,7 +5,7 @@ javascript: translation: use_source: remote_and_local default_filename: '%project-%version.%language.po' - default_server_pattern: 'http://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po' + default_server_pattern: 'https://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po' overwrite_customized: false overwrite_not_customized: true update_interval_days: 0 diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index f85b8599f9e5..4c49c3c1bcfb 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -304,3 +304,15 @@ function locale_update_8300() { // the new key value collection. \Drupal::state()->delete('locale.translation_status'); } + +/** + * Update default server pattern value to use https. + */ +function locale_update_8500() { + $update_url = \Drupal::config('locale.settings')->get('translation.default_server_pattern'); + if ($update_url == 'http://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po') { + \Drupal::configFactory()->getEditable('locale.settings') + ->set('translation.default_server_pattern', 'https://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po') + ->save(); + } +} diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index b1298e4b679e..9e424484b80e 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -99,7 +99,7 @@ const LOCALE_TRANSLATION_USE_SOURCE_REMOTE_AND_LOCAL = 'remote_and_local'; * * @see locale_translation_default_translation_server(). */ -const LOCALE_TRANSLATION_DEFAULT_SERVER_PATTERN = 'http://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po'; +const LOCALE_TRANSLATION_DEFAULT_SERVER_PATTERN = 'https://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po'; /** * The number of seconds that the translations status entry should be considered.