mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Check for existance of cron-job
This commit is contained in:
@@ -10,18 +10,20 @@ class Migration_clublog_recvd extends CI_Migration {
|
||||
);
|
||||
$this->dbforge->add_column($this->config->item('table_name'), $fields);
|
||||
}
|
||||
$data = array(
|
||||
array(
|
||||
'id' => 'clublog_download',
|
||||
'enabled' => '0',
|
||||
'status' => 'pending',
|
||||
'description' => 'Download QSOs from Clublog',
|
||||
'function' => 'index.php/clublog/download',
|
||||
'expression' => '7 00 * * *',
|
||||
'last_run' => null,
|
||||
'next_run' => null
|
||||
));
|
||||
if ($this->chk4cron('clublog_download') == 0) {
|
||||
$data = array(
|
||||
array(
|
||||
'id' => 'clublog_download',
|
||||
'enabled' => '0',
|
||||
'status' => 'pending',
|
||||
'description' => 'Download QSOs from Clublog',
|
||||
'function' => 'index.php/clublog/download',
|
||||
'expression' => '7 00 * * *',
|
||||
'last_run' => null,
|
||||
'next_run' => null
|
||||
));
|
||||
$this->db->insert_batch('cron', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function down() {
|
||||
@@ -31,5 +33,14 @@ class Migration_clublog_recvd extends CI_Migration {
|
||||
if ($this->db->field_exists('COL_CLUBLOG_QSO_DOWNLOAD_STATUS', $this->config->item('table_name'))) {
|
||||
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_CLUBLOG_QSO_DOWNLOAD_STATUS');
|
||||
}
|
||||
if ($this->chk4cron('clublog_download') > 0) {
|
||||
$this->db->query("delete from cron where id='clublog_download'");
|
||||
}
|
||||
}
|
||||
|
||||
function chk4cron($cronkey) {
|
||||
$query = $this->db->query("select count(id) as cid from cron where id=?",$cronkey);
|
||||
$row = $query->row();
|
||||
return $row->cid ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user