Private GIT

Skip to content
Snippets Groups Projects
Unverified Commit ae71497c authored by Gary Allan's avatar Gary Allan
Browse files

Refactor: Add $allow_untested_php_versions=true; config.php option for development & testing.

parent 903fdb12
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
if (defined("GIT_VCS_REF")) { if (defined("GIT_VCS_REF")) {
print " git <a href='https://github.com/phpipam/phpipam/tree/".GIT_VCS_REF."'>".GIT_VCS_REF."</a>"; print " git <a href='https://github.com/phpipam/phpipam/tree/".GIT_VCS_REF."'>".GIT_VCS_REF."</a>";
} }
if (phpversion() >= UNSUPPORTED_PHP_VERSION) {
print " "._('UNSUPPORTED_PHP_VERSION').":".phpversion();
}
?> ?>
</td> </td>
......
...@@ -11,7 +11,8 @@ $requiredExt = array("session", "sockets", "filter", "openssl", "gmp", "json", ...@@ -11,7 +11,8 @@ $requiredExt = array("session", "sockets", "filter", "openssl", "gmp", "json",
# Required functions (included in php-xml or php-simplexml package) # Required functions (included in php-xml or php-simplexml package)
$requiredFns = array("simplexml_load_string"); $requiredFns = array("simplexml_load_string");
$UNSUPPORTED_PHP_VERSION = "8.0"; if(!defined('UNSUPPORTED_PHP_VERSION'))
define('UNSUPPORTED_PHP_VERSION', "8.0");
# Empty missing arrays to prevent errors # Empty missing arrays to prevent errors
...@@ -57,29 +58,29 @@ $error[] = '<link rel="stylesheet" type="text/css" href="css//bootstrap/bootstra ...@@ -57,29 +58,29 @@ $error[] = '<link rel="stylesheet" type="text/css" href="css//bootstrap/bootstra
$error[] = "</head>"; $error[] = "</head>";
$error[] = "<body style='margin:0px;'>"; $error[] = "<body style='margin:0px;'>";
$error[] = '<div class="row header-install" id="header"><div class="col-xs-12">'; $error[] = '<div class="row header-install" id="header"><div class="col-xs-12">';
$error[] = '<div class="hero-unit" style="padding:20px;margin-bottom:10px;">'; $error[] = '<div class="hero-unit" style="padding:20px;margin-bottom:10px;">'._('phpIPAM requirements error').'</div>';
$error[] = '<a href="'.create_link(null,null,null,null,null,true).'">phpipam requirements error</a>';
$error[] = '</div>';
$error[] = '</div></div>'; $error[] = '</div></div>';
$error[] = "<div class='alert alert-danger' style='margin:auto;margin-top:20px;width:60%'>";
if ( PHP_INT_SIZE == 4 ) { if ( PHP_INT_SIZE == 4 ) {
/* 32-bit systems */ /* 32-bit systems */
$error[] = "<div class='alert alert-danger' style='margin:auto;margin-top:20px;width:500px;'><strong>"._('Not 64-bit system')."!</strong><br><hr>"; $error[] = "<strong>"._('Not 64-bit system')."!</strong><br><hr>";
$error[] = _('From release 1.4 on 64bit system is required!'); $error[] = _('From release 1.4 on 64bit system is required!');
} }
elseif ( phpversion() < "5.4" ) { elseif ( phpversion() < "5.4" ) {
$error[] = "<div class='alert alert-danger' style='margin:auto;margin-top:20px;width:500px;'><strong>"._('Unsupported PHP version')."!</strong><br><hr>"; $error[] = "<strong>"._('Unsupported PHP version')."!</strong><br><hr>";
$error[] = _('From release 1.3.2 on at least PHP version 5.4 is required!')."<br>"; $error[] = _('From release 1.3.2 on at least PHP version 5.4 is required!')."<br>";
$error[] = _("Detected PHP version: ").phpversion(); $error[] = _("Detected PHP version: ").phpversion();
} }
elseif ( phpversion() >= $UNSUPPORTED_PHP_VERSION ) { elseif ( phpversion() >= UNSUPPORTED_PHP_VERSION && !Config::ValueOf('allow_untested_php_versions', false) ) {
$error[] = "<div class='alert alert-danger' style='margin:auto;margin-top:20px;width:500px;'><strong>"._('Unsupported PHP version')."!</strong><br><hr>"; $error[] = "<strong>"._('Unsupported PHP version')."!</strong><br><hr>";
$error[] = _('phpIPAM is not yet compatible with this version of php!')."<br>"; $error[] = _("Detected PHP version: ").phpversion()." >= ".UNSUPPORTED_PHP_VERSION."<br><br>";
$error[] = _("Detected PHP version: ").phpversion()." >= $UNSUPPORTED_PHP_VERSION"; $error[] = _('phpIPAM is not yet compatible with this version of php.')." "._('You may encounter issues & errors.')."<br><br>";
$error[] = _('Please set <q>$allow_untested_php_versions=true;</q> in config.php to continue at your own risk.');
} }
elseif ( !empty($missingExt) ) { elseif ( !empty($missingExt) ) {
$error[] = "<div class='alert alert-danger' style='margin:auto;margin-top:20px;width:500px;'><strong>"._('The following required PHP extensions are missing').":</strong><br><hr>"; $error[] = "<strong>"._('The following required PHP extensions are missing').":</strong><br><hr>";
$error[] = '<ul>' . "\n"; $error[] = '<ul>' . "\n";
foreach ($missingExt as $missing) { foreach ($missingExt as $missing) {
$error[] = '<li>'. $missing .'</li>' . "\n"; $error[] = '<li>'. $missing .'</li>' . "\n";
...@@ -88,7 +89,7 @@ elseif ( !empty($missingExt) ) { ...@@ -88,7 +89,7 @@ elseif ( !empty($missingExt) ) {
$error[] = _('Please recompile PHP to include missing extensions and restart Apache.'); $error[] = _('Please recompile PHP to include missing extensions and restart Apache.');
} }
elseif ( !empty($missingFns) ) { elseif ( !empty($missingFns) ) {
$error[] = "<div class='alert alert-danger' style='margin:auto;margin-top:20px;width:500px;'><strong>"._('The following required PHP functions are missing').":</strong><br><hr>"; $error[] = "<strong>"._('The following required PHP functions are missing').":</strong><br><hr>";
$error[] = '<ul>' . "\n"; $error[] = '<ul>' . "\n";
foreach ($missingFns as $missing) { foreach ($missingFns as $missing) {
$error[] = '<li>'. $missing .'</li>' . "\n"; $error[] = '<li>'. $missing .'</li>' . "\n";
...@@ -104,7 +105,9 @@ else { ...@@ -104,7 +105,9 @@ else {
if ( isset($error) ) { if ( isset($error) ) {
$error[] = "<br><br>\n"; $error[] = "<br><br>\n";
$error[] = _("Lastest version can be downloaded from ")." <a href='https://github.com/phpipam/phpipam/releases' target='_blank'>GitHub</a>."; $error[] = _("Lastest version can be downloaded from ")." <a href='https://github.com/phpipam/phpipam/releases' target='_blank'>GitHub</a>.";
$error[] = "</div>";
$error[] = "</body>"; $error[] = "</body>";
$error[] = "</html>"; $error[] = "</html>";
die(implode("\n", $error)); die(implode("\n", $error));
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment