diff --git a/src/_h5ai/index.html b/src/_h5ai/index.html
index a858cfc1..8b8d0c58 100644
--- a/src/_h5ai/index.html
+++ b/src/_h5ai/index.html
@@ -23,7 +23,7 @@
version %BUILD_VERSION%
server supports
- - PHP
+ - PHP variant
- zipped downloads
- thumbnails
diff --git a/src/_h5ai/js/inc/splash.js b/src/_h5ai/js/inc/splash.js
index 3f4e456d..82779712 100644
--- a/src/_h5ai/js/inc/splash.js
+++ b/src/_h5ai/js/inc/splash.js
@@ -2,26 +2,22 @@
(function ($, h5ai) {
'use strict';
- var handleChecksResponse = function (response) {
+ var setCheckResult = function (id, result) {
- if (response) {
- $('#test-php .test-result').addClass('test-passed').text('yes');
- if (response.zips === 0) {
- $('#test-zips .test-result').addClass('test-passed').text('yes');
- } else {
- $('#test-zips .test-result').addClass('test-failed').text('no').attr('title', 'error-code: ' + response.zips);
- }
- if (response.thumbs === 0) {
- $('#test-thumbs .test-result').addClass('test-passed').text('yes');
- } else {
- $('#test-thumbs .test-result').addClass('test-failed').text('no').attr('title', 'error-code: ' + response.thumbs);
- }
+ var $ele = $(id).find('.test-result');
+
+ if (result) {
+ $ele.addClass('test-passed').text('yes');
} else {
- $('#test-php .test-result').addClass('test-failed').text('no');
- $('#test-zips .test-result').addClass('test-failed').text('no');
- $('#test-thumbs .test-result').addClass('test-failed').text('no');
+ $ele.addClass('test-failed').text('no');
}
},
+ handleChecksResponse = function (response) {
+
+ setCheckResult('#test-php', response && response.php);
+ setCheckResult('#test-zips', response && response.zips);
+ setCheckResult('#test-thumbs', response && response.thumbs);
+ },
checks = function () {
$.ajax({
diff --git a/src/_h5ai/php/api.php b/src/_h5ai/php/api.php
index 23cf57d9..db4fb3b8 100644
--- a/src/_h5ai/php/api.php
+++ b/src/_h5ai/php/api.php
@@ -145,43 +145,11 @@ else if ($action === "getzip") {
else if ($action === "checks") {
- function checkZipSupport () {
-
- if (!class_exists("ZipArchive")) {
- return 1;
- }
-
- try {
- $zipFile = tempnam(sys_get_temp_dir(), "h5ai-zip-");
- $zip = new ZipArchive();
-
- if (!$zip->open($zipFile, ZIPARCHIVE::CREATE)) {
- return 2;
- }
-
- $zip->addEmptyDir("/");
- $zip->close();
-
- if (filesize($zipFile) === 0) {
- return 3;
- }
- } catch (Exception $e) {
- return 4;
- };
-
- return 0;
- }
-
- function checkGdSupport () {
-
- if (GD_VERSION == "GD_VERSION") {
- return 1;
- }
-
- return 0;
- }
-
- $response = array('zips' => checkZipSupport(), 'thumbs' => checkGdSupport());
+ $response = array(
+ 'php' => true,
+ 'zips' => class_exists("ZipArchive"),
+ 'thumbs' => GD_VERSION != "GD_VERSION"
+ );
echo json_encode($response);
}
diff --git a/src/_h5ai/php/inc/ZipIt.php b/src/_h5ai/php/inc/ZipIt.php
index a926b3bc..597abd0b 100644
--- a/src/_h5ai/php/inc/ZipIt.php
+++ b/src/_h5ai/php/inc/ZipIt.php
@@ -5,6 +5,12 @@ class ZipIt {
private $h5ai;
+ public static function isUsable() {
+
+ return class_exists("ZipArchive");
+ }
+
+
public function __construct($h5ai) {
$this->h5ai = $h5ai;