diff --git a/application/controllers/Debug.php b/application/controllers/Debug.php index c2c377e41..397f4f456 100644 --- a/application/controllers/Debug.php +++ b/application/controllers/Debug.php @@ -22,10 +22,19 @@ class Debug extends CI_Controller $this->load->model('Debug_model'); $this->load->model('Stations'); $this->load->model('cron_model'); + $this->load->model('Update_model'); $footerData = []; $footerData['scripts'] = ['assets/js/sections/debug.js']; + $data['running_version'] = $this->optionslib->get_option('version'); + $data['latest_release'] = $this->Update_model->wavelog_latest_release(); + if (version_compare($data['latest_release'], $data['running_version'], '>')) { + $data['newer_version_available'] = true; + } else { + $data['newer_version_available'] = false; + } + $data['stations'] = $this->Stations->all(); $data['qso_total'] = $this->Debug_model->count_all_qso(); diff --git a/application/models/Update_model.php b/application/models/Update_model.php index dbe1bfeb0..d1d45bfc7 100644 --- a/application/models/Update_model.php +++ b/application/models/Update_model.php @@ -260,4 +260,18 @@ class Update_model extends CI_Model { $totaltime = ($endtime - $starttime); return "Records inserted: " . $i . " in " . $totaltime . " seconds
"; } + + function wavelog_latest_release() { + $latest_tag = null; + $url = "https://api.github.com/repos/wavelog/wavelog/releases"; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog Updater'); + curl_setopt($ch, CURLOPT_URL,$url); + $result=curl_exec($ch); + curl_close($ch); + $json = json_decode($result, true); + $latest_tag = $json[0]['tag_name']; + return $latest_tag; + } } diff --git a/application/views/debug/index.php b/application/views/debug/index.php index 9f5e9df39..bc7558e6b 100644 --- a/application/views/debug/index.php +++ b/application/views/debug/index.php @@ -25,8 +25,14 @@ - + + + + + + +
optionslib->get_option('version') . "\n"; ?>
config->item('language'))) . "\n"; ?>