Skip to content

Commit 480c971

Browse files
committed
Fix undefined function shell_exec() in shared hosting.
1 parent a569f43 commit 480c971

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

  • app/code/community/Kiatng/Shooter/Helper

app/code/community/Kiatng/Shooter/Helper/Data.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,10 @@ public function getRunningUser(): string
7171
if (function_exists('posix_getpwuid')) {
7272
return posix_getpwuid(posix_geteuid())['name'];
7373
}
74-
$username = getenv('USERNAME');
75-
if (!$username) {
76-
$username = getenv('USER');
77-
}
78-
if (!$username) {
79-
$username = trim(shell_exec('whoami'));
80-
}
81-
return $username;
74+
75+
return getenv('USERNAME')
76+
?? getenv('USER')
77+
?? function_exists('shell_exec') ? trim(shell_exec('whoami')) : get_current_user();
8278
}
8379

8480
/**

0 commit comments

Comments
 (0)