From 92bc81268796685c3e1a06ef80a2680e8c989a57 Mon Sep 17 00:00:00 2001 From: "Gurdeep Singh (Guru)" Date: Sat, 27 Jul 2024 18:32:53 +1000 Subject: [PATCH] -fix basepath for index and geo. --- src/Geo.php | 10 ++++++++-- src/Indexes.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Geo.php b/src/Geo.php index 2f01378..61b906f 100644 --- a/src/Geo.php +++ b/src/Geo.php @@ -200,8 +200,14 @@ protected function initStores() protected function checkGeoPath() { - if (!is_dir(fwbase_path($this->firewall->dataPath . 'geodata'))) { - if (!mkdir(fwbase_path($this->firewall->dataPath . 'geodata'), 0777, true)) { + if (str_contains(__DIR__, '/vendor/')) { + $dataPath = $this->firewall->dataPath . 'geodata'; + } else { + $dataPath = fwbase_path($this->firewall->dataPath . 'geodata'); + } + + if (!is_dir($dataPath)) { + if (!mkdir($dataPath, 0777, true)) { return false; } } diff --git a/src/Indexes.php b/src/Indexes.php index bd0ef64..2fdc58b 100644 --- a/src/Indexes.php +++ b/src/Indexes.php @@ -251,8 +251,14 @@ protected function deleteIndexes() protected function checkIndexesPath() { - if (!is_dir(fwbase_path($this->firewall->dataPath . 'indexes'))) { - if (!mkdir(fwbase_path($this->firewall->dataPath . 'indexes'), 0777, true)) { + if (str_contains(__DIR__, '/vendor/')) { + $dataPath = $this->firewall->dataPath . 'indexes'; + } else { + $dataPath = fwbase_path($this->firewall->dataPath . 'indexes'); + } + + if (!is_dir($dataPath)) { + if (!mkdir($dataPath, 0777, true)) { return false; } }