mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Prioritise posix_getuid() when attempting to find current process owner (#10137)
This commit is contained in:
parent
766a024a03
commit
b1eb9514d4
@ -36,17 +36,20 @@ class TempFolder
|
||||
*/
|
||||
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) {
|
||||
$user = Environment::getEnv('USER');
|
||||
}
|
||||
if (!$user) {
|
||||
$user = Environment::getEnv('USERNAME');
|
||||
}
|
||||
if (!$user && function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
|
||||
$userDetails = posix_getpwuid(posix_getuid());
|
||||
$user = $userDetails['name'];
|
||||
}
|
||||
if (!$user) {
|
||||
$user = 'unknown';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user