From 2a08c75bb628c590c1987d2ce663ea8f87e93b33 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Tue, 8 Aug 2023 15:17:27 -0400 Subject: [PATCH 1/2] use appropriate store directory --- src/Globals/Variables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Globals/Variables.php b/src/Globals/Variables.php index 10757f4efd5..6d991970c0c 100644 --- a/src/Globals/Variables.php +++ b/src/Globals/Variables.php @@ -74,7 +74,7 @@ public function title() public function path() { return vsprintf('%s/%s%s.%s', [ - rtrim(Stache::store('globals')->directory(), '/'), + rtrim(Stache::store('global-variables')->directory(), '/'), Site::hasMultiple() ? $this->locale().'/' : '', $this->handle(), 'yaml', From e4dd8ddc61d48a60b586116b0dc13b24514970bb Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Tue, 8 Aug 2023 15:17:47 -0400 Subject: [PATCH 2/2] throw exception --- src/Stache/Stores/GlobalsStore.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Stache/Stores/GlobalsStore.php b/src/Stache/Stores/GlobalsStore.php index aafdf2f01b6..205082b544d 100644 --- a/src/Stache/Stores/GlobalsStore.php +++ b/src/Stache/Stores/GlobalsStore.php @@ -4,6 +4,7 @@ use Statamic\Facades\GlobalSet; use Statamic\Facades\Path; +use Statamic\Facades\Stache; use Statamic\Facades\YAML; use Statamic\Support\Arr; use Symfony\Component\Finder\SplFileInfo; @@ -15,6 +16,15 @@ public function key() return 'globals'; } + public function paths() + { + if ($this->directory !== Stache::store('global-variables')->directory()) { + throw new \Exception('The [globals] and [global-variables] Stache stores must share the same directory.'); + } + + return parent::paths(); + } + public function getItemFilter(SplFileInfo $file) { // The global sets themselves should only exist in the root