improved writable directory checking

This commit is contained in:
2024-04-22 12:03:24 +02:00
parent 3d4b179984
commit fcccf18644
2 changed files with 33 additions and 5 deletions

View File

@@ -298,6 +298,14 @@ function isClass(string $str): bool {
return is_file($path) && class_exists($str);
}
function getCurrentUsername(): string {
if (function_exists("posix_getpwuid") && function_exists("posix_geteuid")) {
return posix_getpwuid(posix_geteuid())['name'];
}
return exec('whoami') ?? "Unknown";
}
function rrmdir(string $dir): void {
if (is_dir($dir)) {
$objects = scandir($dir);