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

3
.gitignore vendored
View File

@@ -8,8 +8,7 @@
/uploads/*.tq8
/uploads/*.TQ8
/install/*
/updates/*.xml
/updates/*.html
/updates/*
/images/eqsl_card_images/*.jpg
/updates/clublog_scp.txt
/assets/qslcard/*

View File

@@ -97,6 +97,13 @@ class Lookup extends CI_Controller {
$arCalls[] = str_replace('0', 'Ø', $value);
}
}
} else {
$src = 'assets/ressources/clublog_scp.txt';
if (copy($src, $file)) {
$this->scp();
} else {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
sort($arCalls);

View File

@@ -455,7 +455,7 @@ class QSO extends CI_Controller {
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
$wwff = strtoupper($query);
$file = 'assets/json/wwff.txt';
$file = 'updates/wwff.txt';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
@@ -470,6 +470,13 @@ class QSO extends CI_Controller {
$json[] = ["name"=>$value];
}
}
} else {
$src = 'assets/ressources/wwff.txt';
if (copy($src, $file)) {
$this->get_wwff();
} else {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
}
@@ -484,7 +491,7 @@ class QSO extends CI_Controller {
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
$pota = strtoupper($query);
$file = 'assets/json/pota.txt';
$file = 'updates/pota.txt';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
@@ -499,6 +506,13 @@ class QSO extends CI_Controller {
$json[] = ["name"=>$value];
}
}
} else {
$src = 'assets/ressources/pota.txt';
if (copy($src, $file)) {
$this->get_pota();
} else {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
}
@@ -516,7 +530,7 @@ class QSO extends CI_Controller {
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
$dok = strtoupper($query);
$file = 'assets/json/dok.txt';
$file = 'updates/dok.txt';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
@@ -531,6 +545,13 @@ class QSO extends CI_Controller {
$json[] = ["name"=>$value];
}
}
} else {
$src = 'assets/ressources/dok.txt';
if (copy($src, $file)) {
$this->get_dok();
} else {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
}

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;

View File

@@ -47,7 +47,7 @@ class Update_model extends CI_Model {
if ($contents === FALSE) {
return "Something went wrong with fetching the DOK file.";
} else {
$file = './assets/json/dok.txt';
$file = './updates/dok.txt';
if (file_put_contents($file, $contents) !== FALSE) { // Save our content to the file.
$nCount = count(file($file));
@@ -69,7 +69,7 @@ class Update_model extends CI_Model {
$csvfile = 'https://www.sotadata.org.uk/summitslist.csv';
$sotafile = './assets/json/sota.txt';
$sotafile = './updates/sota.txt';
$csvhandle = fopen($csvfile, "r");
if ($csvhandle === FALSE) {
@@ -110,7 +110,7 @@ class Update_model extends CI_Model {
$csvfile = 'https://wwff.co/wwff-data/wwff_directory.csv';
$wwfffile = './assets/json/wwff.txt';
$wwfffile = './updates/wwff.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $csvfile);
@@ -155,7 +155,7 @@ class Update_model extends CI_Model {
$csvfile = 'https://pota.app/all_parks.csv';
$potafile = './assets/json/pota.txt';
$potafile = './updates/pota.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $csvfile);