2013-11-09 11:19:21 +01:00
|
|
|
<?php
|
2013-11-10 12:51:41 +01:00
|
|
|
|
2014-05-24 21:09:55 +02:00
|
|
|
// Enable error reporting
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
|
2013-12-09 15:43:08 +01:00
|
|
|
// Run configuration
|
2014-06-12 14:30:11 +02:00
|
|
|
define('DEV_MODE', false); // Development mode to not send error reports etc.
|
2013-12-09 15:43:08 +01:00
|
|
|
define('LOG_NAME_USE_DATE', true); // Use current date as suffix for log file name in logs folder
|
|
|
|
define('LOG_NAME_USE_PID', true); // Use current process id as suffix for log file name in logs folder
|
2014-05-02 17:50:30 +02:00
|
|
|
|
2013-11-10 02:55:08 +01:00
|
|
|
// Define base dir
|
2014-05-03 21:37:28 +02:00
|
|
|
define('ManiaControlDir', __DIR__ . DIRECTORY_SEPARATOR);
|
2013-11-09 11:19:21 +01:00
|
|
|
|
2014-03-19 11:11:25 +01:00
|
|
|
// Define fatal error level
|
|
|
|
define('E_FATAL', E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_USER_ERROR);
|
|
|
|
|
2014-06-12 15:25:40 +02:00
|
|
|
// Min PHP Version
|
|
|
|
define('MIN_PHP_VERSION', '5.4');
|
|
|
|
|
2013-11-09 11:19:21 +01:00
|
|
|
// Set process settings
|
2013-12-09 15:43:08 +01:00
|
|
|
ini_set('memory_limit', '64M');
|
2014-05-24 20:48:32 +02:00
|
|
|
if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
|
|
|
|
date_default_timezone_set('UTC');
|
2013-11-09 11:19:21 +01:00
|
|
|
}
|
|
|
|
|
2014-06-17 22:15:35 +02:00
|
|
|
// Make sure garbage collection is enabled
|
|
|
|
gc_enable();
|
|
|
|
|
|
|
|
// Register AutoLoader
|
|
|
|
require_once ManiaControlDir . 'core' . DIRECTORY_SEPARATOR . 'AutoLoader.php';
|
|
|
|
\ManiaControl\AutoLoader::register();
|
2014-06-12 15:02:48 +02:00
|
|
|
|
2014-06-17 22:15:35 +02:00
|
|
|
// Setup Logger
|
|
|
|
\ManiaControl\Logger::setup();
|
2013-11-09 11:19:21 +01:00
|
|
|
|
2014-05-24 21:09:55 +02:00
|
|
|
/**
|
|
|
|
* Log and echo the given text
|
|
|
|
*
|
|
|
|
* @param string $message
|
|
|
|
* @param bool $eol
|
|
|
|
*/
|
2014-06-12 14:30:11 +02:00
|
|
|
function logMessage($message, $eol = true) {
|
|
|
|
error_log($message);
|
2014-06-12 15:02:48 +02:00
|
|
|
if ($eol) {
|
|
|
|
$message = '[' . date('d-M-Y H:i:s e') . '] ' . $message . PHP_EOL;
|
|
|
|
}
|
|
|
|
echo $message;
|
2013-12-09 15:43:08 +01:00
|
|
|
}
|
2013-11-10 02:55:08 +01:00
|
|
|
|
2014-06-12 14:30:11 +02:00
|
|
|
logMessage('Starting ManiaControl...');
|
2014-04-13 12:34:45 +02:00
|
|
|
|
2014-05-24 21:09:55 +02:00
|
|
|
/**
|
2014-06-12 15:02:48 +02:00
|
|
|
* Check for the requirements to run ManiaControl
|
2014-05-24 21:09:55 +02:00
|
|
|
*/
|
2014-06-12 15:02:48 +02:00
|
|
|
function checkRequirements() {
|
|
|
|
// Check for min PHP version
|
2014-06-12 15:21:33 +02:00
|
|
|
$phpVersion = phpversion();
|
2014-06-12 15:50:13 +02:00
|
|
|
$message = 'Checking for minimum required PHP-Version ' . MIN_PHP_VERSION . ' ... ';
|
2014-06-12 15:21:33 +02:00
|
|
|
if ($phpVersion < MIN_PHP_VERSION) {
|
|
|
|
logMessage($message . $phpVersion . ' TOO OLD VERSION!');
|
|
|
|
logMessage(' -- Make sure that you install at least PHP ' . MIN_PHP_VERSION . '!');
|
2014-06-12 15:02:48 +02:00
|
|
|
exit();
|
|
|
|
}
|
2014-06-12 15:21:33 +02:00
|
|
|
logMessage($message . MIN_PHP_VERSION . ' OK!');
|
2014-06-12 15:02:48 +02:00
|
|
|
|
|
|
|
// Check for MySQLi
|
2014-06-12 15:21:33 +02:00
|
|
|
$message = 'Checking for installed MySQLi ... ';
|
2014-06-12 15:02:48 +02:00
|
|
|
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
|
2014-06-12 15:21:33 +02:00
|
|
|
$message = 'Checking for installed cURL ... ';
|
2014-06-12 15:02:48 +02:00
|
|
|
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!');
|
2014-04-13 12:34:45 +02:00
|
|
|
}
|
|
|
|
|
2014-06-12 15:02:48 +02:00
|
|
|
checkRequirements();
|
2014-04-13 12:34:45 +02:00
|
|
|
|
2013-12-09 15:43:08 +01:00
|
|
|
// Start ManiaControl
|
2014-01-27 09:07:25 +01:00
|
|
|
$maniaControl = new \ManiaControl\ManiaControl();
|
2013-11-10 02:55:08 +01:00
|
|
|
$maniaControl->run();
|