Merge branch '4.9' into 4

This commit is contained in:
Steve Boyd 2021-11-18 17:24:41 +13:00
commit d2cbf5bc2a

View File

@ -36,17 +36,20 @@ class TempFolder
*/ */
public static function getTempFolderUsername() public static function getTempFolderUsername()
{ {
$user = Environment::getEnv('APACHE_RUN_USER'); $user = '';
if (function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
$userDetails = posix_getpwuid(posix_getuid());
$user = $userDetails['name'];
}
if (!$user) {
$user = Environment::getEnv('APACHE_RUN_USER');
}
if (!$user) { if (!$user) {
$user = Environment::getEnv('USER'); $user = Environment::getEnv('USER');
} }
if (!$user) { if (!$user) {
$user = Environment::getEnv('USERNAME'); $user = Environment::getEnv('USERNAME');
} }
if (!$user && function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
$userDetails = posix_getpwuid(posix_getuid());
$user = $userDetails['name'];
}
if (!$user) { if (!$user) {
$user = 'unknown'; $user = 'unknown';
} }