diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 81421665c..b355b0342 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -36,8 +36,8 @@ class Update extends CI_Controller { public function dxcc_entities() { // Load the cty file - $this->load->library('Genfunctions'); - $xml_data = simplexml_load_file($this->genfunctions->make_update_path("cty.xml")); + $this->load->library('Paths'); + $xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml")); //$xml_data->entities->entity->count(); @@ -87,8 +87,8 @@ class Update extends CI_Controller { public function dxcc_exceptions() { // Load the cty file - $this->load->library('Genfunctions'); - $xml_data = simplexml_load_file($this->genfunctions->make_update_path("cty.xml")); + $this->load->library('Paths'); + $xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml")); $count = 0; $a_data=[]; @@ -129,8 +129,8 @@ class Update extends CI_Controller { public function dxcc_prefixes() { // Load the cty file - $this->load->library('Genfunctions'); - $xml_data = simplexml_load_file($this->genfunctions->make_update_path("cty.xml")); + $this->load->library('Paths'); + $xml_data = simplexml_load_file($this->paths->make_update_path("cty.xml")); $count = 0; $a_data=[]; @@ -169,7 +169,7 @@ class Update extends CI_Controller { // Updates the DXCC & Exceptions from the Club Log Cty.xml file. public function dxcc() { - $this->load->library('Genfunctions'); + $this->load->library('Paths'); // set the last run in cron table for the correct cron id $this->load->model('cron_model'); @@ -201,7 +201,7 @@ class Update extends CI_Controller { } gzclose($gz); - if (file_put_contents($this->genfunctions->make_update_path("cty.xml"), $data) === FALSE) { + 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; } @@ -224,7 +224,7 @@ class Update extends CI_Controller { public function update_status($done=""){ - $this->load->library('Genfunctions'); + $this->load->library('Paths'); if ($done != "Downloading file"){ // Check that everything is done? @@ -239,7 +239,7 @@ class Update extends CI_Controller { $html = $done."....
"; } - file_put_contents($this->genfunctions->make_update_path("status.html"), $html); + file_put_contents($this->paths->make_update_path("status.html"), $html); } diff --git a/application/libraries/Genfunctions.php b/application/libraries/Genfunctions.php index ec9fe87c6..71315b771 100644 --- a/application/libraries/Genfunctions.php +++ b/application/libraries/Genfunctions.php @@ -111,16 +111,4 @@ class Genfunctions } } - function make_update_path($path) { - - $CI = & get_instance(); - - $path = "updates/" . $path; - $datadir = $CI->config->item('datadir'); - if(!$datadir) { - return $path; - } - return $datadir . "/" . $path; - } - } diff --git a/application/libraries/Paths.php b/application/libraries/Paths.php index 35e69919b..9d4d262aa 100644 --- a/application/libraries/Paths.php +++ b/application/libraries/Paths.php @@ -20,4 +20,16 @@ class Paths $CI->load->model('Qsl_model'); return $CI->Qsl_model->get_imagePath(); } + + function make_update_path($path) { + + $CI = & get_instance(); + + $path = "updates/" . $path; + $datadir = $CI->config->item('datadir'); + if(!$datadir) { + return $path; + } + return $datadir . "/" . $path; + } } diff --git a/application/models/Update_model.php b/application/models/Update_model.php index a71836764..6e54a3a19 100644 --- a/application/models/Update_model.php +++ b/application/models/Update_model.php @@ -6,11 +6,11 @@ class Update_model extends CI_Model { function clublog_scp() { // set the last run in cron table for the correct cron id $this->load->model('cron_model'); - $this->load->library('Genfunctions'); + $this->load->library('Paths'); $this->cron_model->set_last_run($this->router->class . '_' . $this->router->method); - $strFile = $this->genfunctions->make_update_path("clublog_scp.txt"); + $strFile = $this->paths->make_update_path("clublog_scp.txt"); $url = "https://cdn.clublog.org/clublog.scp.gz"; set_time_limit(300);