Add changelog link to updates screen - Fixes #4101
This commit is contained in:
parent
8c1106f027
commit
adc74ac02e
|
|
@ -748,6 +748,39 @@ class UpdateManager
|
|||
$this->productCache[$type][$code] = $data;
|
||||
}
|
||||
|
||||
//
|
||||
// Changelog
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns the latest changelog information.
|
||||
*/
|
||||
public function requestChangelog()
|
||||
{
|
||||
$result = Http::get('https://octobercms.com/changelog?json');
|
||||
|
||||
if ($result->code == 404) {
|
||||
throw new ApplicationException(Lang::get('system::lang.server.response_empty'));
|
||||
}
|
||||
|
||||
if ($result->code != 200) {
|
||||
throw new ApplicationException(
|
||||
strlen($result->body)
|
||||
? $result->body
|
||||
: Lang::get('system::lang.server.response_empty')
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
$resultData = json_decode($result->body, true);
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
|
||||
}
|
||||
|
||||
return $resultData;
|
||||
}
|
||||
|
||||
//
|
||||
// Notes
|
||||
//
|
||||
|
|
|
|||
|
|
@ -699,6 +699,33 @@ class Updates extends Controller
|
|||
return Backend::redirect('system/updates');
|
||||
}
|
||||
|
||||
//
|
||||
// View Changelog
|
||||
//
|
||||
|
||||
/**
|
||||
* Displays changelog information
|
||||
*/
|
||||
public function onLoadChangelog()
|
||||
{
|
||||
try {
|
||||
$fetchedContent = UpdateManager::instance()->requestChangelog();
|
||||
|
||||
$changelog = array_get($fetchedContent, 'history');
|
||||
|
||||
if (!$changelog || !is_array($changelog)) {
|
||||
throw new ApplicationException(Lang::get('system::lang.server.response_empty'));
|
||||
}
|
||||
|
||||
$this->vars['changelog'] = $changelog;
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
$this->handleError($ex);
|
||||
}
|
||||
|
||||
return $this->makePartial('changelog_list');
|
||||
}
|
||||
|
||||
//
|
||||
// Plugin management
|
||||
//
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="popup">×</button>
|
||||
<h4 class="modal-title"><?= e(trans('system::lang.updates.changelog')) ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<?php if ($this->fatalError): ?>
|
||||
<p class="flash-message static error"><?= e($fatalError) ?></p>
|
||||
<?php else: ?>
|
||||
<div class="control-updatelist">
|
||||
<div class="control-scrollbar" style="height:400px" data-control="scrollbar">
|
||||
<div class="update-item">
|
||||
<dl>
|
||||
<?php foreach ($changelog as $item): ?>
|
||||
<?php
|
||||
$description = array_get($item, 'description');
|
||||
$build = array_get($item, 'build');
|
||||
$linkUrl = array_get($item, 'link_url');
|
||||
?>
|
||||
<dt><?= e(trans('system::lang.updates.core_build', ['build'=>$build])) ?></dt>
|
||||
<?php if ($linkUrl): ?>
|
||||
<dd>
|
||||
<?= e($description) ?>
|
||||
<a href="<?= $linkUrl ?>" target="_blank">
|
||||
<?= e(trans('system::lang.updates.changelog_view_details')) ?>
|
||||
<i class="icon-external-link"></i>
|
||||
</a>
|
||||
</dd>
|
||||
<?php else: ?>
|
||||
<dd><?= e($description) ?></dd>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="popup">
|
||||
<?= e(trans('backend::lang.form.close')) ?>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -35,6 +35,14 @@
|
|||
<div class="scoreboard-item title-value">
|
||||
<h4><?= e(trans('system::lang.updates.core_current_build')) ?></h4>
|
||||
<p><?= $coreBuild ?></p>
|
||||
<p class="description">
|
||||
<a
|
||||
href="javascript:;"
|
||||
data-control="popup"
|
||||
data-handler="onLoadChangelog">
|
||||
<?= e(trans('system::lang.updates.core_view_changelog')) ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -317,11 +317,14 @@ return [
|
|||
'plugin_author' => 'Author',
|
||||
'plugin_not_found' => 'Plugin not found',
|
||||
'core_current_build' => 'Current build',
|
||||
'core_view_changelog' => 'View Changelog',
|
||||
'core_build' => 'Build :build',
|
||||
'core_build_help' => 'Latest build is available.',
|
||||
'core_downloading' => 'Downloading application files',
|
||||
'core_extracting' => 'Unpacking application files',
|
||||
'core_set_build' => 'Setting build number',
|
||||
'changelog' => 'Changelog',
|
||||
'changelog_view_details' => 'View details',
|
||||
'plugins' => 'Plugins',
|
||||
'themes' => 'Themes',
|
||||
'disabled' => 'Disabled',
|
||||
|
|
|
|||
Loading…
Reference in New Issue