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