requirements check in SystemUtil
This commit is contained in:
parent
621c795a54
commit
1e641f69c6
@ -49,40 +49,8 @@ function logMessage($message, $eol = true) {
|
|||||||
|
|
||||||
logMessage('Starting ManiaControl...');
|
logMessage('Starting ManiaControl...');
|
||||||
|
|
||||||
/**
|
// Check requirements
|
||||||
* Check for the requirements to run ManiaControl
|
\ManiaControl\Utils\SystemUtil::checkRequirements();
|
||||||
*/
|
|
||||||
function checkRequirements() {
|
|
||||||
// Check for min PHP version
|
|
||||||
$phpVersion = phpversion();
|
|
||||||
$message = 'Checking for minimum required PHP-Version ' . MIN_PHP_VERSION . ' ... ';
|
|
||||||
if ($phpVersion < MIN_PHP_VERSION) {
|
|
||||||
logMessage($message . $phpVersion . ' TOO OLD VERSION!');
|
|
||||||
logMessage(' -- Make sure that you install at least PHP ' . MIN_PHP_VERSION . '!');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
logMessage($message . MIN_PHP_VERSION . ' OK!');
|
|
||||||
|
|
||||||
// Check for MySQLi
|
|
||||||
$message = 'Checking for installed MySQLi ... ';
|
|
||||||
if (!extension_loaded('mysqli')) {
|
|
||||||
logMessage($message . 'NOT FOUND!');
|
|
||||||
logMessage(" -- You don't have MySQLi installed! Check: http://www.php.net/manual/en/mysqli.installation.php");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
logMessage($message . 'FOUND!');
|
|
||||||
|
|
||||||
// Check for cURL
|
|
||||||
$message = 'Checking for installed cURL ... ';
|
|
||||||
if (!extension_loaded('curl')) {
|
|
||||||
logMessage($message . 'NOT FOUND!');
|
|
||||||
logMessage(" -- You don't have cURL installed! Check: http://www.php.net/manual/en/curl.installation.php");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
logMessage($message . 'FOUND!');
|
|
||||||
}
|
|
||||||
|
|
||||||
checkRequirements();
|
|
||||||
|
|
||||||
// Start ManiaControl
|
// Start ManiaControl
|
||||||
$maniaControl = new \ManiaControl\ManiaControl();
|
$maniaControl = new \ManiaControl\ManiaControl();
|
||||||
|
@ -61,8 +61,51 @@ class SystemUtil {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getDisabledFunctions() {
|
protected static function getDisabledFunctions() {
|
||||||
$disabledText = ini_get('disable_functions');
|
$disabledText = ini_get('disable_functions');
|
||||||
return explode(',', $disabledText);
|
return explode(',', $disabledText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for the Requirements to run ManiaControl
|
||||||
|
*/
|
||||||
|
public static function checkRequirements() {
|
||||||
|
$success = true;
|
||||||
|
|
||||||
|
// Check for min PHP version
|
||||||
|
$phpVersion = phpversion();
|
||||||
|
$message = 'Checking for minimum required PHP-Version ' . MIN_PHP_VERSION . ' ... ';
|
||||||
|
if ($phpVersion < MIN_PHP_VERSION) {
|
||||||
|
logMessage($message . $phpVersion . ' TOO OLD VERSION!');
|
||||||
|
logMessage(' -- Make sure that you install at least PHP ' . MIN_PHP_VERSION . '!');
|
||||||
|
$success = false;
|
||||||
|
} else {
|
||||||
|
logMessage($message . MIN_PHP_VERSION . ' OK!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for MySQLi
|
||||||
|
$message = 'Checking for installed MySQLi ... ';
|
||||||
|
if (!extension_loaded('mysqli')) {
|
||||||
|
logMessage($message . 'NOT FOUND!');
|
||||||
|
logMessage(" -- You don't have MySQLi installed! Check: http://www.php.net/manual/en/mysqli.installation.php");
|
||||||
|
$success = false;
|
||||||
|
} else {
|
||||||
|
logMessage($message . 'FOUND!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for cURL
|
||||||
|
$message = 'Checking for installed cURL ... ';
|
||||||
|
if (!extension_loaded('curl')) {
|
||||||
|
logMessage($message . 'NOT FOUND!');
|
||||||
|
logMessage(" -- You don't have cURL installed! Check: http://www.php.net/manual/en/curl.installation.php");
|
||||||
|
$success = false;
|
||||||
|
} else {
|
||||||
|
logMessage($message . 'FOUND!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$success) {
|
||||||
|
// Missing requirements
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user