client_delete_everything remote API call does not delete everything
client_delete_everything through the remoting API, related records are not removed. Example: for a client with 1 site and 1 shell user, calling this endpoint eventually results in the following information in
$db_table: shell_user $_SESSION: array ( 'client_login' => '0', 'client_sys_userid' => 0, ) $username: NULL $db_table: web_domain $_SESSION: array ( 'client_login' => '0', 'client_sys_userid' => 0, ) $username: NULL $db_table: client $_SESSION: array ( 'client_login' => '0', 'client_sys_userid' => 0, 's' => array ( 'user' => array ( 'typ' => 'admin', 'username' => 'admin', 'userid' => 1, 'default_group' => 1, 'groups' => 1, 'client_id' => 0, ), ), ) $username: 'admin'
So for some reason the $_SESSION['s'] is not filled until we want to insert the datalog to delete the client. I did not dig so deep to find the precise cause of that, because for our case the fix is simpler.
The inserting of this datalog line fails silently because the username is NULL, but the column sys_datalog.username cannot be null. So we can make the determination of the username a bit more precise by actually checking if we have a username, regardless of whether $_SESSION is set.
Not only the client should be deleted, but also all their sites, shell users, ...
Server OS: CentOS
Server OS version: 7 ISPConfig version: 3.1.14p2
PR will follow soon