fixed log file name building
This commit is contained in:
parent
a3bc7bf1b0
commit
effc3c500c
@ -1,15 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Run configuration
|
// Run configuration
|
||||||
|
|
||||||
define('LOG_WRITE_CURRENT_FILE', 'ManiaControl.log'); // Write current log to extra file in base dir
|
define('LOG_WRITE_CURRENT_FILE', 'ManiaControl.log'); // Write current log to extra file in base dir
|
||||||
define('LOG_NAME_USE_DATE', true); // Use current date as suffix for log file name in logs folder
|
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
|
define('LOG_NAME_USE_PID', true); // Use current process id as suffix for log file name in logs folder
|
||||||
define('E_FATAL', E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_USER_ERROR);
|
|
||||||
|
|
||||||
// Define base dir
|
// Define base dir
|
||||||
define('ManiaControlDir', __DIR__);
|
define('ManiaControlDir', __DIR__);
|
||||||
|
|
||||||
|
// Define fatal error level
|
||||||
|
define('E_FATAL', E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_USER_ERROR);
|
||||||
|
|
||||||
// Set process settings
|
// Set process settings
|
||||||
ini_set('memory_limit', '64M');
|
ini_set('memory_limit', '64M');
|
||||||
if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) {
|
if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) {
|
||||||
@ -21,7 +22,7 @@ $logFileName = ManiaControlDir . '/logs/';
|
|||||||
if (!is_dir($logFileName)) {
|
if (!is_dir($logFileName)) {
|
||||||
mkdir($logFileName);
|
mkdir($logFileName);
|
||||||
}
|
}
|
||||||
$logFileName .= '/ManiaControl';
|
$logFileName .= 'ManiaControl';
|
||||||
if (LOG_NAME_USE_DATE) {
|
if (LOG_NAME_USE_DATE) {
|
||||||
$logFileName .= '_' . date('Y-m-d');
|
$logFileName .= '_' . date('Y-m-d');
|
||||||
}
|
}
|
||||||
@ -48,36 +49,36 @@ if (LOG_WRITE_CURRENT_FILE) {
|
|||||||
function logMessage($message) {
|
function logMessage($message) {
|
||||||
$message .= PHP_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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!file_put_contents(LOG_FILE, $message, FILE_APPEND)){
|
if (!file_put_contents(LOG_FILE, $message, FILE_APPEND)) {
|
||||||
echo "Logfile not Write-able, please check your file Permissions";
|
echo "Logfile not Write-able, please check your file Permissions";
|
||||||
}
|
}
|
||||||
echo $message;
|
echo $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Autoload Function that loads ManiaControl Class Files on Demand
|
// Autoload Function that loads ManiaControl Class Files on Demand
|
||||||
spl_autoload_register(function ($className) {
|
spl_autoload_register(
|
||||||
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className);
|
function ($className) {
|
||||||
|
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className);
|
||||||
// Core file
|
|
||||||
$classDirectoryPath = preg_replace('/ManiaControl/', 'core', $classPath, 1);
|
// Core file
|
||||||
$filePath = ManiaControlDir . DIRECTORY_SEPARATOR . $classDirectoryPath . '.php';
|
$classDirectoryPath = preg_replace('/ManiaControl/', 'core', $classPath, 1);
|
||||||
if (file_exists($filePath)) {
|
$filePath = ManiaControlDir . DIRECTORY_SEPARATOR . $classDirectoryPath . '.php';
|
||||||
require_once $filePath;
|
if (file_exists($filePath)) {
|
||||||
return;
|
require_once $filePath;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
// Plugin file
|
|
||||||
$filePath = ManiaControlDir . DIRECTORY_SEPARATOR . 'plugins/' . $classPath . '.php';
|
// Plugin file
|
||||||
if (file_exists($filePath)) {
|
$filePath = ManiaControlDir . DIRECTORY_SEPARATOR . 'plugins/' . $classPath . '.php';
|
||||||
require_once $filePath;
|
if (file_exists($filePath)) {
|
||||||
return;
|
require_once $filePath;
|
||||||
}
|
return;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Start ManiaControl
|
// Start ManiaControl
|
||||||
$maniaControl = new \ManiaControl\ManiaControl();
|
$maniaControl = new \ManiaControl\ManiaControl();
|
||||||
|
@ -220,7 +220,7 @@ class MapManager implements CallbackListener {
|
|||||||
//Unset the Map everywhere
|
//Unset the Map everywhere
|
||||||
$this->mapQueue->removeFromMapQueue($admin, $map->uid);
|
$this->mapQueue->removeFromMapQueue($admin, $map->uid);
|
||||||
|
|
||||||
if ($map->mx != null) {
|
if ($map->mx) {
|
||||||
$this->mxManager->unsetMap($map->mx->id);
|
$this->mxManager->unsetMap($map->mx->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user