From cc45abdf3685e95a8ad06c88054683458320d08d Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Sun, 20 Dec 2015 07:45:45 -0500
Subject: [PATCH] add minimum php-version 5.3.3 to installer and updater

---
 install/install.php                |    8 ++++++++
 install/lib/installer_base.lib.php |    6 ++++++
 install/update.php                 |    1 +
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/install/install.php b/install/install.php
index 7b883ad..f82d828 100644
--- a/install/install.php
+++ b/install/install.php
@@ -139,6 +139,7 @@
 //** Installer Interface
 //****************************************************************************************************
 $inst = new installer();
+if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n");
 
 swriteln($inst->lng('    Following will be a few questions for primary configuration so be careful.'));
 swriteln($inst->lng('    Default values are in [brackets] and can be accepted with <ENTER>.'));
@@ -157,6 +158,13 @@
 	die('ISPConfig 3 installation found. Please use update.php instead if install.php to update the installation.');
 }
 
+//** Detect php-version
+$MIN_PHP='5.6';
+if (version_compare(PHP_VERSION, $MIN_PHP, '<')) {
+    echo 'ISPConfig requieres PHP '.$MIN_PHP.'. Installed version: ' . PHP_VERSION . "\n";
+}
+
+
 //** Detect the installed applications
 $inst->find_installed_apps();
 
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index c333a5e..a3640ab 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -36,6 +36,7 @@
 	public $conf;
 	public $install_ispconfig_interface = true;
 	public $is_update = false; // true if it is an update, falsi if it is a new install
+	public $min_php = '5.3.3'; // minimal php-version for update / install
 	protected $mailman_group = 'list';
 
 
@@ -130,6 +131,11 @@
 	}
 	*/
 
+	//** Detect PHP-Version
+	public function get_php_version() {
+		if(version_compare(PHP_VERSION, $this->min_php, '<')) return false; else return true;
+	}
+
 	//** Detect installed applications
 	public function find_installed_apps() {
 		global $conf;
diff --git a/install/update.php b/install/update.php
index 840a52a..60cd81b 100644
--- a/install/update.php
+++ b/install/update.php
@@ -174,6 +174,7 @@
 $conf['ispconfig_log_priority'] = $conf_old["log_priority"];
 
 $inst = new installer();
+if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n");
 $inst->is_update = true;
 
 //** Detect the installed applications

--
Gitblit v1.9.1