mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
HamQSL
This commit is contained in:
@@ -542,25 +542,41 @@ class Update extends CI_Controller {
|
||||
/*
|
||||
* Pulls the solarxml.php data from hamqsl
|
||||
*/
|
||||
public function update_hamqsl() {
|
||||
public function update_hamqsl() {
|
||||
$lockfilename='/tmp/.update_hamqsl_running';
|
||||
if (!file_exists($lockfilename)) {
|
||||
touch($lockfilename);
|
||||
|
||||
$this->load->model('Update_model');
|
||||
$result = $this->Update_model->hamqsl();
|
||||
if($this->session->userdata('user_type') == '99') {
|
||||
if (substr($result, 0, 4) == 'DONE') {
|
||||
$this->session->set_flashdata('success', __("HAMqsl Update complete. Result: ") . "'" . $result . "'");
|
||||
$this->load->model('Update_model');
|
||||
$result = $this->Update_model->hamqsl();
|
||||
unlink($lockfilename);
|
||||
if($this->session->userdata('user_type') == '99') {
|
||||
if (substr($result, 0, 4) == 'DONE') {
|
||||
$this->session->set_flashdata('success', __("HAMqsl Update complete. Result: ") . "'" . $result . "'");
|
||||
} else {
|
||||
$this->session->set_flashdata('error', __("HAMqsl Update failed. Result: ") . "'" . $result . "'");
|
||||
}
|
||||
|
||||
$this->load->model('cron_model');
|
||||
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
|
||||
|
||||
redirect('debug');
|
||||
} else {
|
||||
$this->session->set_flashdata('error', __("HAMqsl Update failed. Result: ") . "'" . $result . "'");
|
||||
echo $result;
|
||||
}
|
||||
|
||||
$this->load->model('cron_model');
|
||||
$this->cron_model->set_last_run($this->router->class.'_'.$this->router->method);
|
||||
|
||||
redirect('debug');
|
||||
} else {
|
||||
echo $result;
|
||||
log_message('debug', 'There is a lockfile for this job. Checking the age...');
|
||||
$lockfile_time = filemtime($lockfilename);
|
||||
$tdiff = time() - $lockfile_time;
|
||||
if ($tdiff > 120) {
|
||||
unlink($lockfilename);
|
||||
log_message('debug', 'Deleted lockfile because it was older then 120seconds.');
|
||||
} else {
|
||||
log_message('debug', 'Process is currently locked. Further calls are ignored.');
|
||||
echo 'locked - running';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update_pota() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user