diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php index 71ff3f2..4399da6 100644 --- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php @@ -52,15 +52,23 @@ public function load($name) { * Implements Drupal\Component\PhpStorage\PhpStorageInterface::save(). */ public function save($name, $code) { - $path = $this->getFullPath($name); - $directory = dirname($path); - if ($this->ensureDirectory($directory)) { - $htaccess_path = $directory . '/.htaccess'; - if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) { - @chmod($htaccess_path, 0444); + if (\Drupal::lock()->acquire($name)) { + $path = $this->getFullPath($name); + $directory = dirname($path); + if ($this->ensureDirectory($directory)) { + $htaccess_path = $directory . '/.htaccess'; + if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, static::htaccessLines())) { + @chmod($htaccess_path, 0444); + } } + + $ok = (bool) file_put_contents($path, $code); + \Drupal::lock()->release($name); + + return $ok; } - return (bool) file_put_contents($path, $code); + + return FALSE; } /**