mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added cron job and debug button
This commit is contained in:
@@ -113,6 +113,7 @@ class Debug extends CI_Controller
|
||||
$data['tle_update'] = $this->cron_model->cron('update_update_tle')->row();
|
||||
$data['hon_update'] = $this->cron_model->cron('update_update_hamsofnote')->row();
|
||||
$data['hamqsl_update'] = $this->cron_model->cron('update_update_hamqsl')->row();
|
||||
$data['vucc_grids_update'] = $this->cron_model->cron('update_update_vucc_grids')->row();
|
||||
|
||||
$data['page_title'] = __("Debug");
|
||||
|
||||
|
||||
@@ -706,6 +706,10 @@ class Update extends CI_Controller {
|
||||
}
|
||||
|
||||
public function update_vucc_grids() {
|
||||
// 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);
|
||||
|
||||
$this->load->model('Update_model');
|
||||
$this->Update_model->update_vucc_grids();
|
||||
}
|
||||
|
||||
@@ -18,12 +18,31 @@ class Migration_add_grid_country extends CI_Migration {
|
||||
);";
|
||||
|
||||
$this->dbtry($sql);
|
||||
|
||||
if ($this->chk4cron('vucc_grid_file') == 0) {
|
||||
$data = array(
|
||||
array(
|
||||
'id' => 'vucc_grid_file',
|
||||
'enabled' => '0',
|
||||
'status' => 'disabled',
|
||||
'description' => 'Update TQSL VUCC Grids file',
|
||||
'function' => 'index.php/update/update_vucc_grids',
|
||||
'expression' => '45 4 * * *',
|
||||
'last_run' => null,
|
||||
'next_run' => null
|
||||
));
|
||||
$this->db->insert_batch('cron', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$sql = "DROP TABLE IF EXISTS vuccgrids;";
|
||||
$this->dbtry($sql);
|
||||
|
||||
if ($this->chk4cron('vucc_grid_file') > 0) {
|
||||
$this->db->query("delete from cron where id='vucc_grid_file'");
|
||||
}
|
||||
}
|
||||
|
||||
function dbtry($what) {
|
||||
@@ -33,4 +52,11 @@ class Migration_add_grid_country extends CI_Migration {
|
||||
log_message("error", "Something gone wrong while altering a table: ".$e." // Executing: ".$this->db->last_query());
|
||||
}
|
||||
}
|
||||
|
||||
function chk4cron($cronkey) {
|
||||
$query = $this->db->query("select count(id) as cid from cron where id=?",$cronkey);
|
||||
$row = $query->row();
|
||||
return $row->cid ?? 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -568,6 +568,11 @@
|
||||
<td><?= __("HAMqsl"); ?></td>
|
||||
<td><?php echo $hamqsl_update->last_run ?? __("never"); ?></td>
|
||||
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_hamqsl'); ?>"><?= __("Update"); ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?= __("VUCCGrids"); ?></td>
|
||||
<td><?php echo $vuccgrids_update->last_run ?? __("never"); ?></td>
|
||||
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_vucc_grids'); ?>"><?= __("Update"); ?></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user