2013-11-09 11:19:21 +01:00
|
|
|
<?php
|
2015-01-19 11:06:20 +01:00
|
|
|
/**
|
|
|
|
* ManiaControl Server Controller for ManiaPlanet Server
|
|
|
|
*
|
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
2020-01-22 10:39:35 +01:00
|
|
|
* @copyright 2014-2020 ManiaControl Team
|
2015-01-19 11:06:20 +01:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
|
|
|
*/
|
2013-11-10 12:51:41 +01:00
|
|
|
|
2014-05-24 21:09:55 +02:00
|
|
|
// Enable error reporting
|
|
|
|
error_reporting(E_ALL);
|
2023-01-16 10:55:46 +01:00
|
|
|
// Change MySQLi report to match with policy before PHP 8.1
|
|
|
|
mysqli_report(MYSQLI_REPORT_OFF);
|
2014-05-24 21:09:55 +02:00
|
|
|
|
2013-12-09 15:43:08 +01:00
|
|
|
// Run configuration
|
|
|
|
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-08-08 14:41:58 +02:00
|
|
|
define('MANIACONTROL_PATH', __DIR__ . DIRECTORY_SEPARATOR);
|
2013-11-09 11:19:21 +01:00
|
|
|
|
|
|
|
// Set process settings
|
2017-05-14 16:57:16 +02:00
|
|
|
ini_set('memory_limit', '128M');
|
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();
|
|
|
|
|
2023-12-01 19:05:24 +01:00
|
|
|
// Listen process signals
|
|
|
|
pcntl_async_signals(true);
|
|
|
|
|
2014-06-17 22:15:35 +02:00
|
|
|
// Register AutoLoader
|
2014-08-08 14:41:58 +02:00
|
|
|
require_once MANIACONTROL_PATH . 'core' . DIRECTORY_SEPARATOR . 'AutoLoader.php';
|
2014-06-17 22:15:35 +02:00
|
|
|
\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
|
|
|
|
2017-05-24 10:11:42 +02:00
|
|
|
|
|
|
|
$devMode = \ManiaControl\Utils\CommandLineHelper::getParameter('-dev');
|
|
|
|
|
|
|
|
if($devMode === "true"){
|
|
|
|
define('DEV_MODE', true); // Development mode to not send error reports etc.
|
|
|
|
}else{
|
|
|
|
define('DEV_MODE', false); // Development mode to not send error reports etc.
|
|
|
|
}
|
|
|
|
|
|
|
|
if(DEV_MODE){
|
|
|
|
\ManiaControl\Logger::log('Starting ManiaControl with activated Development Mode...');
|
|
|
|
}else{
|
|
|
|
\ManiaControl\Logger::log('Starting ManiaControl...');
|
|
|
|
}
|
2014-04-13 12:34:45 +02:00
|
|
|
|
2014-06-17 22:25:33 +02:00
|
|
|
// Check requirements
|
|
|
|
\ManiaControl\Utils\SystemUtil::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();
|