Added HoN to Debug-Page and cronmanager

This commit is contained in:
int2001
2025-03-23 08:35:45 +00:00
parent f4e93a11a4
commit 2a1defdb1e
4 changed files with 43 additions and 7 deletions

View File

@@ -111,6 +111,7 @@ class Debug extends CI_Controller
$data['sota_update'] = $this->cron_model->cron('update_update_sota')->row();
$data['wwff_update'] = $this->cron_model->cron('update_update_wwff')->row();
$data['tle_update'] = $this->cron_model->cron('update_update_tle')->row();
$data['hon_update'] = $this->cron_model->cron('update_update_hamsofnote')->row();
$data['page_title'] = __("Debug");

View File

@@ -490,12 +490,18 @@ class Update extends CI_Controller {
}
public function update_hamsofnote() {
$this->load->model('Update_model');
$bodyData['hamsofnote'] = $this->Update_model->update_hams_of_note();
$data['page_title'] = __("Update of Hams of Note");
$this->load->view('interface_assets/header', $data);
$this->load->view('update/hamsofnote', $bodyData);
$this->load->view('interface_assets/footer');
$this->load->model('cron_model');
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
$this->load->model('Update_model');
$bodyData['hamsofnote'] = $this->Update_model->update_hams_of_note();
if ($this->session->userdata('user_type') == '99') {
$data['page_title'] = __("Update of Hams of Note");
$this->load->view('interface_assets/header', $data);
$this->load->view('update/hamsofnote', $bodyData);
$this->load->view('interface_assets/footer');
} else {
echo $bodyData['hamsofnote'];
}
}
function version_check() {

View File

@@ -42,11 +42,35 @@ class Migration_add_hams_of_note extends CI_Migration
$this->dbforge->create_table('hams_of_note');
$this->db->query("ALTER TABLE hams_of_note ADD INDEX `callsign` (`callsign`)");
}
if ($this->chk4cron('update_update_hon') == 0) {
$data = array(
array(
'id' => 'update_update_hamsofnote',
'enabled' => '0',
'status' => 'disabled',
'description' => 'Update Hams Of Notes',
'function' => 'index.php/update/update_hamsofnote',
'expression' => '45 4 * * *',
'last_run' => null,
'next_run' => null
));
$this->db->insert_batch('cron', $data);
}
}
public function down() {
if ($this->chk4cron('update_update_hamsofnote') > 0) {
$this->db->query("delete from cron where id='update_update_hamsofnote'");
}
if ($this->db->table_exists('hams_of_note')) {
$this->dbforge->drop_table('hams_of_note');
}
}
function chk4cron($cronkey) {
$query = $this->db->query("select count(id) as cid from cron where id=?",$cronkey);
$row = $query->row();
return $row->cid ?? 0;
}
}

View File

@@ -554,11 +554,16 @@
<td><?php echo $wwff_update->last_run ?? __("never"); ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_wwff'); ?>"><?= __("Update"); ?></a></td>
</tr>
<tr>
<tr>
<td><?= __("TLE update"); ?></td>
<td><?php echo $tle_update->last_run ?? __("never"); ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_tle'); ?>"><?= __("Update"); ?></a></td>
</tr>
<tr>
<td><?= __("Hams Of Note update"); ?></td>
<td><?php echo $hon_update->last_run ?? __("never"); ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_hamsofnote'); ?>"><?= __("Update"); ?></a></td>
</tr>
</table>
</div>
</div>