diff --cc core/includes/file.inc index c78ee5b,00ae442..0000000 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@@ -348,8 -444,17 +348,22 @@@ function file_ensure_htaccess() * if one is already present. Defaults to FALSE. */ function file_save_htaccess($directory, $private = TRUE, $force_overwrite = FALSE) { ++<<<<<<< 293339b8b9119fbf9796e3956206ee00b13c9f09 + if (\Drupal::service('file_system')->uriScheme($directory)) { + $htaccess_path = file_stream_wrapper_uri_normalize($directory . '/.htaccess'); ++======= + if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')) { + $server_is_iis = TRUE; + $htaccess_filename = 'web.config'; + } + else { + $server_is_iis = FALSE; + $htaccess_filename = '.htaccess'; + } + + if (file_uri_scheme($directory)) { + $htaccess_path = file_stream_wrapper_uri_normalize($directory . DIRECTORY_SEPARATOR . $htaccess_filename); ++>>>>>>> Apply web-config-for-iis-drupal8-1543392-20.patch } else { $directory = rtrim($directory, '/\\'); @@@ -367,8 -472,8 +381,13 @@@ return drupal_chmod($htaccess_path, 0444); } else { ++<<<<<<< 293339b8b9119fbf9796e3956206ee00b13c9f09 + $variables = ['%directory' => $directory, '@htaccess' => $htaccess_lines]; + \Drupal::logger('security')->error("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines:
@htaccess", $variables);
++=======
+ $variables = array('%directory' => $directory, '!htaccess' => '!htaccess", $variables);
++>>>>>>> Apply web-config-for-iis-drupal8-1543392-20.patch
return FALSE;
}
}
diff --cc core/lib/Drupal/Component/PhpStorage/FileStorage.php
index e82ec2d,583f4a2..0000000
--- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php
+++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php
@@@ -49,7 -54,20 +49,24 @@@ class FileStorage implements PhpStorage
public function save($name, $code) {
$path = $this->getFullPath($name);
$directory = dirname($path);
++<<<<<<< 293339b8b9119fbf9796e3956206ee00b13c9f09
+ $this->ensureDirectory($directory);
++=======
+ if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'IIS')) {
+ $server_is_iis = TRUE;
+ $htaccess_filename = 'web.config';
+ }
+ else {
+ $server_is_iis = FALSE;
+ $htaccess_filename = '.htaccess';
+ }
+ if ($this->ensureDirectory($directory)) {
+ $htaccess_path = $directory . DIRECTORY_SEPARATOR . $htaccess_filename;
+ if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, ($server_is_iis) ? static::webconfigLines() : static::htaccessLines())) {
+ @chmod($htaccess_path, 0444);
+ }
+ }
++>>>>>>> Apply web-config-for-iis-drupal8-1543392-20.patch
return (bool) file_put_contents($path, $code);
}