Add banner for admins and config switch. Update by cron

This commit is contained in:
phl0
2024-09-12 15:24:18 +02:00
parent 7750198bb0
commit 6a36465574
6 changed files with 67 additions and 18 deletions

View File

@@ -28,8 +28,8 @@ class Debug extends CI_Controller
$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['latest_release'] = $this->optionslib->get_option('latest_release');
if ($data['latest_release'] && version_compare($data['latest_release'], $data['running_version'], '>')) {
$data['newer_version_available'] = true;
} else {
$data['newer_version_available'] = false;

View File

@@ -427,5 +427,16 @@ class Update extends CI_Controller {
$this->optionslib->update('tle_update', $datetime , 'no');
}
function wavelog_update_check() {
if ($this->config->item('version_check')) {
$this->load->model('Update_model');
$running_version = $this->optionslib->get_option('version');
$latest_release = $this->Update_model->wavelog_latest_release();
if (version_compare($latest_release, $running_version, '>')) {
print __("Newer release available:")." ".$latest_release;
$this->Update_model->set_latest_release($latest_release);
}
}
}
}
?>

View File

@@ -274,4 +274,19 @@ class Update_model extends CI_Model {
$latest_tag = $json[0]['tag_name'];
return $latest_tag;
}
function set_latest_release($release) {
$this->db->select('option_value');
$this->db->where('option_name', 'latest_release');
$query = $this->db->get('options');
if ($query->num_rows() > 0) {
$this->db->where('option_name', 'latest_release');
$this->db->update('options', array('option_value' => $release));
} else {
$data = array(
array('option_name' => "latest_release", 'option_value' => $release, 'autoload' => "yes"),
);
$this->db->insert_batch('options', $data);
}
}
}

View File

@@ -58,6 +58,13 @@ function echo_table_col($row, $name) {
<?= __("You need to upgrade your PHP version. Minimum version is 7.4. Your version is") . ' ' . PHP_VERSION . '.';?>
</div>
<?php } ?>
<?php if(($this->session->userdata('user_type') == 99) && $this->config->item('version_check') && $this->optionslib->get_option('latest_release')) { ?>
<?php if (version_compare($this->optionslib->get_option('latest_release'), $this->optionslib->get_option('version'), '>')) { ?>
<div class="alert alert-success" role="alert" style="margin-top: 1rem;">
<?= sprintf(_pgettext("Dashboard Warning", "A new version of Wavelog has been published. See: %s."), "<a href=\"https://github.com/wavelog/wavelog/releases/tag/".$this->optionslib->get_option('latest_release')."\" target=\"_blank\">Release ".$this->optionslib->get_option('latest_release')."</a>"); ?>
</div>
<?php } ?>
<?php } ?>
<?php if ($countryCount == 0) { ?>
<div class="alert alert-danger mt-3" role="alert">

View File

@@ -25,7 +25,11 @@
<table width="100%">
<tr>
<td><?= __("Version"); ?></td>
<td><?php echo $running_version."\n"; ?></td>
<td><?php echo $running_version; ?>
<?php if ($running_version == $latest_release) { ?>
<span class="badge text-bg-success"> <?= __("Latest Version"); ?></span>
<?php } ?>
</td>
</tr>
<?php if ($newer_version_available) { ?>
<tr>

View File

@@ -25,11 +25,11 @@ $config['datadir'] = null; // default to install directory
|
| 'table_name' SQL table where log can be found
| 'locator' Default locator used to calculate bearings/distance
| 'display_freq' Show or Hide frequnecy info
| 'display_freq' Show or Hide frequnecy info
*/
$config['table_name'] = 'TABLE_HRD_CONTACTS_V01';
$config['locator'] = '%baselocator%';
$config['table_name'] = 'TABLE_HRD_CONTACTS_V01';
$config['locator'] = '%baselocator%';
$config['display_freq'] = true;
/*
@@ -64,7 +64,7 @@ $config['hamqth_password'] = '%hamqth_password%';
|
| 'use_auth' False turns all authentication off, best used when setting up
| 'auth_table' MySQL Database Table defaults "users"
| 'auth_mode' Minimum user level required 0 = anonymous, 1 = viewer,
| 'auth_mode' Minimum user level required 0 = anonymous, 1 = viewer,
| 2 = editor, 3 = api user, 99 = owner
| 'auth_level[]' Defines level titles
*/
@@ -631,7 +631,7 @@ $config['disable_manual_qrz'] = false;
| Disables QSL-Image-Feature
|--------------------------------------------------------------------------
|
| This disabled the whole QSL image feature if you don't need it and want to hide it.
| This disabled the whole QSL image feature if you don't need it and want to hide it.
| Set to true will hide all QSL image related stuff in Wavelog
|
*/
@@ -643,7 +643,7 @@ $config['disable_qsl'] = false;
| Disables OQRS-Feature
|--------------------------------------------------------------------------
|
| This disabled the whole OQRS feature if you don't need it and want to hide it.
| This disabled the whole OQRS feature if you don't need it and want to hide it.
| Set to true will hide all OQRS related stuff in Wavelog
|
*/
@@ -658,18 +658,18 @@ $config['disable_oqrs'] = false;
| This config switch is meant to use for Special Callsign operations in a dedicated Wavelog Installation
| If this switch is set to true it will enable a dialog which pops up for each operator after login
| to ask for his personal callsign. This causes the QSOs to get saved with the correct operator data.
| Example: Special Callsign: DL250CDF
| Example: Special Callsign: DL250CDF
| Operator: DF2TG
|
| It is recommend to enable also "Disable Syncing to 3rd party-Services at UI"
| More Information about this feature and how to use it, you can find here:
|
| It is recommend to enable also "Disable Syncing to 3rd party-Services at UI"
| More Information about this feature and how to use it, you can find here:
| https://github.com/wavelog/wavelog/wiki/Recommended-Setup-for-Special-Callsigns-and-Clubs
*/
$config['special_callsign'] = false;
// hides the usermenu; takes action only if "special_callsign" is true
$config['sc_hide_usermenu'] = true;
$config['sc_hide_usermenu'] = true;
/*
@@ -679,10 +679,10 @@ $config['sc_hide_usermenu'] = true;
|
| This config switch disables the impersonate feature. This feauture is used to impersonate another user.
| Impersonate is enabled by default. To disable it, set the value to false.
|
|
*/
$config['disable_impersonate'] = false;
$config['disable_impersonate'] = false;
/*
@@ -692,7 +692,19 @@ $config['disable_impersonate'] = false;
|
| The cronmanager needs http or https with a valid certificate to work.
| If you want to use it with https and a self-signed certificate, you need to set this to true.
|
|
*/
$config['cron_allow_insecure'] = false;
$config['cron_allow_insecure'] = false;
/*
|--------------------------------------------------------------------------
| Update / version check
|--------------------------------------------------------------------------
| This config switch enabled the check for newer releases on github and
| displays a banner to admin users if a newer release as published.
| Default on.
*/
$config['version_check'] = false;