From b61b330ec4c7e3f126d9f07b9006484d98232091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Gerg=C5=91?= Date: Mon, 15 Oct 2018 16:51:12 +0200 Subject: [PATCH] Improve the System Status dashboard widget (#3866) Improves the System Status dashboard widget by adding a warning icon whenever the specific log is disabled. Credit to @gergo85. Thanks to @petehalverson for Octodock making testing easier. --- modules/system/reportwidgets/Status.php | 24 ++++++++++++------- .../reportwidgets/status/partials/_widget.htm | 2 ++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/modules/system/reportwidgets/Status.php b/modules/system/reportwidgets/Status.php index 20dd7bb6d..7a4089709 100644 --- a/modules/system/reportwidgets/Status.php +++ b/modules/system/reportwidgets/Status.php @@ -4,6 +4,7 @@ use Lang; use Config; use BackendAuth; use System\Models\Parameter; +use System\Models\LogSetting; use System\Classes\UpdateManager; use System\Classes\PluginManager; use Backend\Classes\ReportWidgetBase; @@ -56,12 +57,17 @@ class Status extends ReportWidgetBase protected function loadData() { $manager = UpdateManager::instance(); + $this->vars['canUpdate'] = BackendAuth::getUser()->hasAccess('system.manage_updates'); - $this->vars['updates'] = $manager->check(); - $this->vars['warnings'] = $this->getSystemWarnings(); + $this->vars['updates'] = $manager->check(); + $this->vars['warnings'] = $this->getSystemWarnings(); $this->vars['coreBuild'] = Parameter::get('system::core.build'); - $this->vars['eventLog'] = EventLog::count(); - $this->vars['requestLog'] = RequestLog::count(); + + $this->vars['eventLog'] = EventLog::count(); + $this->vars['eventLogMsg'] = LogSetting::get('log_events', false) ? false : true; + $this->vars['requestLog'] = RequestLog::count(); + $this->vars['requestLogMsg'] = LogSetting::get('log_requests', false) ? false : true; + $this->vars['appBirthday'] = PluginVersion::orderBy('created_at')->value('created_at'); } @@ -88,17 +94,17 @@ class Status extends ReportWidgetBase storage_path('cms/twig'), storage_path('cms/combiner'), ]; - + if (in_array('Cms', Config::get('cms.loadModules', []))) { $writablePaths[] = themes_path(); } $requiredExtensions = [ - 'GD' => extension_loaded('gd'), + 'GD' => extension_loaded('gd'), 'fileinfo' => extension_loaded('fileinfo'), - 'Zip' => class_exists('ZipArchive'), - 'cURL' => function_exists('curl_init') && defined('CURLOPT_FOLLOWLOCATION'), - 'OpenSSL' => function_exists('openssl_random_pseudo_bytes'), + 'Zip' => class_exists('ZipArchive'), + 'cURL' => function_exists('curl_init') && defined('CURLOPT_FOLLOWLOCATION'), + 'OpenSSL' => function_exists('openssl_random_pseudo_bytes'), ]; foreach ($writablePaths as $path) { diff --git a/modules/system/reportwidgets/status/partials/_widget.htm b/modules/system/reportwidgets/status/partials/_widget.htm index 41b8974c2..855e103e3 100644 --- a/modules/system/reportwidgets/status/partials/_widget.htm +++ b/modules/system/reportwidgets/status/partials/_widget.htm @@ -52,6 +52,7 @@ +   @@ -59,6 +60,7 @@ +