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.
This commit is contained in:
Szabó Gergő 2018-10-15 16:51:12 +02:00 committed by Luke Towers
parent 2c82b05062
commit b61b330ec4
2 changed files with 17 additions and 9 deletions

View File

@ -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) {

View File

@ -52,6 +52,7 @@
<span class="status-icon"><i class="icon-exclamation-triangle"></i></span>
<span class="status-text">
<?= e(trans('backend::lang.dashboard.status.event_log')) ?>
<?php if ($eventLogMsg): ?>&nbsp;<a href="<?= Backend::url('system/settings/update/october/system/log_settings') ?>"><i class="icon-exclamation-triangle text-warning" title="<?= e(trans('system::lang.updates.disabled')) ?>" data-toggle="tooltip" data-placement="right"></i></a><?php endif ?>
</span>
<a href="<?= Backend::url('system/eventlogs') ?>" class="status-label primary"><?= $eventLog ?></a>
</li>
@ -59,6 +60,7 @@
<span class="status-icon"><i class="icon-file-o"></i></span>
<span class="status-text">
<?= e(trans('backend::lang.dashboard.status.request_log')) ?>
<?php if ($requestLogMsg): ?>&nbsp;<a href="<?= Backend::url('system/settings/update/october/system/log_settings') ?>"><i class="icon-exclamation-triangle text-warning" title="<?= e(trans('system::lang.updates.disabled')) ?>" data-toggle="tooltip" data-placement="right"></i></a><?php endif ?>
</span>
<a href="<?= Backend::url('system/requestlogs') ?>" class="status-label primary"><?= $requestLog ?></a>
</li>