fix feedback for dxcc update

This commit is contained in:
HB9HIL
2024-07-21 17:47:09 +02:00
parent cba900e5dc
commit 2c1b3b65fb

View File

@@ -36,7 +36,9 @@ class Update extends CI_Controller {
public function dxcc_entities() {
// Load the cty file
$this->load->library('Paths');
if(!$this->load->is_loaded('Paths')) {
$this->load->library('Paths');
}
$xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml"));
//$xml_data->entities->entity->count();
@@ -87,7 +89,9 @@ class Update extends CI_Controller {
public function dxcc_exceptions() {
// Load the cty file
$this->load->library('Paths');
if(!$this->load->is_loaded('Paths')) {
$this->load->library('Paths');
}
$xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml"));
$count = 0;
@@ -129,7 +133,9 @@ class Update extends CI_Controller {
public function dxcc_prefixes() {
// Load the cty file
$this->load->library('Paths');
if(!$this->load->is_loaded('Paths')) {
$this->load->library('Paths');
}
$xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml"));
$count = 0;
@@ -169,7 +175,9 @@ class Update extends CI_Controller {
// Updates the DXCC & Exceptions from the Club Log Cty.xml file.
public function dxcc() {
$this->load->library('Paths');
if(!$this->load->is_loaded('Paths')) {
$this->load->library('Paths');
}
// set the last run in cron table for the correct cron id
$this->load->model('cron_model');
@@ -192,7 +200,7 @@ class Update extends CI_Controller {
if ($gz === FALSE) {
$this->update_status("FAILED: Could not download from clublog.org");
log_message('error', 'FAILED: Could not download exceptions from clublog.org');
return;
exit();
}
$data = "";
@@ -203,7 +211,7 @@ class Update extends CI_Controller {
if (file_put_contents($this->paths->make_update_path("cty.xml"), $data) === FALSE) {
$this->update_status("FAILED: Could not write to cty.xml file");
return;
exit();
}
// Clear the tables, ready for new data
@@ -220,21 +228,25 @@ class Update extends CI_Controller {
$this->db->trans_complete();
$this->update_status(__("DONE"));
echo 'success';
}
public function update_status($done=""){
$this->load->library('Paths');
if(!$this->load->is_loaded('Paths')) {
$this->load->library('Paths');
}
if ($done != "Downloading file"){
// Check that everything is done?
if ($done == ""){
$done = "Updating...";
$done = __("Updating...");
}
$html = $done."<br/>";
$html .= "Dxcc Entities: ".$this->db->count_all('dxcc_entities')."<br/>";
$html .= "Dxcc Exceptions: ".$this->db->count_all('dxcc_exceptions')."<br/>";
$html .= "Dxcc Prefixes: ".$this->db->count_all('dxcc_prefixes')."<br/>";
$html .= __("Dxcc Entities:")." ".$this->db->count_all('dxcc_entities')."<br/>";
$html .= __("Dxcc Exceptions:")." ".$this->db->count_all('dxcc_exceptions')."<br/>";
$html .= __("Dxcc Prefixes:")." ".$this->db->count_all('dxcc_prefixes')."<br/>";
} else {
$html = $done."....<br/>";
}