In one of my scripts I delete users using the CMD_API_SELECT_USERS call (using the httpsocket.php library). Recently I've encountered a few situations where the deletion successfully completes with no special information in any DirectAdmin logs, but the result is empty.
Here's the function that does the deletion, with a
The
I have not yet done any in depth debugging of this due to the fact that it's not really reproducible from what I can tell (it does not happen with all accounts). I was wondering if anyone had experienced similar issues and/or had any idea what might be causing this behaviour?
Here's the function that does the deletion, with a
print_r
for debugging purposes:
PHP:
function deleteAccount($sock, $strUser) {
$sock->set_method('POST');
$sock->query('/CMD_API_SELECT_USERS',
array(
'confirmed' => 'Confirm',
'delete' => 'yes',
'select0' => $strUser,
));
$resDeleteAccount = $sock->fetch_parsed_body();
print_r($resDeleteAccount);
if (isset($resDeleteAccount['error']) && $resDeleteAccount['error'] === '0') {
printAndLog("Deletion of " . $strUser . " has been completed.\n");
}
else {
printAndLog("There was a problem deleting the user " . $strUser . ": " . $resDeleteAccount['text'] . "\n");
printAndLog("Details: " . $resDeleteAccount['details'] . "\n");
}
}
The
print_r
shows this output:
PHP:
Array
(
)
I have not yet done any in depth debugging of this due to the fact that it's not really reproducible from what I can tell (it does not happen with all accounts). I was wondering if anyone had experienced similar issues and/or had any idea what might be causing this behaviour?