mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 15:33:44 +01:00
commit
7e9d237fdd
17
README.md
17
README.md
@ -90,22 +90,25 @@ or
|
|||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
[![Screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data.jpg)
|
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-cards.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-cards.jpg)
|
||||||
|
|
||||||
|
[![My idlers screenshot2](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-table.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-table.jpg)
|
||||||
|
|
||||||
[![screenshot2](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-MORE-1.1.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-MORE-1.1.jpg)
|
[![My idlers screenshot3](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-more-modal.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-more-modal.jpg)
|
||||||
|
|
||||||
|
[![My idlers screenshot4](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-edit-modal.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-edit-modal.jpg)
|
||||||
|
|
||||||
[![screenshot3](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-EDIT-1.1.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-EDIT-1.1.jpg)
|
[![My idlers screenshot5](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-order-servers.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-order-servers.jpg)
|
||||||
|
|
||||||
|
[![My idlers screenshot6](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-search.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-search.jpg)
|
||||||
|
|
||||||
[![screenshot4](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-order-table.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-order-table.png)
|
[![My idlers screenshot7](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-summary-card.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-summary-card.jpg)
|
||||||
|
|
||||||
|
[![My idlers screenshot8](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-compare-two-servers.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-compare-two-servers.jpg)
|
||||||
|
|
||||||
[![screenshot5](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-tally-card.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-tally-card.png)
|
[![My idlers screenshot9](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-server-from-yabs.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-server-from-yabs.jpg)
|
||||||
|
|
||||||
[![screenshot6](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-table-view.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-table-view.png)
|
|
||||||
|
|
||||||
|
[![My idlers screenshot10](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-shared-hosting.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2021/02/my-idlers-self-hosted-server-info-add-shared-hosting.jpg)
|
||||||
|
|
||||||
[![Auto complete location](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif)
|
[![Auto complete location](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif)
|
||||||
|
|
||||||
|
@ -51,6 +51,9 @@ body {
|
|||||||
.container {
|
.container {
|
||||||
max-width: 720px
|
max-width: 720px
|
||||||
}
|
}
|
||||||
|
.nav-link {
|
||||||
|
padding: .5rem 0.45rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 992px) {
|
@media (min-width: 992px) {
|
||||||
@ -1184,10 +1187,27 @@ button.close {
|
|||||||
background: #00ff340f;
|
background: #00ff340f;
|
||||||
}
|
}
|
||||||
|
|
||||||
.objects-table th:first-child, .objects-table td:first-child {
|
.objects-table th:first-child, .objects-table td:first-child, .compare-table th:first-child, .compare-table td:first-child {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
left: 0;
|
left: 0;
|
||||||
background-color: #f6f6f6;
|
background-color: #f6f6f6;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare-table td, .compare-table th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plus-td {
|
||||||
|
background: #71ed7136;
|
||||||
|
}
|
||||||
|
|
||||||
|
.neg-td {
|
||||||
|
background: #ed827136;
|
||||||
|
}
|
||||||
|
|
||||||
|
.equal-td {
|
||||||
|
background: #6189ff26;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-btn {
|
.table-btn {
|
||||||
@ -1540,4 +1560,10 @@ input:checked + .slider:before {
|
|||||||
.modal-lg {
|
.modal-lg {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.nav-link {
|
||||||
|
padding: 0.5rem 0.45rem;
|
||||||
|
}
|
||||||
}
|
}
|
59
assets/js/scripts.min.js
vendored
59
assets/js/scripts.min.js
vendored
@ -18,6 +18,30 @@ jQuery Tags
|
|||||||
CUSTOM SCRIPTS/FUNCS
|
CUSTOM SCRIPTS/FUNCS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function YABSdebug(result){
|
||||||
|
if (result == 1){
|
||||||
|
return 'Success';
|
||||||
|
} else if (result == 2){
|
||||||
|
return 'Wrong version';
|
||||||
|
} else if (result == 3){
|
||||||
|
return 'Didnt start at right spot';
|
||||||
|
} else if (result == 4){
|
||||||
|
return 'Not correct format';
|
||||||
|
} else if (result == 5){
|
||||||
|
return 'Not a correct YABs command output';
|
||||||
|
} else if (result == 6){
|
||||||
|
return 'GeekBench 5 only allowed';
|
||||||
|
} else if (result == 7){
|
||||||
|
return 'GeekBench test failed';
|
||||||
|
} else if (result == 8){
|
||||||
|
return 'Didnt copy output correctly';
|
||||||
|
} else if (result == 9){
|
||||||
|
return 'Less than 50 lines';
|
||||||
|
} else {
|
||||||
|
return 'Unknown '+result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#yabsForm").submit(function (e) {
|
$("#yabsForm").submit(function (e) {
|
||||||
e.preventDefault(e);
|
e.preventDefault(e);
|
||||||
@ -26,7 +50,11 @@ $(document).ready(function () {
|
|||||||
url: "calls.php",
|
url: "calls.php",
|
||||||
data: $("#yabsForm").serialize(),
|
data: $("#yabsForm").serialize(),
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
location.reload();
|
if (result.length == 1) {
|
||||||
|
alert('ERROR: ' + YABSdebug(result));
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -155,8 +183,37 @@ $(document).ready(function () {
|
|||||||
} else if ($("#tableViewDiv").hasClass("active")){
|
} else if ($("#tableViewDiv").hasClass("active")){
|
||||||
loadTable();
|
loadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Compare section
|
||||||
|
$("#compare_s1").change(function () {
|
||||||
|
var server1_id = $("#compare_s1 option:selected").val();
|
||||||
|
var server2_id = $("#compare_s2 option:selected").val();
|
||||||
|
if (server2_id.length !== 0) {
|
||||||
|
compareTableCall(server1_id, server2_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#compare_s2").change(function () {
|
||||||
|
var server2_id = $("#compare_s2 option:selected").val();
|
||||||
|
var server1_id = $("#compare_s1 option:selected").val();
|
||||||
|
if (server1_id.length !== 0) {
|
||||||
|
compareTableCall(server1_id, server2_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function compareTableCall(id1, id2) {
|
||||||
|
$("#compareTableDiv").empty();
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "calls.php",
|
||||||
|
data: {"type": "compare_table", "server1": id1, "server2": id2},
|
||||||
|
success: function (result) {
|
||||||
|
$("#compareTableDiv").append(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function loadCards(){
|
function loadCards(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
14
calls.php
14
calls.php
@ -46,6 +46,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
|||||||
} elseif ($_GET['type'] == 'object_tables') {
|
} elseif ($_GET['type'] == 'object_tables') {
|
||||||
header('Content-Type: text/html; charset=utf-8');
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
echo $idle->objectTables();
|
echo $idle->objectTables();
|
||||||
|
} elseif ($_GET['type'] == 'compare_table') {
|
||||||
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
echo $idle->compareTable($_GET['server1'], $_GET['server2']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
@ -56,8 +59,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
|||||||
if (isset($_POST['action']) && $_POST['action'] == 'insert') {//From an insert 'type' form
|
if (isset($_POST['action']) && $_POST['action'] == 'insert') {//From an insert 'type' form
|
||||||
$insert = new itemInsert($_POST);
|
$insert = new itemInsert($_POST);
|
||||||
if (isset($_POST['from_yabs'])) {//From add form YABs
|
if (isset($_POST['from_yabs'])) {//From add form YABs
|
||||||
$insert->insertBasicWithYabs();//Insert basic data from form
|
$id = $insert->insertBasicWithYabs();//Insert basic data from form
|
||||||
$insert->insertYabsData();//Insert YABs data from the form
|
$response_code = $insert->insertYabsData();//Insert YABs data from the form
|
||||||
|
if ($response_code != 1) {
|
||||||
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
$update = new itemUpdate(array('me_server_id' => $id));
|
||||||
|
$update->deleteObjectData();
|
||||||
|
echo $response_code;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
} elseif (isset($_POST['manual'])) {//From add form manual
|
} elseif (isset($_POST['manual'])) {//From add form manual
|
||||||
$insert->insertBasic();
|
$insert->insertBasic();
|
||||||
} elseif (isset($_POST['shared_hosting_form'])) {//From shared hosting form
|
} elseif (isset($_POST['shared_hosting_form'])) {//From shared hosting form
|
||||||
|
464
class.php
464
class.php
@ -19,6 +19,8 @@ class idlersConfig
|
|||||||
const COLOR_TABLE = true;
|
const COLOR_TABLE = true;
|
||||||
|
|
||||||
const DEFAULT_VIEW = 'CARDS';//CARDS or TABLE
|
const DEFAULT_VIEW = 'CARDS';//CARDS or TABLE
|
||||||
|
|
||||||
|
const SAVE_YABS_OUTPUT = true;//true or false
|
||||||
}
|
}
|
||||||
|
|
||||||
class elementHelpers extends idlersConfig
|
class elementHelpers extends idlersConfig
|
||||||
@ -566,6 +568,20 @@ class helperFunctions extends elementHelpers
|
|||||||
$date = new DateTime($ahead_date);
|
$date = new DateTime($ahead_date);
|
||||||
return $date->diff($today)->format("%a");
|
return $date->diff($today)->format("%a");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function deleteYabsForId(string $id)
|
||||||
|
{
|
||||||
|
if ($handle = opendir("yabs/")) {
|
||||||
|
while (false !== ($file = readdir($handle))) {
|
||||||
|
if ('.' === $file) continue;
|
||||||
|
if (strpos($file, $id) !== false) {
|
||||||
|
unlink("yabs/$file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class idlers extends helperFunctions
|
class idlers extends helperFunctions
|
||||||
@ -596,7 +612,7 @@ class idlers extends helperFunctions
|
|||||||
|
|
||||||
protected function pageContents()
|
protected function pageContents()
|
||||||
{
|
{
|
||||||
$this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search'), array('#services', '#add_server', '#order', '#info', '#search'));
|
$this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search', 'Compare'), array('#services', '#add_server', '#order', '#info', '#search', '#compare'));
|
||||||
$this->outputString('<div id="myTabContent" class="tab-content">');
|
$this->outputString('<div id="myTabContent" class="tab-content">');
|
||||||
$this->outputString('<div class="tab-pane server-cards fade active show" id="services">');
|
$this->outputString('<div class="tab-pane server-cards fade active show" id="services">');
|
||||||
$this->viewSwitcherIcon();
|
$this->viewSwitcherIcon();
|
||||||
@ -649,6 +665,10 @@ class idlers extends helperFunctions
|
|||||||
|
|
||||||
$this->outputString('<div class="tab-pane fade" id="search">');
|
$this->outputString('<div class="tab-pane fade" id="search">');
|
||||||
$this->searchDiv();
|
$this->searchDiv();
|
||||||
|
$this->tagClose('div');
|
||||||
|
|
||||||
|
$this->outputString('<div class="tab-pane fade" id="compare">');
|
||||||
|
$this->compareSection();
|
||||||
$this->tagClose('div', 2);
|
$this->tagClose('div', 2);
|
||||||
|
|
||||||
$this->editServerModal();
|
$this->editServerModal();
|
||||||
@ -722,22 +742,23 @@ class idlers extends helperFunctions
|
|||||||
$row = $select->fetch();
|
$row = $select->fetch();
|
||||||
if ($row['has_yabs'] == 1 && $row['has_st'] == 1) {
|
if ($row['has_yabs'] == 1 && $row['has_st'] == 1) {
|
||||||
$select = $this->dbConnect()->prepare("
|
$select = $this->dbConnect()->prepare("
|
||||||
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
|
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,ram_mb,swap,swap_type,swap_mb,`disk`,disk_type,disk_gb,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
|
||||||
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
|
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`4k_as_mbps`,`64k`,`64k_type`,
|
||||||
|
`64k_as_mbps`,`512k`,`512k_type`,`512k_as_mbps`,`1m`,`1m_type`,`1m_as_mbps`,
|
||||||
loc.name as location,send,send_type,recieve,recieve_type,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
|
loc.name as location,send,send_type,recieve,recieve_type,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
|
||||||
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
|
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
|
||||||
INNER JOIN speed_tests st on servers.id = st.server_id INNER JOIN locations loc on servers.location = loc.id
|
INNER JOIN speed_tests st on servers.id = st.server_id INNER JOIN locations loc on servers.location = loc.id
|
||||||
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
|
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
|
||||||
$select->execute([$id]);
|
$select->execute([$id]);
|
||||||
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
|
$data = $select->fetchAll(PDO::FETCH_ASSOC)[0];
|
||||||
$sel_st = $this->dbConnect()->prepare("SELECT `location`, `send`, `send_type`, `recieve`, `recieve_type` FROM `speed_tests` WHERE `server_id` = ? ORDER BY `datetime` DESC LIMIT 8;");
|
$sel_st = $this->dbConnect()->prepare("SELECT `location`, `send`, `send_type`,`send_as_mbps`, `recieve`, `recieve_type`, `recieve_as_mbps` FROM `speed_tests` WHERE `server_id` = ? ORDER BY `datetime` DESC LIMIT 8;");
|
||||||
$sel_st->execute([$id]);
|
$sel_st->execute([$id]);
|
||||||
$speed_tests = $sel_st->fetchAll(PDO::FETCH_ASSOC);
|
$speed_tests = $sel_st->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$final = array_merge($speed_tests, $data);
|
$final = array_merge($speed_tests, $data);
|
||||||
return json_encode($final);
|
return json_encode($final);
|
||||||
} elseif ($row['has_yabs'] == 1 && $row['has_st'] == 0) {
|
} elseif ($row['has_yabs'] == 1 && $row['has_st'] == 0) {
|
||||||
$select = $this->dbConnect()->prepare("
|
$select = $this->dbConnect()->prepare("
|
||||||
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
|
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,ram_mb,swap,swap_type,swap_mb,`disk`,disk_type,disk_gb,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
|
||||||
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
|
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
|
||||||
loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
|
loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
|
||||||
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
|
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
|
||||||
@ -748,7 +769,7 @@ class idlers extends helperFunctions
|
|||||||
return json_encode($data);
|
return json_encode($data);
|
||||||
} else {
|
} else {
|
||||||
$select = $this->dbConnect()->prepare("
|
$select = $this->dbConnect()->prepare("
|
||||||
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,
|
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,ram_mb,swap,swap_type,swap_mb,`disk`,disk_type,disk_gb,
|
||||||
bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,ns1,ns2,label,has_st,
|
bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,ns1,ns2,label,has_st,
|
||||||
DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
|
DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
|
||||||
FROM servers INNER JOIN locations loc on servers.location = loc.id
|
FROM servers INNER JOIN locations loc on servers.location = loc.id
|
||||||
@ -2079,6 +2100,7 @@ class idlers extends helperFunctions
|
|||||||
|
|
||||||
public function mainPage()
|
public function mainPage()
|
||||||
{
|
{
|
||||||
|
$this->checkPHPversion();//Check PHP version. Wont load if not PHP 7.4 or above
|
||||||
$this->pageHead();
|
$this->pageHead();
|
||||||
$this->pageContents();
|
$this->pageContents();
|
||||||
$this->pageFooter();
|
$this->pageFooter();
|
||||||
@ -2569,7 +2591,11 @@ class idlers extends helperFunctions
|
|||||||
$this->HTMLphrase('p', 'm-desc', 'Attached to');
|
$this->HTMLphrase('p', 'm-desc', 'Attached to');
|
||||||
$this->tagClose('div');
|
$this->tagClose('div');
|
||||||
$this->colOpen('col-8');
|
$this->colOpen('col-8');
|
||||||
$this->outputString('<code><p class="m-value">' . $this->idToObjectName($data['attached_to']) . '</p></code>');
|
if (!is_null($data['attached_to']) && !empty($data['attached_to'])) {
|
||||||
|
$this->outputString('<code><p class="m-value">' . $this->idToObjectName($data['attached_to']) . '</p></code>');
|
||||||
|
} else {
|
||||||
|
$this->outputString('');
|
||||||
|
}
|
||||||
$this->tagClose('div', 2);
|
$this->tagClose('div', 2);
|
||||||
|
|
||||||
|
|
||||||
@ -3136,6 +3162,236 @@ class idlers extends helperFunctions
|
|||||||
}
|
}
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function checkPHPversion()
|
||||||
|
{
|
||||||
|
if (version_compare(PHP_VERSION, '7.4') === -1) {
|
||||||
|
echo "<script type='text/javascript'>alert('My idlers requires PHP 7.4 as a minimum version. You have " . PHP_VERSION . " installed');</script>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Compare functions
|
||||||
|
protected function compatibleComparesSelect()
|
||||||
|
{
|
||||||
|
$select = $this->dbConnect()->prepare("SELECT `id`, `hostname` FROM `servers` WHERE `has_yabs` = 1 AND `has_st` = 1 ORDER BY `hostname`;");
|
||||||
|
$select->execute();
|
||||||
|
$rows = $select->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$this->rowColOpen('form-row', 'col-12 col-md-6 mm-col');
|
||||||
|
$this->tagOpen('div', 'input-group');
|
||||||
|
$this->inputPrepend('Server 1');
|
||||||
|
$this->selectElement('compare_s1');
|
||||||
|
$this->selectOption('', '', true);//Empty
|
||||||
|
foreach ($rows as $aserver) {
|
||||||
|
$this->selectOption($aserver['hostname'], $aserver['id']);
|
||||||
|
}
|
||||||
|
$this->tagClose('select');
|
||||||
|
$this->tagClose('div', 2);
|
||||||
|
$this->colOpen('col-12 col-md-6 mm-col');
|
||||||
|
$this->tagOpen('div', 'input-group');
|
||||||
|
$this->inputPrepend('Server 2');
|
||||||
|
$this->selectElement('compare_s2');
|
||||||
|
$this->selectOption('', '', true);
|
||||||
|
foreach ($rows as $aserver) {
|
||||||
|
$this->selectOption($aserver['hostname'], $aserver['id']);
|
||||||
|
}
|
||||||
|
$this->tagClose('select');
|
||||||
|
$this->tagClose('div', 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function compareSection()
|
||||||
|
{
|
||||||
|
$this->compatibleComparesSelect();
|
||||||
|
$this->tagOpen('div', '', 'compareTableDiv');
|
||||||
|
$this->tagClose('div');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tableRowCompare(string $val1, string $val2, string $value_type = '', bool $is_int = true)
|
||||||
|
{
|
||||||
|
$value_append = '<span class="data-type">' . $value_type . '</span>';
|
||||||
|
if ($is_int) {
|
||||||
|
$val1 = intval($val1);
|
||||||
|
$val2 = intval($val2);
|
||||||
|
}
|
||||||
|
if ($val1 > $val2) {//val1 is greater than val2
|
||||||
|
$result = '+' . ($val1 - $val2);
|
||||||
|
if (!empty($value_type)) {
|
||||||
|
$result = '+' . ($val1 - $val2) . $value_append;
|
||||||
|
$val1 = $val1 . $value_append;
|
||||||
|
$val2 = $val2 . $value_append;
|
||||||
|
}
|
||||||
|
$this->tableTd('td-nowrap', $val1);
|
||||||
|
$this->tableTd('td-nowrap plus-td', $result);
|
||||||
|
$this->tableTd('td-nowrap', $val2);
|
||||||
|
} elseif ($val1 < $val2) {//val1 is less than val2
|
||||||
|
$result = '-' . ($val2 - $val1);
|
||||||
|
if (!empty($value_type)) {
|
||||||
|
$result = '-' . ($val2 - $val1) . $value_append;
|
||||||
|
$val1 = $val1 . $value_append;
|
||||||
|
$val2 = $val2 . $value_append;
|
||||||
|
}
|
||||||
|
$this->tableTd('td-nowrap', $val1);
|
||||||
|
$this->tableTd('td-nowrap neg-td', $result);
|
||||||
|
$this->tableTd('td-nowrap', $val2);
|
||||||
|
} else {//Equal
|
||||||
|
$result = 0;
|
||||||
|
if (!empty($value_type)) {
|
||||||
|
$result = '0' . $value_append;
|
||||||
|
$val1 = $val1 . $value_append;
|
||||||
|
$val2 = $val2 . $value_append;
|
||||||
|
}
|
||||||
|
$this->tableTd('td-nowrap', $val1);
|
||||||
|
$this->tableTd('td-nowrap equal-td', $result);
|
||||||
|
$this->tableTd('td-nowrap', $val2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function compareTable(string $server1_id, string $server2_id)
|
||||||
|
{
|
||||||
|
$server1_data = json_decode($this->serverData($server1_id), true);
|
||||||
|
$server2_data = json_decode($this->serverData($server2_id), true);
|
||||||
|
|
||||||
|
$this->tableHeader(array('', $server1_data['hostname'], 'DIF', $server2_data['hostname']), 'table compare-table', 'compareTable');
|
||||||
|
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'CPU count');
|
||||||
|
$this->tableRowCompare($server1_data['cpu'], $server2_data['cpu']);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'CPU freq');
|
||||||
|
$this->tableRowCompare($this->mhzToGhz($server1_data['cpu_freq']), $this->mhzToGhz($server2_data['cpu_freq']), 'Ghz', false);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Ram');
|
||||||
|
$this->tableRowCompare($server1_data['ram_mb'], $server2_data['ram_mb'], 'MB');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Swap');
|
||||||
|
$this->tableRowCompare($server1_data['swap_mb'], $server2_data['swap_mb'], 'MB');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Disk');
|
||||||
|
$this->tableRowCompare($server1_data['disk_gb'], $server2_data['disk_gb'], 'GB');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
if ($server1_data['has_yabs'] == 1 && $server2_data['has_yabs'] == 1) {
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'GB5 single');
|
||||||
|
$this->tableRowCompare($server1_data['gb5_single'], $server2_data['gb5_single']);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'GB5 multi');
|
||||||
|
$this->tableRowCompare($server1_data['gb5_multi'], $server2_data['gb5_multi']);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', '4k disk');
|
||||||
|
$this->tableRowCompare($server1_data['4k_as_mbps'], $server2_data['4k_as_mbps'], 'MB/s');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', '64k disk');
|
||||||
|
$this->tableRowCompare($server1_data['64k_as_mbps'], $server2_data['64k_as_mbps'], 'MB/s');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', '512k disk');
|
||||||
|
$this->tableRowCompare($server1_data['512k_as_mbps'], $server2_data['512k_as_mbps'], 'MB/s');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', '1m disk');
|
||||||
|
$this->tableRowCompare($server1_data['1m_as_mbps'], $server2_data['1m_as_mbps'], 'MB/s');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
}
|
||||||
|
if ($server1_data['has_st'] == 1 && $server2_data['has_st'] == 1) {
|
||||||
|
if (isset($server1_data[0]) && isset($server2_data[0])) {
|
||||||
|
if ($server1_data[0]['location'] == $server2_data[0]['location']) {
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data[0]['location'] . ' send');
|
||||||
|
$this->tableRowCompare($server1_data[0]['send_as_mbps'], $server2_data[0]['send_as_mbps'], 'MBps');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data[0]['location'] . ' recieve');
|
||||||
|
$this->tableRowCompare($server1_data[0]['recieve_as_mbps'], $server2_data[0]['recieve_as_mbps'], 'MBps');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($server1_data[1]) && isset($server2_data[1])) {
|
||||||
|
if ($server1_data[1]['location'] == $server2_data[1]['location']) {
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data[1]['location'] . ' send');
|
||||||
|
$this->tableRowCompare($server1_data[1]['send_as_mbps'], $server2_data[1]['send_as_mbps'], 'MBps');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data[1]['location'] . ' recieve');
|
||||||
|
$this->tableRowCompare($server1_data[1]['recieve_as_mbps'], $server2_data[1]['recieve_as_mbps'], 'MBps');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($server1_data[2]) && isset($server2_data[2])) {
|
||||||
|
if ($server1_data[2]['location'] == $server2_data[2]['location']) {
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data[2]['location'] . ' send');
|
||||||
|
$this->tableRowCompare($server1_data[2]['send_as_mbps'], $server2_data[2]['send_as_mbps'], 'MBps');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data[2]['location'] . ' recieve');
|
||||||
|
$this->tableRowCompare($server1_data[2]['recieve_as_mbps'], $server2_data[2]['recieve_as_mbps'], 'MBps');
|
||||||
|
$this->tagClose('tr');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'USD p/m');
|
||||||
|
$this->tableRowCompare($server1_data['usd_per_month'], $server2_data['usd_per_month'], 'p/m', false);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Actual price');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data['price'] . '<span class="data-type">' . $server1_data['currency'] . '</span>' . ' ' . $this->paymentTerm($server1_data['term']));
|
||||||
|
$this->tableTd('td-nowrap equal-td', '');
|
||||||
|
$this->tableTd('td-nowrap', $server2_data['price'] . '<span class="data-type">' . $server2_data['currency'] . '</span>' . ' ' . $this->paymentTerm($server2_data['term']));
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
if ($server1_data['price'] > 0 && $server2_data['price'] > 0) {
|
||||||
|
$this->tableTd('td-nowrap', 'CPU per USD');
|
||||||
|
$this->tableRowCompare(number_format(($server1_data['usd_per_month'] / $server1_data['cpu']), 2), number_format(($server2_data['usd_per_month'] / $server2_data['cpu']), 2), '', false);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Disk GB per USD');
|
||||||
|
$this->tableRowCompare(($server1_data['disk_gb'] / $server1_data['usd_per_month']), ($server2_data['disk_gb'] / $server2_data['usd_per_month']), 'GB', true);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Ram MB per USD');
|
||||||
|
$this->tableRowCompare(($server1_data['ram_mb'] / $server1_data['usd_per_month']), ($server2_data['ram_mb'] / $server2_data['usd_per_month']), 'MB', true);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
if ($server1_data['has_yabs'] == 1 && $server2_data['has_yabs'] == 1) {
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'GB5 single per USD');
|
||||||
|
$this->tableRowCompare(($server1_data['gb5_single'] / $server1_data['usd_per_month']), ($server2_data['gb5_single'] / $server2_data['usd_per_month']), '', true);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'GB5 multi per USD');
|
||||||
|
$this->tableRowCompare(($server1_data['gb5_multi'] / $server1_data['usd_per_month']), ($server2_data['gb5_multi'] / $server2_data['usd_per_month']), '', true);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Location');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data['location']);
|
||||||
|
$this->tableTd('td-nowrap equal-td', '');
|
||||||
|
$this->tableTd('td-nowrap', $server2_data['location']);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tagOpen('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Provider');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data['provider']);
|
||||||
|
$this->tableTd('td-nowrap equal-td', '');
|
||||||
|
$this->tableTd('td-nowrap', $server2_data['provider']);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->tableTd('td-nowrap', 'Owned since');
|
||||||
|
$this->tableTd('td-nowrap', $server1_data['owned_since']);
|
||||||
|
$this->tableTd('td-nowrap equal-td', '');
|
||||||
|
$this->tableTd('td-nowrap', $server2_data['owned_since']);
|
||||||
|
$this->tagClose('tr');
|
||||||
|
$this->outputString('</tbody></table></div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class itemInsert extends idlers
|
class itemInsert extends idlers
|
||||||
@ -3213,14 +3469,11 @@ class itemInsert extends idlers
|
|||||||
return $domain_id;
|
return $domain_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertYabsData(bool $save_yabs = true)
|
public function insertYabsData()
|
||||||
{//YABS data handler
|
{//YABS data handler
|
||||||
$file_name = 'yabsFromForm.txt';
|
$file_name = 'yabsFromForm.txt';
|
||||||
$logfile = fopen($file_name, "w") or die("Unable to open file!");
|
$logfile = fopen($file_name, "w") or die("Unable to open file!");
|
||||||
fwrite($logfile, $this->data['yabs']);
|
fwrite($logfile, $this->data['yabs']);
|
||||||
if ($save_yabs) {
|
|
||||||
$this->saveYABS($this->data['yabs'], "{$this->item_id}.txt");
|
|
||||||
}
|
|
||||||
fclose($logfile);
|
fclose($logfile);
|
||||||
$file = @fopen($file_name, 'r');
|
$file = @fopen($file_name, 'r');
|
||||||
if ($file) {
|
if ($file) {
|
||||||
@ -3228,95 +3481,117 @@ class itemInsert extends idlers
|
|||||||
//echo json_encode($array);
|
//echo json_encode($array);
|
||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
if (strpos($array[0], '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #') !== false || count($array) < 50) {
|
if (count($array) < 50) {
|
||||||
|
return 9;//Less than 50 lines
|
||||||
|
}
|
||||||
|
if (strpos($array[0], '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #') !== false) {
|
||||||
|
if ($array[1] == "\r") {
|
||||||
|
return 8;//Didnt copy output correctly
|
||||||
|
}
|
||||||
$version_array = explode(' ', preg_replace('!\s+!', ' ', $this->trimRemoveR($array[2])));
|
$version_array = explode(' ', preg_replace('!\s+!', ' ', $this->trimRemoveR($array[2])));
|
||||||
$version = $version_array[1];//YABs version
|
$version = $version_array[1];//YABs version
|
||||||
$cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[10], ': ')));
|
if ($version == 'v2020-12-29') {
|
||||||
$cpu_spec = explode(' ', strstr($array[11], ': '));//: 2 @ 3792.872 MHz
|
$cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[10], ': ')));
|
||||||
$cpu_cores = $cpu_spec[1];
|
$cpu_spec = explode(' ', strstr($array[11], ': '));//: 2 @ 3792.872 MHz
|
||||||
$cpu_freq = $cpu_spec[3];
|
$cpu_cores = $cpu_spec[1];
|
||||||
$ram_line = $this->trimRemoveR(str_replace(':', '', strstr($array[14], ': ')));
|
$cpu_freq = $cpu_spec[3];
|
||||||
$ram = floatval($ram_line);
|
$ram_line = $this->trimRemoveR(str_replace(':', '', strstr($array[14], ': ')));
|
||||||
$ram_type = $this->datatype($ram_line);
|
$ram = floatval($ram_line);
|
||||||
$swap_line = $this->trimRemoveR(str_replace(':', '', strstr($array[15], ': ')));
|
$ram_type = $this->datatype($ram_line);
|
||||||
$swap = floatval($swap_line);
|
$swap_line = $this->trimRemoveR(str_replace(':', '', strstr($array[15], ': ')));
|
||||||
$swap_type = $this->datatype($swap_line);
|
$swap = floatval($swap_line);
|
||||||
$disk_line = $this->trimRemoveR(str_replace(':', '', strstr($array[16], ': ')));
|
$swap_type = $this->datatype($swap_line);
|
||||||
$disk = floatval($disk_line);
|
$disk_line = $this->trimRemoveR(str_replace(':', '', strstr($array[16], ': ')));
|
||||||
$disk_type = $this->datatype($disk_line);
|
$disk = floatval($disk_line);
|
||||||
$io_3 = explode(' ', preg_replace('!\s+!', ' ', $array[24]));
|
$disk_type = $this->datatype($disk_line);
|
||||||
$io_6 = explode(' ', preg_replace('!\s+!', ' ', $array[30]));
|
$io_3 = explode(' ', preg_replace('!\s+!', ' ', $array[24]));
|
||||||
(strpos($array[12], 'Enabled') !== false) ? $aes_ni = 1 : $aes_ni = 0;
|
$io_6 = explode(' ', preg_replace('!\s+!', ' ', $array[30]));
|
||||||
(strpos($array[13], 'Enabled') !== false) ? $vm_amd_v = 1 : $vm_amd_v = 0;
|
(strpos($array[12], 'Enabled') !== false) ? $aes_ni = 1 : $aes_ni = 0;
|
||||||
$d4k_as_mbps = $this->diskSpeedAsMbps($io_3[3], $this->floatValue($io_3[2]));
|
(strpos($array[13], 'Enabled') !== false) ? $vm_amd_v = 1 : $vm_amd_v = 0;
|
||||||
$d64k_as_mbps = $this->diskSpeedAsMbps($io_3[7], $this->floatValue($io_3[6]));
|
$d4k_as_mbps = $this->diskSpeedAsMbps($io_3[3], $this->floatValue($io_3[2]));
|
||||||
$d512k_as_mbps = $this->diskSpeedAsMbps($io_6[3], $this->floatValue($io_6[2]));
|
$d64k_as_mbps = $this->diskSpeedAsMbps($io_3[7], $this->floatValue($io_3[6]));
|
||||||
$d1m_as_mbps = $this->diskSpeedAsMbps($io_6[7], $this->floatValue($io_6[6]));
|
$d512k_as_mbps = $this->diskSpeedAsMbps($io_6[3], $this->floatValue($io_6[2]));
|
||||||
$disk_test_arr = array($this->item_id, $this->floatValue($io_3[2]), $io_3[3], $this->floatValue($io_3[6]), $io_3[7], $this->floatValue($io_6[2]), $io_6[3], $this->floatValue($io_6[6]), $io_6[7], $d4k_as_mbps, $d64k_as_mbps, $d512k_as_mbps, $d1m_as_mbps);
|
$d1m_as_mbps = $this->diskSpeedAsMbps($io_6[7], $this->floatValue($io_6[6]));
|
||||||
$this->insertDiskTest($disk_test_arr);
|
$disk_test_arr = array($this->item_id, $this->floatValue($io_3[2]), $io_3[3], $this->floatValue($io_3[6]), $io_3[7], $this->floatValue($io_6[2]), $io_6[3], $this->floatValue($io_6[6]), $io_6[7], $d4k_as_mbps, $d64k_as_mbps, $d512k_as_mbps, $d1m_as_mbps);
|
||||||
if ($array[45] == "Geekbench 5 Benchmark Test:\r") {
|
$this->insertDiskTest($disk_test_arr);
|
||||||
//No ipv6
|
if (isset($array[40])) {
|
||||||
//Has short ipv4 network speed testing (-r)
|
if ($array[45] == "Geekbench 5 Benchmark Test:\r") {
|
||||||
$start_st = 36;
|
//No ipv6
|
||||||
$end_st = 43;
|
//Has short ipv4 network speed testing (-r)
|
||||||
$gb_s = 49;
|
$start_st = 36;
|
||||||
$gb_m = 50;
|
$end_st = 43;
|
||||||
$gb_url = 51;
|
$gb_s = 49;
|
||||||
} elseif ($array[40] == "Geekbench 5 Benchmark Test:\r") {
|
$gb_m = 50;
|
||||||
//No ipv6
|
$gb_url = 51;
|
||||||
//Has full ipv4 network speed testing
|
} elseif ($array[45] == "Geekbench 4 Benchmark Test:\r") {
|
||||||
$start_st = 36;
|
return 6;//GeekBench 5 only allowed
|
||||||
$end_st = 38;
|
} elseif ($array[45] == "Geekbench 5 test failed. Run manually to determine cause.") {
|
||||||
$gb_s = 44;
|
return 7;//GeekBench test failed
|
||||||
$gb_m = 45;
|
} elseif ($array[40] == "Geekbench 5 Benchmark Test:\r") {
|
||||||
$gb_url = 46;
|
//No ipv6
|
||||||
} elseif ($array[40] == "iperf3 Network Speed Tests (IPv6):\r") {
|
//Has full ipv4 network speed testing
|
||||||
//HAS ipv6
|
$start_st = 36;
|
||||||
//Has short ipv4 & ipv6 network speed testing
|
$end_st = 38;
|
||||||
$start_st = 36;
|
$gb_s = 44;
|
||||||
$end_st = 38;
|
$gb_m = 45;
|
||||||
$gb_s = 52;
|
$gb_url = 46;
|
||||||
$gb_m = 53;
|
} elseif ($array[40] == "iperf3 Network Speed Tests (IPv6):\r") {
|
||||||
$gb_url = 54;
|
//HAS ipv6
|
||||||
} elseif ($array[55] == "Geekbench 5 Benchmark Test:\r") {
|
//Has short ipv4 & ipv6 network speed testing
|
||||||
//HAS ipv6
|
$start_st = 36;
|
||||||
//Has full ipv4 & ipv6 network speed testing
|
$end_st = 38;
|
||||||
$start_st = 36;
|
$gb_s = 52;
|
||||||
$end_st = 43;
|
$gb_m = 53;
|
||||||
$gb_s = 59;
|
$gb_url = 54;
|
||||||
$gb_m = 60;
|
} elseif ($array[55] == "Geekbench 5 Benchmark Test:\r") {
|
||||||
$gb_url = 61;
|
//HAS ipv6
|
||||||
}
|
//Has full ipv4 & ipv6 network speed testing
|
||||||
$geekbench_single = $this->intValue($array[$gb_s]);
|
$start_st = 36;
|
||||||
$geekbench_multi = $this->intValue($array[$gb_m]);
|
$end_st = 43;
|
||||||
$geek_full_url = explode(' ', preg_replace('!\s+!', ' ', $array[$gb_url]));
|
$gb_s = 59;
|
||||||
$gb5_id = substr($geek_full_url[3], strrpos($geek_full_url[3], '/') + 1);//
|
$gb_m = 60;
|
||||||
$has_a_speed_test = false;
|
$gb_url = 61;
|
||||||
for ($i = $start_st; $i <= $end_st; $i++) {
|
} else {
|
||||||
if (strpos($array[$i], 'busy') !== false) {
|
return 5;//Not correct YABs command output
|
||||||
//Has a "busy" result, No insert
|
}
|
||||||
} else {
|
} else {
|
||||||
$data = explode(' ', preg_replace('!\s+!', ' ', $array[$i]));
|
return 4;//Not correct format
|
||||||
$send_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['send_type'], $this->yabsSpeedValues($data)['send']);
|
|
||||||
$recieve_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['receive_type'], $this->yabsSpeedValues($data)['receive']);
|
|
||||||
$insert = $this->dbConnect()->prepare('INSERT INTO `speed_tests` (`server_id`, `location`, `send`, `send_type`,`send_as_mbps`, `recieve`,`recieve_type`, `recieve_as_mbps`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
|
|
||||||
$insert->execute([$this->item_id, $this->yabsSpeedLoc($data)['location'], $this->yabsSpeedValues($data)['send'], $this->yabsSpeedValues($data)['send_type'], $send_as_mbps, $this->yabsSpeedValues($data)['receive'], $this->yabsSpeedValues($data)['receive_type'], $recieve_as_mbps]);
|
|
||||||
$has_a_speed_test = true;
|
|
||||||
}
|
}
|
||||||
|
$geekbench_single = $this->intValue($array[$gb_s]);
|
||||||
|
$geekbench_multi = $this->intValue($array[$gb_m]);
|
||||||
|
$geek_full_url = explode(' ', preg_replace('!\s+!', ' ', $array[$gb_url]));
|
||||||
|
$gb5_id = substr($geek_full_url[3], strrpos($geek_full_url[3], '/') + 1);//
|
||||||
|
$has_a_speed_test = false;
|
||||||
|
for ($i = $start_st; $i <= $end_st; $i++) {
|
||||||
|
if (strpos($array[$i], 'busy') !== false) {
|
||||||
|
//Has a "busy" result, No insert
|
||||||
|
} else {
|
||||||
|
$data = explode(' ', preg_replace('!\s+!', ' ', $array[$i]));
|
||||||
|
$send_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['send_type'], $this->yabsSpeedValues($data)['send']);
|
||||||
|
$recieve_as_mbps = $this->networkSpeedAsMbps($this->yabsSpeedValues($data)['receive_type'], $this->yabsSpeedValues($data)['receive']);
|
||||||
|
$insert = $this->dbConnect()->prepare('INSERT INTO `speed_tests` (`server_id`, `location`, `send`, `send_type`,`send_as_mbps`, `recieve`,`recieve_type`, `recieve_as_mbps`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
|
||||||
|
$insert->execute([$this->item_id, $this->yabsSpeedLoc($data)['location'], $this->yabsSpeedValues($data)['send'], $this->yabsSpeedValues($data)['send_type'], $send_as_mbps, $this->yabsSpeedValues($data)['receive'], $this->yabsSpeedValues($data)['receive_type'], $recieve_as_mbps]);
|
||||||
|
$has_a_speed_test = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($has_a_speed_test) {
|
||||||
|
$update_st = $this->dbConnect()->prepare('UPDATE `servers` SET `has_st` = 1 WHERE `id` = ? LIMIT 1;');
|
||||||
|
$update_st->execute([$this->item_id]);
|
||||||
|
}
|
||||||
|
($ram_type == 'GB') ? $ram_mb = $this->GBtoMB($ram) : $ram_mb = $ram;
|
||||||
|
($swap_type == 'GB') ? $swap_mb = $this->GBtoMB($swap) : $swap_mb = $swap;
|
||||||
|
($disk_type == 'TB') ? $disk_gb = $this->TBtoGB($disk) : $disk_gb = $disk;
|
||||||
|
$update = $this->dbConnect()->prepare('UPDATE `servers` SET `cpu` = ?, `cpu_freq` = ?, `cpu_type` = ?, ram = ?, ram_type = ?, swap = ?, swap_type = ?, disk = ?, disk_type = ?, `aes_ni` = ?, `amd_v` = ?, gb5_single = ?, gb5_multi = ?, gb5_id = ?, ram_mb = ?, swap_mb = ?, disk_gb = ? WHERE `id` = ? LIMIT 1;');
|
||||||
|
$update->execute([$cpu_cores, $cpu_freq, $cpu, $ram, $ram_type, $swap, $swap_type, $disk, $disk_type, $aes_ni, $vm_amd_v, $geekbench_single, $geekbench_multi, $gb5_id, $ram_mb, $swap_mb, $disk_gb, $this->item_id]);
|
||||||
|
if (self::SAVE_YABS_OUTPUT) {
|
||||||
|
$this->saveYABS($this->data['yabs'], "{$this->item_id}.txt");
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 2;//Wrong version
|
||||||
}
|
}
|
||||||
if ($has_a_speed_test) {
|
|
||||||
$update_st = $this->dbConnect()->prepare('UPDATE `servers` SET `has_st` = 1 WHERE `id` = ? LIMIT 1;');
|
|
||||||
$update_st->execute([$this->item_id]);
|
|
||||||
}
|
|
||||||
($ram_type == 'GB') ? $ram_mb = $this->GBtoMB($ram) : $ram_mb = $ram;
|
|
||||||
($swap_type == 'GB') ? $swap_mb = $this->GBtoMB($swap) : $swap_mb = $swap;
|
|
||||||
($disk_type == 'TB') ? $disk_gb = $this->TBtoGB($disk) : $disk_gb = $disk;
|
|
||||||
$update = $this->dbConnect()->prepare('UPDATE `servers` SET `cpu` = ?, `cpu_freq` = ?, `cpu_type` = ?, ram = ?, ram_type = ?, swap = ?, swap_type = ?, disk = ?, disk_type = ?, `aes_ni` = ?, `amd_v` = ?, gb5_single = ?, gb5_multi = ?, gb5_id = ?, ram_mb = ?, swap_mb = ?, disk_gb = ? WHERE `id` = ? LIMIT 1;');
|
|
||||||
$update->execute([$cpu_cores, $cpu_freq, $cpu, $ram, $ram_type, $swap, $swap_type, $disk, $disk_type, $aes_ni, $vm_amd_v, $geekbench_single, $geekbench_multi, $gb5_id, $ram_mb, $swap_mb, $disk_gb, $this->item_id]);
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
//Not formatted right
|
return 3;//Didnt start at right spot
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3435,6 +3710,7 @@ class itemUpdate extends idlers
|
|||||||
$del_disk->execute([$item_id]);
|
$del_disk->execute([$item_id]);
|
||||||
$del_speed = $this->dbConnect()->prepare("DELETE FROM `speed_tests` WHERE `server_id` = ?;");
|
$del_speed = $this->dbConnect()->prepare("DELETE FROM `speed_tests` WHERE `server_id` = ?;");
|
||||||
$del_speed->execute([$item_id]);
|
$del_speed->execute([$item_id]);
|
||||||
|
$this->deleteYabsForId($item_id);//Delete saved YABs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user