Added an Admin::getChangelog() method

This commit is contained in:
Andy Miller
2019-12-09 10:58:49 -07:00
parent e6138debf6
commit 31b8a8e12b
2 changed files with 32 additions and 8 deletions

View File

@@ -2136,10 +2136,41 @@ class Admin
return $_SERVER['HTTP_REFERER'] ?? null;
}
/**
* Get Grav system log files
*
* @return array
*/
public function getLogFiles()
{
$logs = new GravData(['grav.log' => 'Grav System Log', 'email.log' => 'Email Log']);
Grav::instance()->fireEvent('onAdminLogFiles', new Event(['logs' => &$logs]));
return $logs->toArray();
}
/**
* Get changelog for a given GPM package based on slug
*
* @param null $slug
* @return array
*/
public function getChangelog($slug = null)
{
$gpm = $this->gpm();
$changelog = [];
if (!empty($slug)) {
$package = $gpm->findPackage($slug);
} else {
$package = $gpm->grav;
}
if ($package) {
$changelog = $package->getChangelog();
}
return $changelog;
}
}

View File

@@ -1,13 +1,6 @@
{% set slug = uri.param('slug') %}
{% if slug %}
{% set package = admin.gpm.findPackage(slug) %}
{% set changelog = package.changelog %}
{% set title = package.name %}
{% else %}
{% set changelog = admin.gpm.grav.changelog %}
{% set title = "Grav" %}
{% endif %}
{% set changelog = admin.getChangelog(slug) %}
<section id="ajax" class="changelog">
<a href="#" class="remodal-close"></a>