From e929c620877767f1f99262b3d4c7bed75db02ce5 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 3 May 2024 11:14:52 +0200 Subject: [PATCH] added comments --- application/controllers/Clublog.php | 1 + application/controllers/Eqsl.php | 2 +- application/controllers/Hrdlog.php | 1 + application/controllers/Lotw.php | 1 + application/controllers/Qrz.php | 1 + application/controllers/Update.php | 7 +++++++ application/models/Cron_model.php | 8 ++++++++ application/views/interface_assets/footer.php | 1 + 8 files changed, 21 insertions(+), 1 deletion(-) diff --git a/application/controllers/Clublog.php b/application/controllers/Clublog.php index e40b9fd1e..ad61ec00a 100644 --- a/application/controllers/Clublog.php +++ b/application/controllers/Clublog.php @@ -25,6 +25,7 @@ class Clublog extends CI_Controller { public function upload() { $this->load->model('clublog_model'); + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index e801b1366..790a929d2 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -714,7 +714,7 @@ class eqsl extends CI_Controller { */ public function sync() { - $this->load->model('cron_model'); + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); diff --git a/application/controllers/Hrdlog.php b/application/controllers/Hrdlog.php index b798c963e..0a0b09bda 100644 --- a/application/controllers/Hrdlog.php +++ b/application/controllers/Hrdlog.php @@ -25,6 +25,7 @@ class Hrdlog extends CI_Controller { public function upload() { $this->setOptions(); + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index c879f0fc7..2bae0a643 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -198,6 +198,7 @@ class Lotw extends CI_Controller { echo "You must install php OpenSSL for LoTW functions to work"; } + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 3de9c0a3a..2f2ff77f7 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -69,6 +69,7 @@ class Qrz extends CI_Controller { public function upload() { $this->setOptions(); + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 9921ce059..d0c4acece 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -180,6 +180,7 @@ class Update extends CI_Controller { // Updates the DXCC & Exceptions from the Club Log Cty.xml file. public function dxcc() { + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); @@ -307,6 +308,7 @@ class Update extends CI_Controller { public function update_clublog_scp() { + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); @@ -358,6 +360,7 @@ class Update extends CI_Controller { public function lotw_users() { + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); @@ -419,6 +422,7 @@ class Update extends CI_Controller { */ public function update_dok() { + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); @@ -448,6 +452,7 @@ class Update extends CI_Controller { */ public function update_sota() { + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); @@ -495,6 +500,7 @@ class Update extends CI_Controller { */ public function update_wwff() { + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); @@ -543,6 +549,7 @@ class Update extends CI_Controller { public function update_pota() { + // set the last run in cron table for the correct cron id $this->load->model('cron_model'); $this->cron_model->set_last_run($this->router->class.'_'.$this->router->method); diff --git a/application/models/Cron_model.php b/application/models/Cron_model.php index 2b55711f7..c616382f3 100644 --- a/application/models/Cron_model.php +++ b/application/models/Cron_model.php @@ -2,6 +2,7 @@ class Cron_model extends CI_Model { + // get all crons from the database function get_crons() { $this->db->from('cron'); @@ -12,6 +13,7 @@ class Cron_model extends CI_Model return $results; } + // get details for a specific cron function cron($id) { $clean_id = $this->security->xss_clean($id); @@ -21,6 +23,7 @@ class Cron_model extends CI_Model return $this->db->get('cron'); } + // set the modified timestamp function set_modified($cron) { $data = array( 'modified' => date('Y-m-d H:i:s') @@ -30,6 +33,7 @@ class Cron_model extends CI_Model $this->db->update('cron', $data); } + // set a new status for the cron function set_status($cron, $status) { $data = array( 'status' => $status @@ -39,6 +43,7 @@ class Cron_model extends CI_Model $this->db->update('cron', $data); } + // set the last run function set_last_run($cron) { $data = array( 'last_run' => date('Y-m-d H:i:s') @@ -48,6 +53,7 @@ class Cron_model extends CI_Model $this->db->update('cron', $data); } + // set the calculated next run function set_next_run($cron,$timestamp) { $data = array( 'next_run' => $timestamp @@ -57,6 +63,7 @@ class Cron_model extends CI_Model $this->db->update('cron', $data); } + // set the cron enabled flag function set_cron_enabled($cron, $cron_enabled) { $data = array ( 'enabled' => ($cron_enabled === 'true' ? 1 : 0), @@ -69,6 +76,7 @@ class Cron_model extends CI_Model $this->set_modified($cron); } + // set the edited details for a cron function edit_cron($id, $description, $expression, $enabled) { $data = array ( diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 471ea7263..0882f62f7 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -106,6 +106,7 @@ if($this->session->userdata('user_id') != null) { + uri->segment(1) == "cron") { ?>