@@ 1066-1088 (lines=23) @@ | ||
1063 | ))); |
|
1064 | } |
|
1065 | ||
1066 | public function doInstallDomain() |
|
1067 | { |
|
1068 | if (!$this->CanConfigureApi()) { |
|
1069 | return $this->redirectBack(); |
|
1070 | } |
|
1071 | ||
1072 | $client = MailgunHelper::getClient(); |
|
1073 | ||
1074 | $domain = $this->getDomain(); |
|
1075 | ||
1076 | if (!$domain) { |
|
1077 | return $this->redirectBack(); |
|
1078 | } |
|
1079 | ||
1080 | try { |
|
1081 | $client->domains()->create($domain); |
|
1082 | $this->getCache()->clear(); |
|
1083 | } catch (Exception $ex) { |
|
1084 | $this->getLogger()->debug($ex); |
|
1085 | } |
|
1086 | ||
1087 | return $this->redirectBack(); |
|
1088 | } |
|
1089 | ||
1090 | /** |
|
1091 | * Uninstall domain form |
|
@@ 1120-1145 (lines=26) @@ | ||
1117 | ))); |
|
1118 | } |
|
1119 | ||
1120 | public function doUninstallDomain($data, Form $form) |
|
1121 | { |
|
1122 | if (!$this->CanConfigureApi()) { |
|
1123 | return $this->redirectBack(); |
|
1124 | } |
|
1125 | ||
1126 | $client = MailgunHelper::getClient(); |
|
1127 | ||
1128 | $domain = $this->getDomain(); |
|
1129 | ||
1130 | if (!$domain) { |
|
1131 | return $this->redirectBack(); |
|
1132 | } |
|
1133 | ||
1134 | try { |
|
1135 | $el = $this->SendingDomainInstalled(); |
|
1136 | if ($el) { |
|
1137 | $client->domains()->delete($domain); |
|
1138 | } |
|
1139 | $this->getCache()->clear(); |
|
1140 | } catch (Exception $ex) { |
|
1141 | $this->getLogger()->debug($ex); |
|
1142 | } |
|
1143 | ||
1144 | return $this->redirectBack(); |
|
1145 | } |
|
1146 | } |
|
1147 |