Skip to content

Commit a5b202a

Browse files
committed
updates using login/usernames instead of ids for termination
1 parent 1a23294 commit a5b202a

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

bin/get_client.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ function_requirements('get_webhosting_plesk_instance');
1515
$plesk = get_webhosting_plesk_instance((isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : false));
1616

1717
try {
18-
$result = $plesk->getClient();
18+
$result = $plesk->getClient([
19+
'username' => $_SERVER['argv'][2],
20+
]);
1921
} catch (ApiRequestException $e) {
2022
echo 'Exception Error: '.$e->getMessage();
2123
print_r($e);

src/Plesk.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,12 @@ public function curlInit($host, $login, $password)
5454
curl_setopt($this->curl, CURLOPT_POST, true);
5555
curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
5656
curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
57-
curl_setopt(
58-
$this->curl,
59-
CURLOPT_HTTPHEADER,
60-
[
57+
curl_setopt($this->curl, CURLOPT_HTTPHEADER, [
6158
"HTTP_AUTH_LOGIN: {$login}",
6259
"HTTP_AUTH_PASSWD: {$password}",
6360
'HTTP_PRETTY_PRINT: TRUE',
64-
'Content-Type: text/xml; charset=UTF-8'
65-
]
66-
);
61+
'Content-Type: text/xml; charset=UTF-8'
62+
]);
6763
return $this->curl;
6864
}
6965

src/Plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,15 @@ function_requirements('get_webhosting_plesk_instance');
358358
}
359359
myadmin_log(self::$module, 'info', 'deleteSite Called got '.json_encode($result), __LINE__, __FILE__, self::$module, $serviceClass->getId());
360360
*/
361-
$request = ['id' => $subscriptoinId];
361+
$request = ['owner-login' => $serviceClass->getUsername()];
362362
try {
363363
$result = $plesk->deleteSubscription($request);
364364
myadmin_log(self::$module, 'info', 'deleteSubscription Called got '.json_encode($result), __LINE__, __FILE__, self::$module, $serviceClass->getId());
365365
} catch (\Exception $e) {
366366
myadmin_log('plesk', 'error', 'deleteSubscription id:'.$subscriptoinId.' Caught exception: '.$e->getMessage(), __LINE__, __FILE__, self::$module, $serviceClass->getId());
367367
echo 'Caught exception: '.$e->getMessage().PHP_EOL;
368368
}
369-
$request = ['id' => $userId];
369+
$request = ['login' => $serviceClass->getUsername()];
370370
try {
371371
$result = $plesk->deleteClient($request);
372372
myadmin_log(self::$module, 'info', 'deleteClient Called got '.json_encode($result), __LINE__, __FILE__, self::$module, $serviceClass->getId());

0 commit comments

Comments
 (0)