N°2517 - Supportability : system report (user name)

This commit is contained in:
Eric
2019-11-04 12:05:46 +01:00
parent 57116ef054
commit 9054dcb9ff
2 changed files with 11 additions and 1 deletions

View File

@@ -2172,4 +2172,14 @@ class utils
{
return APPROOT.'env-'.utils::GetCurrentEnvironment().'/'.$sModule.'/';
}
public static function GetCurrentUserName()
{
if (function_exists('posix_getpwuid'))
{
return posix_getpwuid(posix_geteuid())['name'];
}
return getenv('username');
}
}

View File

@@ -92,7 +92,7 @@ function RunTask($oProcess, BackgroundTask $oTask, $oStartDate, $iTimeLimit)
// Record (when starting) that this task was started, just in case it crashes during the execution
$oTask->Set('latest_run_date', $oDateStarted->format('Y-m-d H:i:s'));
// Record the current user running the cron
$oTask->Set('system_user', getenv("username"));
$oTask->Set('system_user', utils::GetCurrentUserName());
$oTask->DBUpdate();
$sMessage = $oProcess->Process($iTimeLimit);
}