|
|
@@ -100,7 +100,7 @@ class AccountController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- echo json_encode(['success' => 'User crreation successfully','details' => '']);
|
|
|
+ echo json_encode(['success' => 'User creation successfully','details' => '']);
|
|
|
}
|
|
|
|
|
|
public static function terminate($data): void {
|
|
|
@@ -132,26 +132,6 @@ class AccountController {
|
|
|
echo json_encode(['error' => 'Failed to reload PHP-FPM', 'details' => implode("\n", $phpOutput)]);
|
|
|
return;
|
|
|
}
|
|
|
- if(!empty($domain)) {
|
|
|
- $configFile = "/etc/apache2/sites-enabled/$domain.conf";
|
|
|
- if ($GLOBALS['debug'] == true) { error_log("Remove config of user : " . $username); }
|
|
|
- exec("sudo /usr/bin/rm -f $configFile 2>&1", $userOutput, $userReturnCode);
|
|
|
- exec("sudo /usr/bin/certbot delete --cert-name $domain --non-interactive 2>&1", $output, $returnCode);
|
|
|
- if ($returnCode !== 0) {
|
|
|
- error_log("deploy: ERROR: certbot failed to delete certificate on $domain, details => " . implode("\n", $output));
|
|
|
- http_response_code(500);
|
|
|
- echo json_encode(['error' => 'Certbot failed', 'details' => implode("\n", $output)]);
|
|
|
- return;
|
|
|
- }
|
|
|
- exec('sudo /usr/bin/systemctl reload apache2 2>&1', $apacheOutput, $apacheReturnCode);
|
|
|
- if ($GLOBALS['debug'] == true) { error_log("Restarting Apache"); }
|
|
|
- if ($apacheReturnCode !== 0) {
|
|
|
- error_log("deploy: ERROR: Apache Reload error, details => " . implode("\n", $apacheOutput));
|
|
|
- http_response_code(500);
|
|
|
- echo json_encode(['error' => 'Failed to reload Apache', 'details' => implode("\n", $apacheOutput)]);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
// Remove user and files
|
|
|
if ($GLOBALS['debug'] == true) {error_log("Remove User: " . $username); }
|
|
|
exec("sudo /usr/sbin/userdel -r -f $username 2>&1", $userOutput, $userReturnCode);
|