moved make_update_path to paths library

This commit is contained in:
HB9HIL
2024-05-05 10:05:48 +02:00
parent 38b119f0c1
commit 33d7e28275
4 changed files with 24 additions and 24 deletions

View File

@@ -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."....<br/>";
}
file_put_contents($this->genfunctions->make_update_path("status.html"), $html);
file_put_contents($this->paths->make_update_path("status.html"), $html);
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);