Checking for MySQLi and cURL on startup
This commit is contained in:
parent
44c59b4cae
commit
9898009a82
@ -41,13 +41,38 @@ if (LOG_WRITE_CURRENT_FILE) {
|
|||||||
define('LOG_CURRENT_FILE', $currentLogFileName);
|
define('LOG_CURRENT_FILE', $currentLogFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logMessage('Starting ManiaControl ...');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checking if all the needed libraries are installed.
|
||||||
|
* - MySQLi
|
||||||
|
* - cURL
|
||||||
|
*/
|
||||||
|
logMessage('Checking for installed MySQLi ... ', false);
|
||||||
|
if (function_exists('mysqli_connect')) {
|
||||||
|
logMessage('FOUND!');
|
||||||
|
} else {
|
||||||
|
logMessage('NOT FOUND!');
|
||||||
|
logMessage(' -- You do not have MySQLi installed, make sure to check: http://www.php.net/manual/en/mysqli.installation.php');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logMessage('Checking for installed cURL ... ', false);
|
||||||
|
if(function_exists('curl_version')) {
|
||||||
|
logMessage('FOUND!');
|
||||||
|
} else {
|
||||||
|
logMessage('NOT FOUND!');
|
||||||
|
logMessage('You do not have cURL installed, make sure to check: http://www.php.net/manual/en/curl.installation.php');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log and echo the given text
|
* Log and echo the given text
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
function logMessage($message) {
|
function logMessage($message, $eol = true) {
|
||||||
$message .= PHP_EOL;
|
if($eol) $message .= PHP_EOL;
|
||||||
if (defined('LOG_CURRENT_FILE')) {
|
if (defined('LOG_CURRENT_FILE')) {
|
||||||
if (!file_put_contents(LOG_CURRENT_FILE, $message, FILE_APPEND)) {
|
if (!file_put_contents(LOG_CURRENT_FILE, $message, FILE_APPEND)) {
|
||||||
echo "Logfile not Write-able, please check your file Permissions";
|
echo "Logfile not Write-able, please check your file Permissions";
|
||||||
|
Loading…
Reference in New Issue
Block a user