Replace deprecated instr function with str_contains and add include/global.php for central configurations.

This commit is contained in:
2025-08-13 09:38:16 +02:00
parent 676089950d
commit 5d01e6da14
8 changed files with 301 additions and 156 deletions

View File

@@ -72,7 +72,7 @@
$vm_mem += $d['vm_memory'];
$node_mem = (int) $d['node_ram'];
foreach (explode("|", $d['csvs']) as $csv) {
if (instr($csv, ';')) {
if (str_contains($csv, ';')) {
$free += intval(explode(";", $csv)[1]) - intval(explode(";", $csv)[2]);
$disk = max($disk, $free);
$capacity += (int) explode(";", $csv)[1];
@@ -112,7 +112,7 @@
$Repart = Invoke_Infra("select Owner, count(owner) as nbvm from cmdb_vms where Cluster ='".$cluster['cluster']."' and decomtime is null group by Owner order by Owner");
$vmCountNode1 = $vmCountNode2 = 0;
$node1_name = $node2_name = "";
if(count($Repart) == 1 ){
if(isset($Repart) && count($Repart) == 1 ){
$node1_name = $Repart[0]['Owner']; $vmCountNode1 = $Repart[0]['nbvm'];
}else{
$node1_name = 'DUN'; $vmCountNode1 = $Repart[0]['nbvm'];