Skip to content

Commit f55c2ed

Browse files
authored
Update AMP.php to include Every time & Mode features
The every time flag allows the instances to be updated every time going forward. The Mode feature allows the server owners to choose if the Endpoints are displayed in a URL or IP Address format.
1 parent 82891b9 commit f55c2ed

1 file changed

Lines changed: 50 additions & 33 deletions

File tree

modules/servers/AMP/AMP.php

Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -166,38 +166,48 @@ function ($table) {
166166
} catch(e) {}
167167
168168
</script>';
169-
$fields = [
170-
'Provisioning Template' => array(
171-
'Type' => 'dropdown',
172-
'Options' => $options,
173-
'Description' => 'Choose one',
174-
),
175-
'Post Create Action' => array(
176-
'Type' => 'dropdown',
177-
'Options' =>
178-
[
179-
0 => 'Do nothing',
180-
1 => 'Start instance only',
181-
2 => 'Start instance and update application',
182-
3 => 'Full instance and application startup',
183-
],
184-
'Description' => 'Choose one'.$script,
185-
),
186-
'Required Tags' => array(
187-
'Type' => 'text',
188-
'Size' => '25',
189-
'Default' => '',
190-
'Description' => 'comma separated',
191-
),
192-
'Extra Provision Settings' => array(
193-
'Type' => 'text',
194-
'Size' => '25',
195-
'Default' => '',
196-
'Description' => $scriptExtraProvisionSettings,
197-
),
198-
199-
];
200-
return $fields;
169+
$fields = [
170+
'Provisioning Template' => array(
171+
'Type' => 'dropdown',
172+
'Options' => $options,
173+
'Description' => 'Choose a deployment template from AMP',
174+
),
175+
'Post Create Action' => array(
176+
'Type' => 'dropdown',
177+
'Options' =>
178+
[
179+
0 => 'Do nothing',
180+
1 => 'Start instance only',
181+
2 => 'Start instance & update application',
182+
3 => 'Full instance & application startup',
183+
],
184+
'Description' => '<br><br>Choose what happens after AMP has created the instance'.$script,
185+
),
186+
'Required Tags' => array(
187+
'Type' => 'text',
188+
'Size' => '25',
189+
'Default' => '',
190+
'Description' => '<br><br>Seperate the tags by using a comma. For more info, see module install guide',
191+
),
192+
'Extra Provision Settings' => array(
193+
'Type' => 'text',
194+
'Size' => '25',
195+
'Default' => '',
196+
'Description' => $scriptExtraProvisionSettings.'<br>',
197+
),
198+
'Update Every Time' => array(
199+
'Type' => 'yesno',
200+
'Description' => 'Tick this box to update the application every time the instance starts in the future',
201+
),
202+
"Mode" => array(
203+
'Type' => 'dropdown',
204+
'Options' => 'Standalone URL,Target/Node IP Address',
205+
'Default' => 'Target/Node IP Address',
206+
'Description' => '<br><br>Select how the Endpoints should be displayed on the Client section within WHMCS',
207+
)
208+
];
209+
return $fields;
210+
201211

202212
} catch (\Exception $ex) {
203213
if (App::getFromRequest('action') != 'save') {
@@ -268,7 +278,11 @@ function AMP_CreateAccount(array $params)
268278
AMP_commercialCheck($params);
269279
$client = new Client($params);
270280
$provisioningTemplateId = $params['configoption1'];
271-
$postCreate = !empty($params['configoption2']) ? $params['configoption2'] : 10;
281+
$postCreate = !empty($params['configoption2']) ? $params['configoption2'] : 0;
282+
// Check if the 'Every Time' box is ticked and if so, add 16 to the PostCreate value
283+
if (!empty($params['configoption5'])) {
284+
$postCreate += 16;
285+
}
272286
$templates = $client->call('ADSModule/GetDeploymentTemplates');
273287

274288
$options = [];
@@ -552,6 +566,9 @@ function AMP_ClientArea(array $params)
552566
}
553567
die;
554568
}
569+
570+
$vars['mode'] = isset($params['configoption6']) ? $params['configoption6'] : 'Standalone URL';
571+
555572

556573
if(!empty($service->instanceId))
557574
{

0 commit comments

Comments
 (0)