Skip to content

Commit

Permalink
Added "The site has configuration issues" check to the software info …
Browse files Browse the repository at this point in the history
…section
  • Loading branch information
zapalm committed Mar 6, 2022
1 parent 0b740db commit 4d4ee35
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions PsDiag.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,13 @@ public static function getIonCubeVersion()
/**
* Returns software information.
*
* @param bool $isSiteHasConfigurationIssues
*
* @return string[]
*
* @author Maksim T. <zapalm@yandex.com>
*/
public function getSoftwareInfo()
public function getSoftwareInfo($isSiteHasConfigurationIssues)
{
return [
'PrestaShop version' => (float)_PS_VERSION_ . ' (' . _PS_VERSION_ . ')',
Expand All @@ -330,6 +332,7 @@ public function getSoftwareInfo()
: 'ionCube not enabled'
),
'PrestaShop classes override system enabled' => (Configuration::get('PS_DISABLE_OVERRIDES') ? 'No' : 'Yes'),
'The site has configuration issues' => ($isSiteHasConfigurationIssues ? 'Yes' : 'No'),
];
}

Expand All @@ -344,8 +347,18 @@ public function getSoftwareInfo()
*/
public function printReport(array $report)
{
$message = 'SOFTWARE INFORMATION:' . PHP_EOL;
foreach (static::getSoftwareInfo() as $infoKey => $infoValue) {
$isSiteHasConfigurationIssues = false;
foreach ($report as $testResult) {
if ('ok' !== $testResult[0]) {
$isSiteHasConfigurationIssues = true;

break;
}
}

$message = 'SOFTWARE INFORMATION:' . PHP_EOL;
$softwareInfo = static::getSoftwareInfo($isSiteHasConfigurationIssues);
foreach ($softwareInfo as $infoKey => $infoValue) {
$message .= $infoKey . ': ' . $infoValue . PHP_EOL;
}

Expand Down

0 comments on commit 4d4ee35

Please sign in to comment.