diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 4be195a33..006aadcfd 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -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 // diff --git a/modules/system/controllers/Updates.php b/modules/system/controllers/Updates.php index 9e32b990b..3cc7985b7 100644 --- a/modules/system/controllers/Updates.php +++ b/modules/system/controllers/Updates.php @@ -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 // diff --git a/modules/system/controllers/updates/_changelog_list.htm b/modules/system/controllers/updates/_changelog_list.htm new file mode 100644 index 000000000..8c396df82 --- /dev/null +++ b/modules/system/controllers/updates/_changelog_list.htm @@ -0,0 +1,47 @@ +
= $coreBuild ?>
++ + = e(trans('system::lang.updates.core_view_changelog')) ?> + +