summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-02-03 04:24:08 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-02-03 04:34:57 -0500
commit10d54c9f7fd0b15b64a0474c6f33b63caabc4d03 (patch)
treeb6e372a8b1d123ccb4408611cf8638ab87865c52
parent287ddc4345a88997f066bf9f8b78410b30b7bf4a (diff)
downloadampache-10d54c9f7fd0b15b64a0474c6f33b63caabc4d03.tar.gz
ampache-10d54c9f7fd0b15b64a0474c6f33b63caabc4d03.tar.bz2
ampache-10d54c9f7fd0b15b64a0474c6f33b63caabc4d03.zip
Fix up the tests a bit
The hash check shouldn't be mixed in with the version check, and we now need JSON.
-rw-r--r--lib/debug.lib.php28
-rw-r--r--lib/init.php5
-rw-r--r--templates/show_test_table.inc.php53
3 files changed, 38 insertions, 48 deletions
diff --git a/lib/debug.lib.php b/lib/debug.lib.php
index f96c9ffa..d3fa035b 100644
--- a/lib/debug.lib.php
+++ b/lib/debug.lib.php
@@ -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
@@ -59,21 +48,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
*
* Checks to make sure that PDO is available.
diff --git a/lib/init.php b/lib/init.php
index 8b8248f0..672f945e 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -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';
}
diff --git a/templates/show_test_table.inc.php b/templates/show_test_table.inc.php
index 6bcc5b03..ba22e717 100644
--- a/templates/show_test_table.inc.php
+++ b/templates/show_test_table.inc.php
@@ -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>
@@ -84,6 +87,16 @@
</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">[
<?php