diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 3eaeabe..402d41e 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1908,9 +1908,9 @@ function install_check_translations($langcode, $server_pattern) { $readable = FALSE; $writable = FALSE; // @todo: Make this configurable. - $conf_path = \Drupal::service('site.path'); - $files_directory = $conf_path . '/files'; - $translations_directory = $conf_path . '/files/translations'; + $site_path = \Drupal::service('site.path'); + $files_directory = $site_path . '/files'; + $translations_directory = $site_path . '/files/translations'; $translations_directory_exists = FALSE; $translation_available = FALSE; $online = FALSE; @@ -2088,12 +2088,12 @@ function install_check_requirements($install_state) { foreach ($default_files as $default_file_info) { $readable = FALSE; $writable = FALSE; - $conf_path = './' . \Drupal::service('site.path'); - $file = $conf_path . "/{$default_file_info['file']}"; + $site_path = './' . \Drupal::service('site.path'); + $file = $site_path . "/{$default_file_info['file']}"; $default_file = "./sites/default/{$default_file_info['file_default']}"; $exists = FALSE; // Verify that the directory exists. - if (drupal_verify_install_file($conf_path, FILE_EXIST, 'dir')) { + if (drupal_verify_install_file($site_path, FILE_EXIST, 'dir')) { if (drupal_verify_install_file($file, FILE_EXIST)) { // If it does, make sure it is writable. $readable = drupal_verify_install_file($file, FILE_READABLE); @@ -2118,7 +2118,7 @@ function install_check_requirements($install_state) { // Otherwise, if $file does not exist yet, we can try to copy // $default_file to create it. elseif (!$exists) { - $copied = drupal_verify_install_file($conf_path, FILE_EXIST | FILE_WRITABLE, 'dir') && @copy($default_file, $file); + $copied = drupal_verify_install_file($site_path, FILE_EXIST | FILE_WRITABLE, 'dir') && @copy($default_file, $file); if ($copied) { // If the new $file file has the same owner as $default_file this means // $default_file is owned by the webserver user. This is an inherent diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 09472aa..aa260ef 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -15,8 +15,8 @@ function locale_install() { // Create the interface translations directory and ensure it's writable. if (!$directory = \Drupal::config('locale.settings')->get('translation.path')) { - $conf_path = \Drupal::service('site.path'); - $directory = $conf_path . '/files/translations'; + $site_path = \Drupal::service('site.path'); + $directory = $site_path . '/files/translations'; \Drupal::configFactory()->getEditable('locale.settings')->set('translation.path', $directory)->save(); } file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); diff --git a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php index ffda15b..08ae978 100644 --- a/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerExistingSettingsTest.php @@ -50,23 +50,17 @@ protected function setUp() { 'required' => TRUE, ); - // Find the site path. Kernel service is not always available at this point, - // but is preferred, when available. - if (\Drupal::hasService('kernel')) { - $conf_path = \Drupal::service('site.path'); - } - else { - $conf_path = DrupalKernel::findSitePath(Request::createFromGlobals()); - } - + // Use the kernel to find the site path because the site.path service should + // not be available at this point in the install process. + $site_path = DrupalKernel::findSitePath(Request::createFromGlobals()); // Pre-configure config directories. $this->settings['config_directories'] = array( CONFIG_ACTIVE_DIRECTORY => (object) array( - 'value' => $conf_path . '/files/config_active', + 'value' => $site_path . '/files/config_active', 'required' => TRUE, ), CONFIG_STAGING_DIRECTORY => (object) array( - 'value' => $conf_path . '/files/config_staging', + 'value' => $site_path . '/files/config_staging', 'required' => TRUE, ), ); diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 887111f..488db27 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -255,16 +255,16 @@ function system_requirements($phase) { // Find the site path. Kernel service is not always available at this point, // but is preferred, when available. if (\Drupal::hasService('kernel')) { - $conf_path = \Drupal::service('site.path'); + $site_path = \Drupal::service('site.path'); } else { - $conf_path = DrupalKernel::findSitePath(Request::createFromGlobals()); + $site_path = DrupalKernel::findSitePath(Request::createFromGlobals()); } - if (!drupal_verify_install_file($conf_path, FILE_NOT_WRITABLE, 'dir')) { - $conf_errors[] = t("The directory %file is not protected from modifications and poses a security risk. You must change the directory's permissions to be non-writable.", array('%file' => $conf_path)); + if (!drupal_verify_install_file($site_path, FILE_NOT_WRITABLE, 'dir')) { + $conf_errors[] = t("The directory %file is not protected from modifications and poses a security risk. You must change the directory's permissions to be non-writable.", array('%file' => $site_path)); } foreach (array('settings.php', 'settings.local.php', 'services.yml') as $conf_file) { - $full_path = $conf_path . '/' . $conf_file; + $full_path = $site_path . '/' . $conf_file; if (file_exists($full_path) && !drupal_verify_install_file($full_path, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE)) { $conf_errors[] = t("The file %file is not protected from modifications and poses a security risk. You must change the file's permissions to be non-writable.", array('%file' => $full_path)); } @@ -401,8 +401,8 @@ function system_requirements($phase) { // If we are installing Drupal, the settings.php file might not exist yet // in the intended site directory, so don't require it. $request = Request::createFromGlobals(); - $conf_path = DrupalKernel::findSitePath($request); - $directories[] = $conf_path . '/files'; + $site_path = DrupalKernel::findSitePath($request); + $directories[] = $site_path . '/files'; } if ($file_private_path = Settings::get('file_private_path')) { $directories[] = $file_private_path; @@ -429,7 +429,7 @@ function system_requirements($phase) { $requirements['config directories'] = array( 'title' => t('Configuration directories'), 'value' => t('Not present'), - 'description' => t('Your %file file must define the $config_directories variable as an array containing the name of a directories in which configuration files can be written.', array('%file' => $conf_path . '/settings.php')), + 'description' => t('Your %file file must define the $config_directories variable as an array containing the name of a directories in which configuration files can be written.', array('%file' => $site_path . '/settings.php')), 'severity' => REQUIREMENT_ERROR, ); } diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index 0d6d3d6..af86a9f 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -306,8 +306,8 @@ function update_manager_local_transfers_allowed() { // the configuration directory to determine if local transfers will be // allowed. $temporary_file = drupal_tempnam('temporary://', 'update_'); - $conf_path = \Drupal::service('site.path'); - $local_transfers_allowed = fileowner($temporary_file) === fileowner($conf_path); + $site_path = \Drupal::service('site.path'); + $local_transfers_allowed = fileowner($temporary_file) === fileowner($site_path); // Clean up. If this fails, we can ignore it (since this is just a temporary // file anyway).