path and copy adjustments

This commit is contained in:
HB9HIL
2024-07-11 23:01:12 +02:00
parent d6bd6fb76c
commit cddfde17b7
7 changed files with 60 additions and 12 deletions

View File

@@ -15,7 +15,7 @@ class Pota
$json = [];
$ref = strtoupper($query);
$file = 'assets/json/pota.txt';
$file = 'updates/pota.txt';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
@@ -29,6 +29,13 @@ class Pota
$json[] = ["name" => $value];
}
}
} else {
$src = 'assets/ressources/pota.txt';
if (copy($src, $file)) {
$this->get($query);
} else {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
return $json;

View File

@@ -15,7 +15,7 @@ class Sota
$json = [];
$ref = strtoupper($query);
$file = 'assets/json/sota.txt';
$file = 'updates/sota.txt';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
@@ -29,6 +29,13 @@ class Sota
$json[] = ["name" => $value];
}
}
} else {
$src = 'assets/ressources/sota.txt';
if (copy($src, $file)) {
$this->get($query);
} else {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
return $json;

View File

@@ -15,7 +15,7 @@ class Wwff
$json = [];
$ref = strtoupper($query);
$file = 'assets/json/wwff.txt';
$file = 'updates/wwff.txt';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
@@ -29,6 +29,13 @@ class Wwff
$json[] = ["name" => $value];
}
}
} else {
$src = 'assets/ressources/wwff.txt';
if (copy($src, $file)) {
$this->get($query);
} else {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
return $json;