fix(yunohostField) : run commands in background

This commit is contained in:
Florian Schmitt 2024-02-05 14:12:59 +03:00
parent 9d7f33d5c9
commit bd3a126572

View file

@ -97,7 +97,7 @@ class YunohostUserField extends BazarField
. ' -F \'' . $userValues['fullname'] . '\''
. ' -d ' . $this->userMailDomain
. ' -p \'' . $userValues['password'] . '\''
.' 2>&1';
. ' 2>&1 &';
exec($cmd, $output, $retval);
// handle errors
if ($retval == 1) {
@ -112,7 +112,7 @@ class YunohostUserField extends BazarField
}
$cmd = $this->cmdPrefix . ' yunohost user update ' . $userValues['name']
. ' --add-mailforward ' . $userValues[$this->emailField]
.' 2>&1';
. ' 2>&1 &';
exec($cmd, $output, $retval);
//dump($output);
// handle errors
@ -184,8 +184,10 @@ class YunohostUserField extends BazarField
$wiki = $this->getWiki();
if ($this->getWiki()->UserIsAdmin()
&& in_array($_POST[$this->propertyName.self::FORCE_LABEL] ?? false, [true,"true",1,"1"], true)) {
if (
$this->getWiki()->UserIsAdmin()
&& in_array($_POST[$this->propertyName . self::FORCE_LABEL] ?? false, [true, "true", 1, "1"], true)
) {
// force entry creation but do not create user if existing for this email
$userManager = $this->getService(UserManager::class);
$existingUser = $userManager->getOneByEmail($entry[$this->emailField]);
@ -214,7 +216,8 @@ class YunohostUserField extends BazarField
if ($this->isUserByName($wikiName)) {
$currentWikiName = strtolower($wikiName);
$wikiName = $this->findANewNotExistingUserName($currentWikiName);
if (!$isImport
if (
!$isImport
&& (
!isset($_POST[$this->propertyName . self::CONFIRM_NAME_SUFFIX])
|| !in_array($_POST[$this->propertyName . self::CONFIRM_NAME_SUFFIX], [true, 1, "1"], true)
@ -372,7 +375,8 @@ class YunohostUserField extends BazarField
$userManager = $this->getService(UserManager::class);
$user = $userManager->getOneByName($userName);
$loggedUser = $authController->getLoggedUser();
if (!empty($user)
if (
!empty($user)
&& (
$this->getWiki()->UserIsAdmin()
|| (
@ -475,4 +479,3 @@ class YunohostUserField extends BazarField
throw new UserFieldException('Impossible to find a new user name !');
}
}