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', 'url' => 'testip.php',
'info' => 'Test if IP is banned', 'info' => 'Test if IP is banned',
), ),
7 => // 7 =>
array ( // array (
'id' => 8, // 'id' => 8,
'name' => 'Add Bonus Points', // 'name' => 'Add Bonus Points',
'url' => 'amountbonus.php', // 'url' => 'amountbonus.php',
'info' => 'Add Bonus Points to one or All Users.', // 'info' => 'Add Bonus Points to one or All Users.',
), // ),
8 => 8 =>
array ( array (
'id' => 9, 'id' => 9,
+26 -26
View File
@@ -14,97 +14,97 @@ class SysoppanelTableSeeder extends Seeder
*/ */
public function run() public function run()
{ {
\DB::table('sysoppanel')->delete(); \DB::table('sysoppanel')->delete();
\DB::table('sysoppanel')->insert(array ( \DB::table('sysoppanel')->insert(array (
0 => // 0 =>
array ( // array (
'id' => 1, // 'id' => 1,
'name' => 'Delete disabled users', // 'name' => 'Delete disabled users',
'url' => 'deletedisabled.php', // 'url' => 'deletedisabled.php',
'info' => 'Delete all disabled users', // 'info' => 'Delete all disabled users',
), // ),
1 => 1 =>
array ( array (
'id' => 2, 'id' => 2,
'name' => 'Manage tracker forum', 'name' => 'Manage tracker forum',
'url' => 'forummanage.php', 'url' => 'forummanage.php',
'info' => 'Edit/Delete forum', 'info' => 'Edit/Delete forum',
), ),
2 => 2 =>
array ( array (
'id' => 3, 'id' => 3,
'name' => 'MySQL Stats', 'name' => 'MySQL Stats',
'url' => 'mysql_stats.php', 'url' => 'mysql_stats.php',
'info' => 'See MySql stats', 'info' => 'See MySql stats',
), ),
3 => 3 =>
array ( array (
'id' => 4, 'id' => 4,
'name' => 'Mass mailer', 'name' => 'Mass mailer',
'url' => 'massmail.php', 'url' => 'massmail.php',
'info' => 'Send e-mail to all users on the tracker', 'info' => 'Send e-mail to all users on the tracker',
), ),
4 => 4 =>
array ( array (
'id' => 5, 'id' => 5,
'name' => 'Do cleanup', 'name' => 'Do cleanup',
'url' => 'docleanup.php', 'url' => 'docleanup.php',
'info' => 'Do cleanup functions', 'info' => 'Do cleanup functions',
), ),
5 => 5 =>
array ( array (
'id' => 6, 'id' => 6,
'name' => 'Ban System', 'name' => 'Ban System',
'url' => 'bans.php', 'url' => 'bans.php',
'info' => 'Ban / Unban IP', 'info' => 'Ban / Unban IP',
), ),
6 => 6 =>
array ( array (
'id' => 7, 'id' => 7,
'name' => 'Failed Logins', 'name' => 'Failed Logins',
'url' => 'maxlogin.php', 'url' => 'maxlogin.php',
'info' => 'Show Failed Login Attempts', 'info' => 'Show Failed Login Attempts',
), ),
7 => 7 =>
array ( array (
'id' => 8, 'id' => 8,
'name' => 'Bitbucket', 'name' => 'Bitbucket',
'url' => 'bitbucketlog.php', 'url' => 'bitbucketlog.php',
'info' => 'Bitbucket Log', 'info' => 'Bitbucket Log',
), ),
8 => 8 =>
array ( array (
'id' => 9, 'id' => 9,
'name' => 'Ban EMAIL address', 'name' => 'Ban EMAIL address',
'url' => 'bannedemails.php', 'url' => 'bannedemails.php',
'info' => 'Ban EMAILs stop registration.', 'info' => 'Ban EMAILs stop registration.',
), ),
9 => 9 =>
array ( array (
'id' => 10, 'id' => 10,
'name' => 'Allow EMAIL address', 'name' => 'Allow EMAIL address',
'url' => 'allowedemails.php', 'url' => 'allowedemails.php',
'info' => 'Allow EMAIL registration.', 'info' => 'Allow EMAIL registration.',
), ),
10 => 10 =>
array ( array (
'id' => 11, 'id' => 11,
'name' => 'Location', 'name' => 'Location',
'url' => 'location.php', 'url' => 'location.php',
'info' => 'Manage location and location speed', 'info' => 'Manage location and location speed',
), ),
11 => 11 =>
array ( array (
'id' => 12, 'id' => 12,
'name' => 'Add Upload', 'name' => 'Add Bonus/Attend card/Invite/upload',
'url' => 'amountupload.php', 'url' => 'increment-bulk.php',
'info' => 'Add upload to certain classes', 'info' => 'Add Bonus/Attend card/Invite/upload to certain classes',
), ),
)); ));
} }
} }
+8 -2
View File
@@ -229,8 +229,14 @@ function getLogFile()
return $logFile; return $logFile;
} }
$config = nexus_config('nexus'); $config = nexus_config('nexus');
$logFile = sys_get_temp_dir() . '/nexus_' . date('Y-m-d') . '.log'; $path = getenv('NEXUS_LOG_DIR', true);
if (!empty($config['log_file'])) { $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']; $logFile = $config['log_file'];
} }
$lastDotPos = strrpos($logFile, '.'); $lastDotPos = strrpos($logFile, '.');