Allow (and default to) checking for release updates only.

This commit is contained in:
Buster "Silver Eagle" Neece 2018-12-15 13:34:18 -06:00
parent fda8ba092c
commit 81c5ab4aa5
5 changed files with 28 additions and 13 deletions

View File

@ -132,10 +132,11 @@ return [
'description' => __('Send minimal details about your AzuraCast installation to the AzuraCast central server to check for updated software releases and important announcements.'),
'choices' => [
0 => __('No'),
1 => __('Yes'),
Entity\Settings::UPDATES_NONE => __('<b>None:</b> Do not check for updates or announcements.'),
Entity\Settings::UPDATES_RELEASE_ONLY => __('<b>Release Only:</b> Critical announcements and new release versions only.'),
Entity\Settings::UPDATES_ALL => __('<b>All Updates:</b> Include all announcements and minor updates.'),
],
'default' => 1,
'default' => Entity\Settings::UPDATES_RELEASE_ONLY,
]
]

View File

@ -7,8 +7,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2018-12-12T18:22:44+00:00\n"
"PO-Revision-Date: 2018-12-12T18:22:44+00:00\n"
"POT-Creation-Date: 2018-12-15T19:33:09+00:00\n"
"PO-Revision-Date: 2018-12-15T19:33:09+00:00\n"
"Language: \n"
#: /var/azuracast/www/src/Controller/Admin/ApiController.php:55
@ -791,7 +791,7 @@ msgstr ""
#: /var/azuracast/www/config/forms/remote.php:133
#: /var/azuracast/www/config/forms/rename.php:18
#: /var/azuracast/www/config/forms/role.php:65
#: /var/azuracast/www/config/forms/settings.php:152
#: /var/azuracast/www/config/forms/settings.php:153
#: /var/azuracast/www/config/forms/song.php:47
#: /var/azuracast/www/config/forms/station.php:363
#: /var/azuracast/www/config/forms/streamer.php:61
@ -897,7 +897,6 @@ msgstr ""
#: /var/azuracast/www/config/forms/settings.php:46
#: /var/azuracast/www/config/forms/settings.php:59
#: /var/azuracast/www/config/forms/settings.php:72
#: /var/azuracast/www/config/forms/settings.php:135
#: /var/azuracast/www/config/forms/station.php:223
#: /var/azuracast/www/config/forms/station.php:233
#: /var/azuracast/www/config/forms/station.php:305
@ -923,7 +922,6 @@ msgstr ""
#: /var/azuracast/www/config/forms/settings.php:47
#: /var/azuracast/www/config/forms/settings.php:60
#: /var/azuracast/www/config/forms/settings.php:73
#: /var/azuracast/www/config/forms/settings.php:136
#: /var/azuracast/www/config/forms/station.php:223
#: /var/azuracast/www/config/forms/station.php:233
#: /var/azuracast/www/config/forms/station.php:305
@ -1790,6 +1788,18 @@ msgstr ""
msgid "Send minimal details about your AzuraCast installation to the AzuraCast central server to check for updated software releases and important announcements."
msgstr ""
#: /var/azuracast/www/config/forms/settings.php:135
msgid "<b>None:</b> Do not check for updates or announcements."
msgstr ""
#: /var/azuracast/www/config/forms/settings.php:136
msgid "<b>Release Only:</b> Critical announcements and new release versions only."
msgstr ""
#: /var/azuracast/www/config/forms/settings.php:137
msgid "<b>All Updates:</b> Include all announcements and minor updates."
msgstr ""
#: /var/azuracast/www/config/forms/song.php:8
#: /var/azuracast/www/resources/templates/frontend/public/dj.js.phtml:12
msgid "Metadata"

View File

@ -40,6 +40,10 @@ class Settings
const MEDIUM_SYNC_LAST_RUN = 'sync_last_run';
const LONG_SYNC_LAST_RUN = 'sync_slow_last_run';
const UPDATES_NONE = 0;
const UPDATES_ALL = 1;
const UPDATES_RELEASE_ONLY = 2;
const UNIQUE_IDENTIFIER = 'central_app_uuid';
const UPDATE_RESULTS = 'central_update_results';
const UPDATE_LAST_RUN = 'central_update_last_run';

View File

@ -85,9 +85,9 @@ class Manager implements EventSubscriberInterface
return;
}
$check_for_updates = (bool)$this->settings_repo->getSetting(Entity\Settings::CENTRAL_UPDATES, 1);
$check_for_updates = (int)$this->settings_repo->getSetting(Entity\Settings::CENTRAL_UPDATES, 1);
if (!$check_for_updates) {
if (Entity\Settings::UPDATES_NONE === $check_for_updates) {
return;
}
@ -108,7 +108,7 @@ class Manager implements EventSubscriberInterface
return;
}
if ($update_data['needs_rolling_update']) {
if (Entity\Settings::UPDATES_ALL === $check_for_updates && $update_data['needs_rolling_update']) {
$event->addNotification(new Notification(
__('New AzuraCast Updates Available'),
__('<b>Your installation is currently %d update(s) behind the latest version.</b> You should update to take advantage of bug and security fixes. Follow the <a href="%s" target="_blank">update instructions</a> to update your installation.', $update_data['rolling_updates_available'], $instructions_url),

View File

@ -70,9 +70,9 @@ class CheckForUpdates extends TaskAbstract
}
}
$check_for_updates = (bool)$this->settings_repo->getSetting(Entity\Settings::CENTRAL_UPDATES, 1);
$check_for_updates = (int)$this->settings_repo->getSetting(Entity\Settings::CENTRAL_UPDATES, Entity\Settings::UPDATES_RELEASE_ONLY);
if (!$check_for_updates || $this->app_settings->isTesting()) {
if (Entity\Settings::UPDATES_NONE === $check_for_updates || $this->app_settings->isTesting()) {
$this->logger->info('Update checks are currently disabled for this AzuraCast instance.');
return;
}