new: Added a php version check to teh diagnostics page

pull/1380/head
Iglocska 2016-07-20 12:37:09 +02:00
parent a86730e4a6
commit 80b6bca48f
3 changed files with 20 additions and 1 deletions

View File

@ -46,6 +46,9 @@ class AppController extends Controller {
public $helpers = array('Utility');
private $__jsVersion = '2.4.48';
public $phpmin = '5.5.9';
public $phprec = '5.6.0';
// Used for _isAutomation(), a check that returns true if the controller & action combo matches an action that is a non-xml and non-json automation method
// This is used to allow authentication via headers for methods not covered by _isRest() - as that only checks for JSON and XML formats

View File

@ -690,7 +690,7 @@ class ServersController extends AppController {
)
);
foreach ($phpSettings as $setting => &$settingArray) {
$settingArray['value'] = ini_get($setting);
if ($settingArray['unit']) $settingArray['value'] = intval(rtrim($settingArray['value'], $settingArray['unit']));
@ -752,6 +752,9 @@ class ServersController extends AppController {
$this->set('workerIssueCount', $workerIssueCount);
$priorityErrorColours = array(0 => 'red', 1 => 'yellow', 2 => 'green');
$this->set('priorityErrorColours', $priorityErrorColours);
$this->set('phpversion', phpversion());
$this->set('phpmin', $this->phpmin);
$this->set('phprec', $this->phprec);
}
}

View File

@ -76,6 +76,19 @@
?>
</div>
<h3>PHP Settings</h3>
<?php
$phpcolour = 'green';
$phptext = 'Up to date';
if (version_compare($phpversion, $phprec) < 1) {
$phpcolour = 'orange';
$phptext = 'Update highly recommended';
if (version_compare($phpversion, $phpmin) < 1) {
$phpcolour = 'red';
$phptext = 'Version unsupported, update ASAP';
}
}
?>
<p><span class="bold">PHP Version (<?php echo $phprec; ?> recommended): </span><span class="<?php echo $phpcolour; ?>"><?php echo h($phpversion) . ' (' . $phptext . ')';?></span></p>
<p>The following settings might have a negative impact on certain functionalities of MISP with their current and recommended minimum settings. You can adjust these in your php.ini. Keep in mind that the recommendations are not requirements, just recommendations. Depending on usage you might want to go beyond the recommended values.</p>
<?php
foreach ($phpSettings as $settingName => &$phpSetting):