1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 18:29:40 +02:00

Fix up the tests a bit

The hash check shouldn't be mixed in with the version check, and we now
need JSON.
This commit is contained in:
Paul Arthur 2013-02-03 04:24:08 -05:00
parent 287ddc4345
commit 10d54c9f7f
3 changed files with 38 additions and 48 deletions

View file

@ -26,22 +26,11 @@
* sure that it's good enough
*/
function check_php_ver($level=0) {
if (floatval(phpversion()) < 5.3) {
return false;
}
// Make sure that they have the sha256() algo installed
if (!function_exists('hash_algos')) { return false; }
$algos = hash_algos();
if (!in_array('sha256',$algos)) {
return false;
}
return true;
} // check_php_ver
}
/**
* check_php_session
@ -58,21 +47,6 @@ function check_php_session() {
} // check_php_session
/**
* check_php_pcre
* This makes sure they have pcre (preg_???) support
* compiled into PHP this is required!
*/
function check_php_pcre() {
if (!function_exists('preg_match')) {
return false;
}
return true;
} // check_php_pcre
/**
* check_pdo
*

View file

@ -53,7 +53,10 @@ else {
// Verify that a few important but commonly disabled PHP functions exist and
// that we're on a usable version
if (!function_exists('hash') || !function_exists('inet_pton') || (floatval(phpversion()) < 5.3) || !class_exists('PDO')) {
if (!function_exists('json_encode') ||
!function_exists('hash') ||
(floatval(phpversion()) < 5.3) ||
!class_exists('PDO')) {
$link = $path . '/test.php';
}

View file

@ -23,27 +23,37 @@
<tr>
<td valign="top"><?php echo T_('PHP version'); ?></td>
<td valign="top">[
<?php
if (!check_php_ver()) {
echo debug_result('',false);
if (function_exists('hash_algos')) { $algos = hash_algos(); }
$string = "<strong>" . phpversion() . " " . T_('Hash Function Exists') . " " . print_bool(function_exists('hash_algos')) . " " . T_('SHA256 Support') . " " . print_bool(in_array('sha256',$algos)) . "</strong>";
}
else {
echo debug_result('',true);
}
?>
<?php echo debug_result('', check_php_ver()); ?>
]
</td>
<td>
<?php echo T_('This tests whether you are running at least the minimum version of PHP required by Ampache.'); ?>
<?php echo $string; ?>
</td>
</tr>
<tr>
<td valign="top"><?php echo T_('Hash extension'); ?></td>
<td valign="top">[
<?php echo debug_result('', function_exists('hash_algos')); ?>
]
</td>
<td>
<?php echo T_('This tests whether you have the hash extension enabled. This extension is required by Ampache.'); ?>
</td>
</tr>
<tr>
<td valign="top"><?php echo T_('SHA256 Hash'); ?></td>
<td valign="top">[
<?php echo debug_result('', function_exists('hash_algos') ? in_array('sha256', hash_algos()) : false); ?>
]
</td>
<td>
<?php echo T_('This tests whether the hash extension supports SHA256. This algorithm is required by Ampache.'); ?>
</td>
</tr>
<tr>
<td valign="top"><?php echo T_('PHP PDO'); ?></td>
<td valign="top">[
<?php echo debug_result('', check_pdo()); ?>
<?php echo debug_result('', check_pdo()); ?>
]
</td>
<td>
@ -53,14 +63,7 @@
<tr>
<td valign="top"><?php echo T_('PHP session extension'); ?></td>
<td valign="top">[
<?php
if (!check_php_session()) {
echo debug_result('',false);
}
else {
echo debug_result('',true);
}
?>
<?php echo debug_result('', check_php_session()); ?>
]
</td>
<td>
@ -83,6 +86,16 @@
<?php echo T_('This tests whether you have the iconv extension enabled. This extension is required by Ampache.'); ?>
</td>
</tr>
<tr>
<td valign="top"><?php echo T_('JSON extension'); ?></td>
<td valign="top">[
<?php echo debug_result('', function_exists('json_encode')); ?>
]
</td>
<td>
<?php echo T_('This tests whether you have the JSON extension enabled. This extension is required by Ampache.'); ?>
</td>
</tr>
<tr>
<td valign="top"><?php echo T_('PHP safe mode disabled'); ?></td>
<td valign="top">[