Merge pull request #1193 from AndreasK79/uploadpath

@mattmelling configurable updates folder
pull/1218/head
Andreas Kristiansen 2021-09-22 14:21:36 +02:00 zatwierdzone przez GitHub
commit b5ac0952ed
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 24 dodań i 7 usunięć

Wyświetl plik

@ -19,6 +19,8 @@ $config['directory'] = "logbook";
$config['callbook'] = "hamqth"; // Options are hamqth or qrz
$config['datadir'] = null; // default to install directory
/*
|--------------------------------------------------------------------------
| Logbook Options

Wyświetl plik

@ -17,6 +17,19 @@ class Update extends CI_Controller {
}
/*
* Create a path to a file in the updates folder, respecting the datadir
* configuration option.
*/
private function make_update_path($path) {
$path = "updates/" . $path;
$datadir = $this->config->item('datadir');
if(!$datadir) {
return $path;
}
return $datadir . "/" . $path;
}
/*
* Load the dxcc entities
*/
@ -25,7 +38,7 @@ class Update extends CI_Controller {
$this->load->model('dxcc_entities');
// Load the cty file
$xml_data = simplexml_load_file("updates/cty.xml");
$xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
//$xml_data->entities->entity->count();
@ -74,7 +87,7 @@ class Update extends CI_Controller {
// Load Database connectors
$this->load->model('dxcc_exceptions');
// Load the cty file
$xml_data = simplexml_load_file("updates/cty.xml");
$xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
$count = 0;
foreach ($xml_data->exceptions->exception as $record) {
@ -114,7 +127,7 @@ class Update extends CI_Controller {
// Load Database connectors
$this->load->model('dxcc_prefixes');
// Load the cty file
$xml_data = simplexml_load_file("updates/cty.xml");
$xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
$count = 0;
foreach ($xml_data->prefixes->prefix as $record) {
@ -169,8 +182,8 @@ class Update extends CI_Controller {
$data .= gzgetc($gz);
}
gzclose($gz);
file_put_contents('./updates/cty.xml', $data);
file_put_contents($this->make_update_path("cty.xml"), $data);
// Clear the tables, ready for new data
$this->db->empty_table("dxcc_entities");
@ -203,7 +216,7 @@ class Update extends CI_Controller {
$html = $done."....<br/>";
}
file_put_contents('./updates/status.html', $html);
file_put_contents($this->make_update_path("status.html"), $html);
}
@ -231,7 +244,7 @@ class Update extends CI_Controller {
}
public function update_clublog_scp() {
$strFile = "./updates/clublog_scp.txt";
$strFile = $this->make_update_path("clublog_scp.txt");
$url = "https://cdn.clublog.org/clublog.scp.gz";
set_time_limit(300);
$this->update_status("Downloading Club Log SCP file");

Wyświetl plik

@ -18,6 +18,8 @@ $config['app_version'] = "1.7";
$config['directory'] = "%directory%";
$config['callbook'] = "hamqth"; // Options are hamqth or qrz
$config['datadir'] = null; // default to install directory
/*
|--------------------------------------------------------------------------
| Logbook Options