diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php index d588af4..38e99a3 100644 --- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php @@ -13,6 +13,19 @@ class FileStorage implements PhpStorageInterface { /** + * The file mode for the directory created save(). + */ + const directoryMode = 0777; + + /** + * Whether directoryMode should obey umask(). + */ + const umask = TRUE; + + /** + * + + /** * The directory where the files should be stored. * * @var string @@ -55,7 +68,11 @@ public function save($name, $code) { $path = $this->getFullPath($name); $dir = dirname($path); if (!file_exists($dir)) { - mkdir($dir, 0700, TRUE); + $mode = static::directoryMode; + if (static::umask) { + $mode = $mode & umask(); + } + mkdir($dir, $mode, TRUE); } return (bool) file_put_contents($path, $code); }