Provison hanging
This commit is contained in:
@@ -10,31 +10,10 @@ class Home extends BaseController
|
||||
|
||||
public function index(): string
|
||||
{
|
||||
$template = array(
|
||||
'table_open' => "<table class='table table-sm table-striped table-hover table-bordered table-condensed'>",
|
||||
'thead_open' => '<thead class=\'bg-indigo\'>',
|
||||
'thead_close' => '</thead>',
|
||||
'heading_row_start' => '<tr>',
|
||||
'heading_row_end' => '</tr>',
|
||||
'heading_cell_start' => '<th>',
|
||||
'heading_cell_end' => '</th>',
|
||||
'tbody_open' => '<tbody>',
|
||||
'tbody_close' => '</tbody>',
|
||||
'row_start' => '<tr>',
|
||||
'row_end' => '</tr>',
|
||||
'cell_start' => '<td>',
|
||||
'cell_end' => '</td>',
|
||||
'row_alt_start' => '<tr>',
|
||||
'row_alt_end' => '</tr>',
|
||||
'cell_alt_start' => '<td>',
|
||||
'cell_alt_end' => '</td>',
|
||||
'table_close' => '</table>'
|
||||
);
|
||||
//$this->load->library('table');
|
||||
// $this->table->set_template($template);
|
||||
|
||||
$data['label_env'] = $this->what_env();
|
||||
$data["hanging_list"] = $this->getProvisionList(20);
|
||||
$data["hanging_list"] = $this->getProvisionList(15, 6);
|
||||
$data["completed_list"] = $this->getProvisionList(15, 7);
|
||||
$data["starting_list"] = $this->getProvisionList(15, 1);
|
||||
return view('welcome_message',$data);
|
||||
}
|
||||
|
||||
@@ -45,8 +24,8 @@ class Home extends BaseController
|
||||
return $curr_env;
|
||||
}
|
||||
|
||||
private function getProvisionList($limit){
|
||||
$mysql ="SELECT * FROM members_products ORDER BY id DESC LIMIT $limit";
|
||||
private function getProvisionList($limit,$status){
|
||||
$mysql ="SELECT * FROM members_products WHERE status = $status ORDER BY id DESC LIMIT $limit";
|
||||
$query = $this->db->query($mysql);
|
||||
return $query->getResult();
|
||||
}
|
||||
|
||||
@@ -537,6 +537,25 @@ class Provision extends BaseController
|
||||
|
||||
$this->provisionActions($memberID, $provisionUID, "Allocating Provisioning Ports");
|
||||
}
|
||||
|
||||
//Now let us try fix hanging stuffs
|
||||
$mysql = "SELECT id, member_id, uid, internal_url,product_id,status,provision_port,updated
|
||||
FROM members_products
|
||||
WHERE provision_port > 0
|
||||
AND status = 6
|
||||
AND added < now() - INTERVAL '5 minutes'
|
||||
ORDER BY updated ASC LIMIT 1";
|
||||
|
||||
$query = $this->db->query($mysql);
|
||||
$provision_list = $query->getResult();
|
||||
foreach ($provision_list as $pr) {
|
||||
$memberID = $pr->member_id;
|
||||
$productId = $pr->product_id;
|
||||
$provisionUID = $pr->uid;
|
||||
$mysql = "UPDATE members_products SET updated=now(), provision_status=0 WHERE uid::TEXT = '" . $provisionUID . "' AND provision_port > 0";
|
||||
$query = $this->db->query($mysql);
|
||||
}
|
||||
//SELECT * FROM members_products WHERE status = 6 AND added < now() - INTERVAL '5 minutes' LIMIT 1
|
||||
}
|
||||
|
||||
private function allocatePortNumber($productId)
|
||||
@@ -577,7 +596,7 @@ class Provision extends BaseController
|
||||
|
||||
private function provisionServer($productId)
|
||||
{
|
||||
$primaryServer ="";
|
||||
$primaryServer = "";
|
||||
switch ($productId) {
|
||||
case "A000001":
|
||||
case "A000002":
|
||||
@@ -611,7 +630,7 @@ class Provision extends BaseController
|
||||
[A000005_SERVER]
|
||||
172.16.4.95
|
||||
*/
|
||||
private function updateToNow($provisionUID):void
|
||||
private function updateToNow($provisionUID): void
|
||||
{
|
||||
try {
|
||||
$mysql = "UPDATE members_products SET updated=now(),
|
||||
|
||||
Reference in New Issue
Block a user