Skip to content

Commit

Permalink
-fix basepath for index and geo.
Browse files Browse the repository at this point in the history
  • Loading branch information
oyeaussie committed Jul 27, 2024
1 parent b525f78 commit 92bc812
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/Geo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/Indexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 92bc812

Please sign in to comment.