log path support env specific

This commit is contained in:
xiaomlove
2022-06-20 18:26:38 +08:00
parent 00d7dc6c37
commit 13a835f5bf
3 changed files with 41 additions and 35 deletions
+7 -7
View File
@@ -68,13 +68,13 @@ class ModpanelTableSeeder extends Seeder
'url' => 'testip.php',
'info' => 'Test if IP is banned',
),
7 =>
array (
'id' => 8,
'name' => 'Add Bonus Points',
'url' => 'amountbonus.php',
'info' => 'Add Bonus Points to one or All Users.',
),
// 7 =>
// array (
// 'id' => 8,
// 'name' => 'Add Bonus Points',
// 'url' => 'amountbonus.php',
// 'info' => 'Add Bonus Points to one or All Users.',
// ),
8 =>
array (
'id' => 9,
+10 -10
View File
@@ -19,13 +19,13 @@ class SysoppanelTableSeeder extends Seeder
\DB::table('sysoppanel')->delete();
\DB::table('sysoppanel')->insert(array (
0 =>
array (
'id' => 1,
'name' => 'Delete disabled users',
'url' => 'deletedisabled.php',
'info' => 'Delete all disabled users',
),
// 0 =>
// array (
// 'id' => 1,
// 'name' => 'Delete disabled users',
// 'url' => 'deletedisabled.php',
// 'info' => 'Delete all disabled users',
// ),
1 =>
array (
'id' => 2,
@@ -99,9 +99,9 @@ class SysoppanelTableSeeder extends Seeder
11 =>
array (
'id' => 12,
'name' => 'Add Upload',
'url' => 'amountupload.php',
'info' => 'Add upload to certain classes',
'name' => 'Add Bonus/Attend card/Invite/upload',
'url' => 'increment-bulk.php',
'info' => 'Add Bonus/Attend card/Invite/upload to certain classes',
),
));
+8 -2
View File
@@ -229,8 +229,14 @@ function getLogFile()
return $logFile;
}
$config = nexus_config('nexus');
$logFile = sys_get_temp_dir() . '/nexus_' . date('Y-m-d') . '.log';
if (!empty($config['log_file'])) {
$path = getenv('NEXUS_LOG_DIR', true);
$fromEnv = true;
if ($path === false) {
$fromEnv = false;
$path = sys_get_temp_dir();
}
$logFile = rtrim($path, '/') . '/nexus_' . date('Y-m-d') . '.log';
if (!$fromEnv && !empty($config['log_file'])) {
$logFile = $config['log_file'];
}
$lastDotPos = strrpos($logFile, '.');