changed last_run function to be more generic

This commit is contained in:
HB9HIL
2024-04-26 15:07:54 +02:00
parent 2e24330cc8
commit f2163cb2ba
7 changed files with 25 additions and 24 deletions

View File

@@ -26,7 +26,7 @@ class Clublog extends CI_Controller {
$this->load->model('clublog_model');
$this->load->model('cron_model');
$this->cron_model->set_last_run('upload_clublog');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$users = $this->clublog_model->get_clublog_users();

View File

@@ -715,7 +715,8 @@ class eqsl extends CI_Controller {
public function sync() {
$this->load->model('cron_model');
$this->cron_model->set_last_run('sync_eqsl');
$this->load->model('cron_model');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
ini_set('memory_limit', '-1');
set_time_limit(0);

View File

@@ -26,7 +26,7 @@ class Hrdlog extends CI_Controller {
$this->setOptions();
$this->load->model('cron_model');
$this->cron_model->set_last_run('upload_hrd');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$this->load->model('logbook_model');

View File

@@ -199,7 +199,7 @@ class Lotw extends CI_Controller {
}
$this->load->model('cron_model');
$this->cron_model->set_last_run('upload_lotw');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
// Get Station Profile Data
$this->load->model('Stations');

View File

@@ -30,7 +30,7 @@ class Qrz extends CI_Controller {
$this->setOptions();
$this->load->model('cron_model');
$this->cron_model->set_last_run('upload_qrz');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$this->load->model('logbook_model');
@@ -216,7 +216,7 @@ class Qrz extends CI_Controller {
$this->load->model('logbook_model');
$this->load->model('cron_model');
$this->cron_model->set_last_run('download_qrz');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$api_keys = $this->logbook_model->get_qrz_apikeys();

View File

@@ -307,7 +307,7 @@ class Update extends CI_Controller {
public function update_clublog_scp() {
$this->load->model('cron_model');
$this->cron_model->set_last_run('clublog_scp');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$strFile = $this->make_update_path("clublog_scp.txt");
$url = "https://cdn.clublog.org/clublog.scp.gz";
@@ -361,7 +361,7 @@ class Update extends CI_Controller {
public function lotw_users() {
$this->load->model('cron_model');
$this->cron_model->set_last_run('lotw_activity');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$mtime = microtime();
$mtime = explode(" ",$mtime);
@@ -425,7 +425,7 @@ class Update extends CI_Controller {
public function update_dok() {
$this->load->model('cron_model');
$this->cron_model->set_last_run('update_dok');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$contents = file_get_contents('https://www.df2et.de/cqrlog/dok_and_sdok.txt', true);
@@ -457,7 +457,7 @@ class Update extends CI_Controller {
public function update_sota() {
$this->load->model('cron_model');
$this->cron_model->set_last_run('update_sota');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$csvfile = 'https://www.sotadata.org.uk/summitslist.csv';
@@ -507,7 +507,7 @@ class Update extends CI_Controller {
public function update_wwff() {
$this->load->model('cron_model');
$this->cron_model->set_last_run('update_wwff');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$csvfile = 'https://wwff.co/wwff-data/wwff_directory.csv';
@@ -558,7 +558,7 @@ class Update extends CI_Controller {
public function update_pota() {
$this->load->model('cron_model');
$this->cron_model->set_last_run('update_pota');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$csvfile = 'https://pota.app/all_parks.csv';

View File

@@ -58,18 +58,18 @@ class Migration_cron_table extends CI_Migration {
$this->dbforge->create_table('cron');
$data = array(
array('id' => 'upload_clublog', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to Clublog', 'function' => 'index.php/clublog/upload', 'expression' => '3 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'upload_lotw', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to LoTW', 'function' => 'index.php/lotw/lotw_upload', 'expression' => '0 */1 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'upload_qrz', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to QRZ', 'function' => 'index.php/qrz/upload', 'expression' => '6 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'download_qrz', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Download QSOs from QRZ', 'function' => 'index.php/qrz/download', 'expression' => '18 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'upload_hrd', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to HRD', 'function' => 'index.php/hrdlog/upload', 'expression' => '12 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'sync_eqsl', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload/download QSOs to/from Eqsl', 'function' => 'index.php/eqsl/sync', 'expression' => '9 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'lotw_activity', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update LOTW Users Activity', 'function' => 'index.php/update/lotw_users', 'expression' => '10 1 * * 1', 'last_run' => null, 'next_run' => null ),
array('id' => 'clublog_scp', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update Clublog SCP Database File', 'function' => 'index.php/update/update_clublog_scp', 'expression' => '0 0 * * 0', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_dok', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update DOK File', 'function' => 'index.php/update/update_dok', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_sota', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update SOTA File', 'function' => 'index.php/update/update_sota', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_wwff', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update WWFF File', 'function' => 'index.php/update/update_wwff', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_pota', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update POTA File', 'function' => 'index.php/update/update_pota', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'clublog_upload', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to Clublog', 'function' => 'index.php/clublog/upload', 'expression' => '3 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'lotw_lotw_upload', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to LoTW', 'function' => 'index.php/lotw/lotw_upload', 'expression' => '0 */1 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'qrz_upload', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to QRZ', 'function' => 'index.php/qrz/upload', 'expression' => '6 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'qrz_download', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Download QSOs from QRZ', 'function' => 'index.php/qrz/download', 'expression' => '18 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'hrdlog_upload', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload QSOs to HRD', 'function' => 'index.php/hrdlog/upload', 'expression' => '12 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'eqsl_sync', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Upload/download QSOs to/from Eqsl', 'function' => 'index.php/eqsl/sync', 'expression' => '9 */6 * * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_lotw_users', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update LOTW Users Activity', 'function' => 'index.php/update/lotw_users', 'expression' => '10 1 * * 1', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_update_clublog_scp', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update Clublog SCP Database File', 'function' => 'index.php/update/update_clublog_scp', 'expression' => '0 0 * * 0', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_update_dok', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update DOK File', 'function' => 'index.php/update/update_dok', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_update_sota', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update SOTA File', 'function' => 'index.php/update/update_sota', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_update_wwff', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update WWFF File', 'function' => 'index.php/update/update_wwff', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
array('id' => 'update_update_pota', 'enabled' => '1', 'status' => 'healthy', 'description' => 'Update POTA File', 'function' => 'index.php/update/update_pota', 'expression' => '0 0 1 * *', 'last_run' => null, 'next_run' => null ),
);
$this->db->insert_batch('cron', $data);