fix(yunohostField) : run commands in background
This commit is contained in:
parent
9d7f33d5c9
commit
bd3a126572
1 changed files with 436 additions and 433 deletions
|
@ -97,7 +97,7 @@ class YunohostUserField extends BazarField
|
||||||
. ' -F \'' . $userValues['fullname'] . '\''
|
. ' -F \'' . $userValues['fullname'] . '\''
|
||||||
. ' -d ' . $this->userMailDomain
|
. ' -d ' . $this->userMailDomain
|
||||||
. ' -p \'' . $userValues['password'] . '\''
|
. ' -p \'' . $userValues['password'] . '\''
|
||||||
.' 2>&1';
|
. ' 2>&1 &';
|
||||||
exec($cmd, $output, $retval);
|
exec($cmd, $output, $retval);
|
||||||
// handle errors
|
// handle errors
|
||||||
if ($retval == 1) {
|
if ($retval == 1) {
|
||||||
|
@ -112,7 +112,7 @@ class YunohostUserField extends BazarField
|
||||||
}
|
}
|
||||||
$cmd = $this->cmdPrefix . ' yunohost user update ' . $userValues['name']
|
$cmd = $this->cmdPrefix . ' yunohost user update ' . $userValues['name']
|
||||||
. ' --add-mailforward ' . $userValues[$this->emailField]
|
. ' --add-mailforward ' . $userValues[$this->emailField]
|
||||||
.' 2>&1';
|
. ' 2>&1 &';
|
||||||
exec($cmd, $output, $retval);
|
exec($cmd, $output, $retval);
|
||||||
//dump($output);
|
//dump($output);
|
||||||
// handle errors
|
// handle errors
|
||||||
|
@ -184,8 +184,10 @@ class YunohostUserField extends BazarField
|
||||||
|
|
||||||
$wiki = $this->getWiki();
|
$wiki = $this->getWiki();
|
||||||
|
|
||||||
if ($this->getWiki()->UserIsAdmin()
|
if (
|
||||||
&& in_array($_POST[$this->propertyName.self::FORCE_LABEL] ?? false, [true,"true",1,"1"], true)) {
|
$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
|
// force entry creation but do not create user if existing for this email
|
||||||
$userManager = $this->getService(UserManager::class);
|
$userManager = $this->getService(UserManager::class);
|
||||||
$existingUser = $userManager->getOneByEmail($entry[$this->emailField]);
|
$existingUser = $userManager->getOneByEmail($entry[$this->emailField]);
|
||||||
|
@ -214,7 +216,8 @@ class YunohostUserField extends BazarField
|
||||||
if ($this->isUserByName($wikiName)) {
|
if ($this->isUserByName($wikiName)) {
|
||||||
$currentWikiName = strtolower($wikiName);
|
$currentWikiName = strtolower($wikiName);
|
||||||
$wikiName = $this->findANewNotExistingUserName($currentWikiName);
|
$wikiName = $this->findANewNotExistingUserName($currentWikiName);
|
||||||
if (!$isImport
|
if (
|
||||||
|
!$isImport
|
||||||
&& (
|
&& (
|
||||||
!isset($_POST[$this->propertyName . self::CONFIRM_NAME_SUFFIX])
|
!isset($_POST[$this->propertyName . self::CONFIRM_NAME_SUFFIX])
|
||||||
|| !in_array($_POST[$this->propertyName . self::CONFIRM_NAME_SUFFIX], [true, 1, "1"], true)
|
|| !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);
|
$userManager = $this->getService(UserManager::class);
|
||||||
$user = $userManager->getOneByName($userName);
|
$user = $userManager->getOneByName($userName);
|
||||||
$loggedUser = $authController->getLoggedUser();
|
$loggedUser = $authController->getLoggedUser();
|
||||||
if (!empty($user)
|
if (
|
||||||
|
!empty($user)
|
||||||
&& (
|
&& (
|
||||||
$this->getWiki()->UserIsAdmin()
|
$this->getWiki()->UserIsAdmin()
|
||||||
|| (
|
|| (
|
||||||
|
@ -475,4 +479,3 @@ class YunohostUserField extends BazarField
|
||||||
throw new UserFieldException('Impossible to find a new user name !');
|
throw new UserFieldException('Impossible to find a new user name !');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue