From ffc93a77a9d97e68e2cb302042dbb7f7a8ae197d Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 18 Dec 2020 20:53:38 +0200 Subject: [PATCH] Make it possible to use an absolute path when loading a blueprint --- CHANGELOG.md | 2 ++ system/src/Grav/Common/Data/Blueprint.php | 4 ++++ system/src/Grav/Framework/File/AbstractFile.php | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a2c925ac..8ceba23d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ 1. [](#new) * Added support for overriding configuration by using environment variables +1. [](#improved) + * Make it possible to use an absolute path when loading a blueprint 1. [](#bugfix) * Fixed port issue with `system.custom_base_url` diff --git a/system/src/Grav/Common/Data/Blueprint.php b/system/src/Grav/Common/Data/Blueprint.php index addc62a9e..bc6332a34 100644 --- a/system/src/Grav/Common/Data/Blueprint.php +++ b/system/src/Grav/Common/Data/Blueprint.php @@ -371,6 +371,10 @@ class Blueprint extends BlueprintForm $locator = Grav::instance()['locator']; if (is_string($path) && !$locator->isStream($path)) { + if (is_file($path)) { + return [$path]; + } + // Find path overrides. if (null === $context) { $paths = (array) ($this->overrides[$path] ?? null); diff --git a/system/src/Grav/Framework/File/AbstractFile.php b/system/src/Grav/Framework/File/AbstractFile.php index fe4b20332..b4fc0ee88 100644 --- a/system/src/Grav/Framework/File/AbstractFile.php +++ b/system/src/Grav/Framework/File/AbstractFile.php @@ -208,7 +208,7 @@ class AbstractFile implements FileInterface } if ($this->locked) { - flock($this->handle, LOCK_UN); + flock($this->handle, LOCK_UN | LOCK_NB); $this->locked = false; }