mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-22 02:47:27 +08:00
fix getLogFile when use env
This commit is contained in:
@@ -40,6 +40,7 @@ class BackupCronjob extends Command
|
||||
{
|
||||
$force = $this->option('force');
|
||||
$this->info("force: $force");
|
||||
do_log("ENV: " . getenv('NEXUS_LOG_DIR', true) . ", logFile: " . getLogFile());
|
||||
$rep = new ToolRepository();
|
||||
$result = $rep->cronjobBackup($force);
|
||||
$log = sprintf(
|
||||
|
||||
@@ -177,7 +177,8 @@ function do_log($log, $level = 'info', $echo = false)
|
||||
|
||||
$logFile = getLogFile();
|
||||
if (($fd = fopen($logFile, 'a')) === false) {
|
||||
$fd = fopen(sys_get_temp_dir() . '/nexus.log', 'a');
|
||||
$log .= "--------Can not open $logFile";
|
||||
$fd = fopen(sys_get_temp_dir() . '/nexus.log', 'a');
|
||||
}
|
||||
$uid = 0;
|
||||
if (IN_NEXUS) {
|
||||
@@ -235,7 +236,7 @@ function getLogFile()
|
||||
$fromEnv = false;
|
||||
$path = sys_get_temp_dir();
|
||||
}
|
||||
$logFile = rtrim($path, '/') . '/nexus_' . date('Y-m-d') . '.log';
|
||||
$logFile = rtrim($path, '/') . '/nexus.log';
|
||||
if (!$fromEnv && !empty($config['log_file'])) {
|
||||
$logFile = $config['log_file'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user