Add PHP version check to setup.php

This commit is contained in:
Andrew Ruthven 2024-01-20 15:18:37 +13:00
parent 3bf44378fa
commit d42c3dc186
2 changed files with 17 additions and 0 deletions

View File

@ -286,6 +286,19 @@ function check_davical_version() {
return $result;
}
function check_php_version() {
global $c;
$result = new CheckResult(version_compare(phpversion(), $c->minimum_php_version, '>='));
if ( ! $result->getOK() ) {
$result->setDescription( sprintf(i18n('Minimum: %s, Currently: %s'), $c->minimum_php_version, phpversion()) );
$result->setClass('dep_fail');
} else {
$result->setDescription( sprintf(i18n('Passed: %s'), phpversion() . ' >= ' . $c->minimum_php_version) );
}
return $result;
}
function check_awl_version() {
global $c;
@ -337,6 +350,7 @@ function build_dependencies_table( ) {
$dependencies = array(
translate('Current DAViCal version ') => 'check_davical_version',
translate('PHP version ') => 'check_php_version',
translate('AWL Library version ') => 'check_awl_version',
translate('PHP not using Apache Filter mode') => 'check_real_php',
translate('PHP PDO module available') => 'check_pdo',

View File

@ -308,6 +308,9 @@ if ( isset($c->version_string) && preg_match( '/(\d+)\.(\d+)\.(\d+)(.*)/', $c->v
@header( sprintf('Server: %d.%d', $c->code_major, $c->code_minor) );
}
// What is our minimum supported version of PHP?
$c->minimum_php_version = '5.4.0';
/**
* Force the domain name to what was in the configuration file
*/