Core updates now support !!! (important)

There have been some small internal API changes that have been causing grief for some users. While all updates are technically "safe", user workarounds and custom implementations can never be predicted with certainty. This change will allow us to say with confidence, either

- Yep, no worries this is a safe update. Relax. Versus;
- Might want to watch this one, just in case.
This commit is contained in:
Samuel Georges 2017-04-01 12:07:24 +11:00
parent 8aa9d25a91
commit d472a0b0a8
3 changed files with 50 additions and 4 deletions

View File

@ -332,6 +332,26 @@ class Updates extends Controller
protected function processImportantUpdates($result)
{
$hasImportantUpdates = false;
/*
* Core
*/
$coreImportant = false;
foreach (array_get($result, 'core.updates', []) as $build => $description) {
if (strpos($description, '!!!') === false) continue;
$detailsUrl = '//octobercms.com/support/articles/release-notes';
$description = str_replace('!!!', '', $description);
$result['core']['updates'][$build] = [$description, $detailsUrl];
$coreImportant = $hasImportantUpdates = true;
}
$result['core']['isImportant'] = $coreImportant ? '1' : '0';
/*
* Plugins
*/
foreach (array_get($result, 'plugins', []) as $code => $plugin) {
$isImportant = false;
@ -348,6 +368,7 @@ class Updates extends Controller
}
$result['hasImportantUpdates'] = $hasImportantUpdates;
return $result;
}

View File

@ -11,8 +11,19 @@
<div class="control-updatelist">
<div class="control-scrollbar" style="height:400px" data-control="scrollbar">
<?php if ($core): ?>
<div class="update-item">
<div class="update-item <?= $core['isImportant'] ? 'item-danger' : '' ?>">
<div class="item-header">
<?php if ($core['isImportant']): ?>
<div class="important-update form-group form-group-sm">
<select
name="core_action"
class="form-control custom-select select-no-search"
data-important-update-select>
<option value="">-- <?= e(trans('system::lang.updates.important_action.empty')) ?> --</option>
<option value="confirm"><?= e(trans('system::lang.updates.important_action.confirm')) ?></option>
</select>
</div>
<?php endif ?>
<h5>
<i class="icon-cube"></i>
<?= e(trans('system::lang.system.name')) ?>
@ -21,7 +32,20 @@
<dl>
<?php foreach ($core['updates'] as $build => $description): ?>
<dt><?= e(trans('system::lang.updates.core_build', ['build'=>$build])) ?></dt>
<dd><?= e($description) ?></dd>
<?php if (is_array($description)): ?>
<dd>
<span class="important-update-label">
<?= e(trans('system::lang.updates.important_action_required')) ?>
</span>
<?= e($description[0]) ?>
<a href="<?= $description[1] ?>" target="_blank">
<?= e(trans('system::lang.updates.important_view_release_notes')) ?>
<i class="icon-external-link"></i>
</a>
</dd>
<?php else: ?>
<dd><?= e($description) ?></dd>
<?php endif ?>
<?php endforeach ?>
<?php if ($core['old_build']): ?>
<dt class="text-muted"><?= e(trans('system::lang.updates.core_build', ['build'=>$core['old_build']])) ?></dt>

View File

@ -269,11 +269,12 @@ return [
'important_action' => [
'empty' => 'Select action',
'confirm' => 'Confirm update',
'skip' => 'Skip this plugin (once only)',
'ignore' => 'Skip this plugin (always)'
'skip' => 'Skip this update (once only)',
'ignore' => 'Skip this update (always)'
],
'important_action_required' => 'Action required',
'important_view_guide' => 'View upgrade guide',
'important_view_release_notes' => 'View release notes',
'important_alert_text' => 'Some updates need your attention.',
'details_title' => 'Plugin details',
'details_view_homepage' => 'View homepage',