Optimizing extension checking

This commit is contained in:
David Baumgartner 2013-10-16 20:14:04 +02:00
parent 61b5ce8c52
commit 91bd2680ba

View file

@ -12,15 +12,6 @@
'SPL' => function_exists('spl_autoload_register') 'SPL' => function_exists('spl_autoload_register')
); );
$bRequirements = true;
foreach ($aRequirements as $sKey => $bValue)
{
if (!$bValue)
{
$bRequirements = false;
break;
}
}
if (0 > version_compare(PHP_VERSION, '5.3.0')) if (0 > version_compare(PHP_VERSION, '5.3.0'))
{ {
@ -30,15 +21,18 @@
exit(301); exit(301);
} }
if (!$bRequirements) if (in_array(false,$aRequirements))
{ {
echo '<p>'; echo '<p>';
echo 'Required PHP extension are not available in your PHP configuration! (Error Code: 302)'; echo 'The following PHP extensions are not available in your PHP configuration! (Error Code: 302)';
echo '</p><ul>'; echo '</p><ul>';
foreach ($aRequirements as $sKey => $bValue) foreach ($aRequirements as $sKey => $bValue)
{ {
echo '<li style="color: '.($bValue ? 'green' : 'red').'">'.$sKey.'</li>'; if (!$bValue)
{
echo '<li>'.$sKey.'</li>';
}
} }
echo '</ul>'; echo '</ul>';