rename: appdata/varaverk → appdata/Varaverk (capital V throughout)

This commit is contained in:
Gmer4Lfe
2026-05-30 10:22:51 -04:00
parent 2d5a084d2b
commit 0fe99cf2a9
24 changed files with 641 additions and 385 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
define('PLUGIN_CFG', '/boot/config/plugins/varaverk/varaverk.cfg');
$_vv_cfg = @parse_ini_file(PLUGIN_CFG) ?: [];
define('SCRIPTS_DIR', $_vv_cfg['SCRIPTS_DIR'] ?? '/mnt/user/appdata/varaverk');
define('SCRIPTS_DIR', $_vv_cfg['SCRIPTS_DIR'] ?? '/mnt/user/appdata/Varaverk');
define('CONF_DIR', SCRIPTS_DIR . '/Configurations');
define('LOG_DIR', '/var/log/varaverk');
unset($_vv_cfg);
+1 -1
View File
@@ -131,7 +131,7 @@ function vv_watchdog_summary(): array {
}
// Recent restarts (24 h)
$restartLog = '/mnt/user/appdata/varaverk/data/container_restart_history.db';
$restartLog = '/mnt/user/appdata/Varaverk/data/container_restart_history.db';
$restartRaw = @file_get_contents($restartLog) ?: '';
$cutoff = time() - 86400;
$restarts = [];
+31 -6
View File
@@ -1,5 +1,31 @@
<?php
require_once __DIR__ . '/unraid_api.php';
function vv_get_vms(): array {
// ── API path ──────────────────────────────────────────────────────────────
$api = vv_api_data();
if ($api && isset($api['vms']['domains'])) {
$vms = [];
foreach ($api['vms']['domains'] as $d) {
$name = $d['name'] ?? '';
// VmState enum values are RUNNING, PAUSED, SHUT_OFF, etc. — normalise to lowercase
$state = strtolower(str_replace('_', ' ', $d['state'] ?? 'unknown'));
$nl = strtolower($name);
$os = 'linux';
if (str_contains($nl, 'win')) $os = 'windows';
elseif (str_contains($nl, 'mac') || str_contains($nl, 'osx')) $os = 'macos';
elseif (str_contains($nl, 'bsd') || str_contains($nl, 'freebsd')) $os = 'bsd';
// vcpus/mem_mb not available via API — will show null (virsh fallback provides them)
$vms[] = ['name' => $name, 'state' => $state, 'os' => $os, 'vcpus' => null, 'mem_mb' => null];
}
return ['available' => true, 'vms' => $vms];
}
// ── Local fallback ────────────────────────────────────────────────────────
vv_api_record_fallback('vms');
if (!file_exists('/usr/bin/virsh')) return ['available' => false, 'vms' => []];
exec('virsh list --all --name 2>/dev/null', $names, $rc);
@@ -12,16 +38,15 @@ function vv_get_vms(): array {
$state = trim(shell_exec('virsh domstate ' . escapeshellarg($name) . ' 2>/dev/null') ?? 'unknown');
$vcpus = null;
$memMb = null;
$vcpus = null;
$memMb = null;
if ($state === 'running') {
$info = shell_exec('virsh dominfo ' . escapeshellarg($name) . ' 2>/dev/null') ?? '';
if (preg_match('/CPU\(s\)\s*:\s*(\d+)/i', $info, $m)) $vcpus = (int)$m[1];
if (preg_match('/Used memory\s*:\s*(\d+)/i', $info, $m)) $memMb = (int)round((int)$m[1] / 1024);
if (preg_match('/CPU\(s\)\s*:\s*(\d+)/i', $info, $m)) $vcpus = (int)$m[1];
if (preg_match('/Used memory\s*:\s*(\d+)/i', $info, $m)) $memMb = (int)round((int)$m[1] / 1024);
}
// OS detection from libvirt XML
$os = 'linux';
$os = 'linux';
$xmlPath = '/etc/libvirt/qemu/' . $name . '.xml';
if (file_exists($xmlPath)) {
$xml = @file_get_contents($xmlPath) ?: '';
+1 -1
View File
@@ -313,7 +313,7 @@ function vv_wd_all(): array {
$currentHost = vv_detect_host();
$tsPeers = vv_pt_ts_peers();
$masterRaw = vv_read_conf_raw('master.conf');
$restartLog = '/mnt/user/appdata/varaverk/data/container_restart_history.db';
$restartLog = '/mnt/user/appdata/Varaverk/data/container_restart_history.db';
// Config thresholds from master.conf
$cfg = [