Added user functions

This commit is contained in:
absurdo 2023-11-25 01:55:21 +01:00
parent 824999f165
commit 21f93ef48f

View file

@ -5,7 +5,7 @@ namespace PhangoApp\LeviathanUtils;
class Linux { class Linux {
static public function shell_command($arr_command, $exit_if_error=0) { static public function shell_command($arr_command, $exit_if_error=1) {
$cmd=implode(' ', $arr_command); $cmd=implode(' ', $arr_command);
@ -25,7 +25,16 @@ class Linux {
echo 'Error executing command '.$cmd."\n"; echo 'Error executing command '.$cmd."\n";
exit($result); if($exit_if_error) {
exit($result);
}
else {
return $result;
}
} }
@ -88,6 +97,14 @@ class Linux {
if($password!='') { if($password!='') {
$hash=crypt($password, '$6$rounds=6000$'.PhangoApp\PhaUtils\Utils\generate_random_password(15).'$');
$str_user.=" -p \"${hash}\"";
}
if($group!='') {
} }
@ -96,7 +113,9 @@ class Linux {
} }
static public function delete_user($username) { static public function user_delete($username) {
} }