mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Add fast PHP version check and exit.
This commit is contained in:
parent
d4e349f260
commit
85be66886a
4 changed files with 29 additions and 14 deletions
|
@ -162,6 +162,12 @@ modulejs.define('main/info', ['$', 'config'], function ($, config) {
|
|||
|
||||
function init() {
|
||||
|
||||
if (config.err === 'ERR_PHP') {
|
||||
$(testsTemp).appendTo('#content');
|
||||
addTest('PHP version', config.msg, false, config.ver);
|
||||
return;
|
||||
}
|
||||
|
||||
addLogin();
|
||||
if (setup.AS_ADMIN) {
|
||||
addTests();
|
||||
|
|
8
src/_h5ai/server/php/config.php
Normal file
8
src/_h5ai/server/php/config.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
/*********************************************************************
|
||||
SHA1 hash of the info page password, the preset password is the
|
||||
empty string. You might change it to keep this information private.
|
||||
Online hash generator: http://www.sha1.cz/
|
||||
*********************************************************************/
|
||||
define("PASSHASH", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
|
@ -19,7 +19,7 @@ class Bootstrap {
|
|||
$api->apply();
|
||||
} else {
|
||||
define("FALLBACK", $app->get_fallback());
|
||||
normalized_require_once("page");
|
||||
normalized_require_once("inc/page");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ class Bootstrap {
|
|||
setlocale(LC_CTYPE, "en_US.UTF-8");
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
|
||||
define("MIN_PHP_VERSION", "5.4.0");
|
||||
define("HAS_MIN_PHP_VERSION", version_compare(PHP_VERSION, MIN_PHP_VERSION) >= 0);
|
||||
define("HAS_PHP_EXIF", function_exists("exif_thumbnail"));
|
||||
$has_php_jpeg = false;
|
||||
if (function_exists("gd_info")) {
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
<?php
|
||||
|
||||
define("MIN_PHP_VERSION", "5.4.0");
|
||||
define("HAS_MIN_PHP_VERSION", version_compare(PHP_VERSION, MIN_PHP_VERSION) >= 0);
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
SHA1 hash of the info page password, the preset password is the
|
||||
empty string. You might change it to keep this information private.
|
||||
Online hash generator: http://www.sha1.cz/
|
||||
*********************************************************************/
|
||||
define("PASSHASH", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
||||
|
||||
|
||||
if (!HAS_MIN_PHP_VERSION) {
|
||||
header("Content-type: application/json;charset=utf-8");
|
||||
echo json_encode(array(
|
||||
"err" => "ERR_PHP",
|
||||
"msg" => "PHP " . MIN_PHP_VERSION . "+ required, only found " . PHP_VERSION,
|
||||
"ver" => PHP_VERSION
|
||||
));
|
||||
exit;
|
||||
}
|
||||
|
||||
function normalized_require_once($lib) {
|
||||
|
||||
require_once(preg_replace("#[\\\\/]+#", "/", dirname(__FILE__) . "/inc/${lib}.php"));
|
||||
require_once(preg_replace("#[\\\\/]+#", "/", dirname(__FILE__) . "/${lib}.php"));
|
||||
}
|
||||
|
||||
function __autoload($class_name) {
|
||||
|
||||
normalized_require_once("class-" . strtolower($class_name));
|
||||
normalized_require_once("inc/class-" . strtolower($class_name));
|
||||
}
|
||||
|
||||
normalized_require_once("config");
|
||||
Bootstrap::run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue