|
@@ 582-596 (lines=15) @@
|
| 579 |
|
* @throws ClientExceptions |
| 580 |
|
* @throws Exception |
| 581 |
|
*/ |
| 582 |
|
public function setDigestAuth($user, $password, $enableDigestAuth = true) |
| 583 |
|
{ |
| 584 |
|
$params = ['user' => $user, 'password' => $password, 'digestauth' => (int) $enableDigestAuth]; |
| 585 |
|
$result = $this->client->sendRequest("/json-api/set_digest_auth", "GET", $params); |
| 586 |
|
|
| 587 |
|
if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
| 588 |
|
throw new ClientExceptions($result['metadata']['reason']); |
| 589 |
|
} |
| 590 |
|
|
| 591 |
|
if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
| 592 |
|
return true; |
| 593 |
|
} |
| 594 |
|
|
| 595 |
|
return false; |
| 596 |
|
} |
| 597 |
|
|
| 598 |
|
/** |
| 599 |
|
* This function checks whether a cPanel user's home directory contains a valid .my.cnf file. |
|
@@ 898-912 (lines=15) @@
|
| 895 |
|
* @throws ClientExceptions |
| 896 |
|
* @throws Exception |
| 897 |
|
*/ |
| 898 |
|
public function remove($username, $keepDNS = false) |
| 899 |
|
{ |
| 900 |
|
$params = ['user' => $username, 'keepdns' => (int) $keepDNS]; |
| 901 |
|
$result = $this->client->sendRequest("/json-api/removeacct", "GET", $params); |
| 902 |
|
|
| 903 |
|
if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
| 904 |
|
throw new ClientExceptions($result['metadata']['reason']); |
| 905 |
|
} |
| 906 |
|
|
| 907 |
|
if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
| 908 |
|
return true; |
| 909 |
|
} |
| 910 |
|
|
| 911 |
|
return false; |
| 912 |
|
} |
| 913 |
|
} |
| 914 |
|
|