mirror of
https://github.com/unraid/webgui.git
synced 2026-04-24 02:58:57 -05:00
Replace fixed path with absolute path in docroot variable
This commit is contained in:
@@ -5,7 +5,6 @@ Markdown="false"
|
||||
---
|
||||
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.ui.css">
|
||||
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.switchbutton.css">
|
||||
<link type="text/css" rel="stylesheet" href="/webGui/styles/context.standalone.css">
|
||||
<style>
|
||||
body{-webkit-overflow-scrolling: touch;}
|
||||
label{display:inline;}
|
||||
@@ -41,23 +40,23 @@ div.Panel:hover{overflow:visible;z-index:10;}
|
||||
<span class="status" style="margin-top:-44px; margin-right:<?= ($display['refresh']==0 || ($display['refresh']<0 && $var['mdResync']>0)) ? '60' : '0' ?>px"><input type="checkbox" class="appview"></span>
|
||||
<div id="apps_icons" style="display:none">
|
||||
<?
|
||||
$allContainers = array();
|
||||
$allContainers = [];
|
||||
if ((pgrep('docker')!==false) && (empty($display['dashapps']) || $display['dashapps'] == 'icons' || $display['dashapps'] == 'docker')) {
|
||||
require_once '/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php';
|
||||
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
$DockerClient = new DockerClient();
|
||||
$DockerUpdate = new DockerUpdate();
|
||||
$DockerTemplates = new DockerTemplates();
|
||||
|
||||
$allContainers = $DockerClient->getDockerContainers();
|
||||
if ( ! $allContainers) { $allContainers = array(); }
|
||||
if ( ! $allContainers) { $allContainers = []; }
|
||||
|
||||
$arrDockerInfo = $DockerTemplates->getAllInfo();
|
||||
}
|
||||
|
||||
$allVMs = array();
|
||||
$allVMs = [];
|
||||
if ((pgrep('libvirtd')!==false) && (empty($display['dashapps']) || $display['dashapps'] == 'icons' || $display['dashapps'] == 'vms')) {
|
||||
require_once '/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt.php';
|
||||
require_once '/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt_helpers.php';
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
|
||||
|
||||
$doms = $lv->get_domains();
|
||||
if (is_array($doms)) {
|
||||
@@ -66,7 +65,7 @@ if ((pgrep('libvirtd')!==false) && (empty($display['dashapps']) || $display['das
|
||||
}
|
||||
}
|
||||
|
||||
$contextMenus = array();
|
||||
$contextMenus = [];
|
||||
|
||||
// Docker Apps
|
||||
foreach ($allContainers as $ct) {
|
||||
@@ -149,7 +148,7 @@ foreach ($allVMs as $name) {
|
||||
if (!empty($vmtemplateicon)) {
|
||||
if (file_exists($vmtemplateicon)) {
|
||||
$vmicon = $vmtemplateicon;
|
||||
} else if (file_exists('/usr/local/emhttp/plugins/dynamix.vm.manager/templates/images/' . $vmtemplateicon)) {
|
||||
} else if (file_exists("$docroot/plugins/dynamix.vm.manager/templates/images/" . $vmtemplateicon)) {
|
||||
$vmicon = '/plugins/dynamix.vm.manager/templates/images/' . $vmtemplateicon;
|
||||
}
|
||||
}
|
||||
@@ -172,7 +171,6 @@ foreach ($allVMs as $name) {
|
||||
<div id="noapps">No apps available to show</div>
|
||||
</div>
|
||||
<script src="/webGui/javascript/jquery.switchbutton.js"></script>
|
||||
<script src="/webGui/javascript/context.js"></script>
|
||||
<script src="/plugins/dynamix.docker.manager/javascript/docker.js"></script>
|
||||
<script>
|
||||
function ajaxVMDispatch(currentstate, params){
|
||||
|
||||
@@ -23,7 +23,7 @@ $(function() {
|
||||
</script>
|
||||
<table class='share_status small'>
|
||||
<thead><td style="width:33%">Title</td><td>Information</td></thead>
|
||||
<tbody id="disk_identify"><tr><td colspan='2'><br><center><i class='fa fa-spinner fa-spin'></i> <em>Please wait... retrieving S.M.A.R.T. information!</em></center></td></tr></tbody>
|
||||
<tbody id="disk_identify"><tr><td colspan='2' style='text-align:center;padding-top:12px'><i class='fa fa-spinner fa-spin'></i> <em>Please wait... retrieving S.M.A.R.T. information!</em></td></tr></tbody>
|
||||
</table>
|
||||
<input type="button" value="Done" onclick="done()">
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ $(function() {
|
||||
|
||||
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onsubmit="doDispatch(this)">
|
||||
Name:
|
||||
: <big><?=my_disk($name)?></big>
|
||||
: <span class='big'><?=my_disk($name)?></span>
|
||||
|
||||
Partition size:
|
||||
: <?=my_number($disk['size'])?> KB (K=1024)
|
||||
@@ -123,7 +123,7 @@ File system type:
|
||||
<?=mk_option($disk['fsType'], "btrfs", "btrfs")?>
|
||||
<?=mk_option($disk['fsType'], "reiserfs", "reiserfs")?>
|
||||
<?=mk_option($disk['fsType'], "xfs", "xfs")?>
|
||||
</select> Array must be **Stopped** to change
|
||||
</select> Array must be <span class="strong big">Stopped</span> to change
|
||||
|
||||
<?endif;?>
|
||||
<?elseif ($disk['type']=="Cache" && $var['SYS_CACHE_SLOTS']>1):?>
|
||||
@@ -209,7 +209,7 @@ btrfs filesystem df:
|
||||
<?if ($var['cacheSbNumDisks']>1):?>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($disk['fsStatus']=="Mounted"):?>
|
||||
<?exec("/usr/local/emhttp/webGui/scripts/btrfs_balance status /mnt/{$disk['name']}", $balance_status, $retval);?>
|
||||
<?exec("$docroot/webGui/scripts/btrfs_balance status /mnt/{$disk['name']}", $balance_status, $retval);?>
|
||||
|
||||
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/balancestatus.png" class="icon">Balance Status</span></div>
|
||||
|
||||
@@ -253,7 +253,7 @@ btrfs balance status:
|
||||
<?if ($disk['fsType']=="btrfs"):?>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($disk['fsStatus']=="Mounted"):?>
|
||||
<?exec("/usr/local/emhttp/webGui/scripts/btrfs_scrub status /mnt/{$disk['name']}", $scrub_status, $retval);?>
|
||||
<?exec("$docroot/webGui/scripts/btrfs_scrub status /mnt/{$disk['name']}", $scrub_status, $retval);?>
|
||||
|
||||
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/scrubstatus.png" class="icon">Scrub Status</span></div>
|
||||
|
||||
@@ -297,7 +297,7 @@ btrfs scrub status:
|
||||
<?if ($disk['fsType']=="reiserfs"):?>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($var['fsState']=="Started" && $var['startMode']=='Maintenance'):?>
|
||||
<?exec("/usr/local/emhttp/webGui/scripts/reiserfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
|
||||
<?exec("$docroot/webGui/scripts/reiserfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
|
||||
|
||||
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/filesystemstatus.png" class="icon">Check Filesystem Status</span></div>
|
||||
|
||||
@@ -349,7 +349,7 @@ reiserfsck status:
|
||||
<?if ($disk['fsType']=="xfs"):?>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($var['fsState']=="Started" && $var['startMode']=='Maintenance'):?>
|
||||
<?exec("/usr/local/emhttp/webGui/scripts/xfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
|
||||
<?exec("$docroot/webGui/scripts/xfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
|
||||
|
||||
<div id="title" class="nocontrol"><span class="left"><img src="/plugins/dynamix/icons/filesystemstatus.png" class="icon">Check Filesystem Status</span></div>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Png="ethernet.png"
|
||||
?>
|
||||
<?
|
||||
$build = false;
|
||||
$template = '/usr/local/emhttp/webGui/EthX.page';
|
||||
$template = "$docroot/webGui/EthX.page";
|
||||
$ini = '/var/local/emhttp/network.ini';
|
||||
$validIP = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
|
||||
|
||||
@@ -25,7 +25,7 @@ exec("ip -br addr|grep -Po '^eth[1-9]+\s'",$ports);
|
||||
$ports = array_map('trim', $ports);
|
||||
|
||||
// remove non-existing ethernet ports
|
||||
foreach (glob('/usr/local/emhttp/webGui/Eth[1-9]*.page',GLOB_NOSORT) as $port) {
|
||||
foreach (glob("$docroot/webGui/Eth[1-9]*.page",GLOB_NOSORT) as $port) {
|
||||
if (!in_array(strtolower(basename($port,'.page')), $ports)) {
|
||||
@unlink($port);
|
||||
$build = true;
|
||||
@@ -33,7 +33,7 @@ foreach (glob('/usr/local/emhttp/webGui/Eth[1-9]*.page',GLOB_NOSORT) as $port) {
|
||||
}
|
||||
// add new ethernet ports
|
||||
foreach ($ports as $port) {
|
||||
$file = "/usr/local/emhttp/webGui/".ucfirst($port).".page";
|
||||
$file = "$docroot/webGui/".ucfirst($port).".page";
|
||||
if (!file_exists($file)) {
|
||||
copy($template, $file);
|
||||
exec("sed -i 's/x-settings/NetworkSettings/;s/ethX/$port/g' $file");
|
||||
@@ -534,5 +534,5 @@ Network mask:
|
||||
</script>
|
||||
|
||||
|
||||
: <input type="submit" value="Apply" onclick="$('#wait_eth0').show()"><input type="button" value="Done" onclick="done()"><?=$service ? "$service must be <b>STOPPED</b> to change" : ""?>
|
||||
: <input type="submit" value="Apply" onclick="$('#wait_eth0').show()"><input type="button" value="Done" onclick="done()"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change" : ""?>
|
||||
</form>
|
||||
|
||||
@@ -263,5 +263,5 @@ Network mask:
|
||||
</script>
|
||||
|
||||
|
||||
: <input type="submit" value="Apply" onclick="$(waitid).show()"><input type="button" value="Done" onclick="done()"><input type="button" name="#shut_ethX" value="Port <?=$cmd?>" onclick="portToggle('ethX','<?=$cmd?>')"><?if ($service) echo "$service must be <b>STOPPED</b> to change"?>
|
||||
: <input type="submit" value="Apply" onclick="$(waitid).show()"><input type="button" value="Done" onclick="done()"><input type="button" name="#shut_ethX" value="Port <?=$cmd?>" onclick="portToggle('ethX','<?=$cmd?>')"><?if ($service) echo "$service must be <span class='strong big'>Stopped</span> to change"?>
|
||||
</form>
|
||||
|
||||
@@ -14,7 +14,7 @@ Title="SMTP Settings"
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'webGui/include/Encryption.php';
|
||||
require_once "$docroot/webGui/include/Encryption.php";
|
||||
|
||||
$ssmtp['AuthPass'] = base64_decrypt($ssmtp['AuthPass']);
|
||||
$incomplete = strlen($ssmtp['root'])==0 || strlen($ssmtp['server'])==0 || strlen($ssmtp['port'])==0 || ((strlen($ssmtp['AuthUser'])==0 || strlen($ssmtp['AuthPass'])==0) && $ssmtp['AuthMethod']!='none');
|
||||
|
||||
@@ -65,7 +65,7 @@ $(function() {
|
||||
$('.tabs').append("<span class='status'><span class='lite label'><label>Text<input type='checkbox' class='ctrl' onclick='highlight(!this.checked,\"N\")' checked></label></span><span class='error label'><label>Error<input type='checkbox' onclick='highlight(this.checked,\"E\")' checked></label></span><span class='warn label'><label>Warning<input type='checkbox' onclick='highlight(this.checked,\"W\")' checked></label></span><span class='system label'><label>System<input type='checkbox' onclick='highlight(this.checked,\"S\")' checked></label></span><span class='array label'><label>Array<input type='checkbox' onclick='highlight(this.checked,\"A\")' checked></label></span><span class='login label'><label>Login<input type='checkbox' onclick='highlight(this.checked,\"L\")' checked></label></span><span class='lite label'><input type='checkbox' class='ctrl' onclick='toggle(this.checked)' checked></span></span>");
|
||||
</script>
|
||||
<?
|
||||
require_once 'webGui/include/ColorCoding.php';
|
||||
require_once "$docroot/webGui/include/ColorCoding.php";
|
||||
|
||||
echo $display['resize'] ? "<pre class='up' style='display:none'>" : "<pre class='up'>";
|
||||
$logs = glob('/var/log/syslog*',GLOB_NOSORT);
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'Wrappers.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
$dynamix = parse_plugin_cfg('dynamix',true);
|
||||
if (strpos($_POST['log'],'*')===false) @unlink("{$dynamix['notify']['path']}/archive/{$_POST['log']}"); else array_map('unlink',glob("{$dynamix['notify']['path']}/archive/{$_POST['log']}",GLOB_NOSORT));
|
||||
|
||||
@@ -11,16 +11,19 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'Helpers.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
$path = $_POST['path'];
|
||||
$var = parse_ini_file('state/var.ini');
|
||||
$devs = parse_ini_file('state/devs.ini',true);
|
||||
$disks = parse_ini_file('state/disks.ini',true);
|
||||
$sum = ['count'=>0, 'temp'=>0, 'fsSize'=>0, 'fsUsed'=>0, 'fsFree'=>0, 'numReads'=>0, 'numWrites'=>0, 'numErrors'=>0];
|
||||
$new = '/var/tmp/diskio';
|
||||
$old = '/var/tmp/lastio';
|
||||
extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
require_once 'CustomMerge.php';
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
|
||||
function in_parity_log($log,$timestamp) {
|
||||
if (file_exists($log)) {
|
||||
@@ -77,7 +80,7 @@ function assignment(&$disk) {
|
||||
$out .= "<select class=\"slot\" name=\"slotId.{$disk['idx']}\" onChange=\"{$disk['name']}Form.submit()\">";
|
||||
$empty = ($disk['idSb']!='' ? 'no device' : 'unassigned');
|
||||
if ($disk['id']!='') {
|
||||
$out .= "<option value=\"{$disk['id']}\" selected>".device_desc($disk)."</option>";
|
||||
$out .= "<option value=\"{$disk['id']}\" selected>".device_desc($disk)."</option>";
|
||||
$out .= "<option value=''>$empty</option>";
|
||||
} else
|
||||
$out .= "<option value='' selected>$empty</option>";
|
||||
@@ -108,6 +111,30 @@ function fs_info(&$disk) {
|
||||
echo "<td colspan='2'></td><td>{$disk['fsStatus']}</td><td></td>";
|
||||
echo "<td>".device_browse($disk)."</td>";
|
||||
}
|
||||
function disk_map(&$rows) {
|
||||
$map = [];
|
||||
foreach ($rows as $row) {
|
||||
$key = explode(' ',$row);
|
||||
$map[$key[0]] = $key[3].' '.$key[7];
|
||||
}
|
||||
$rows = $map;
|
||||
}
|
||||
function sectors(&$data,$i) {
|
||||
return $data ? explode(' ',$data)[$i] : 0;
|
||||
}
|
||||
function my_diskio($id,$i) {
|
||||
global $diskio, $lastio, $disks;
|
||||
if (empty($diskio) || empty($lastio)) return my_scale(0,$unit,1)." $unit/s";
|
||||
$time = max($diskio['time']-$lastio['time'],1);
|
||||
if ($id=='A' || $id=='P') {
|
||||
$type = $id=='A' ? '/Parity|Data/' : '/Cache/';
|
||||
$disksum = 0;
|
||||
foreach ($disks as $disk) if (preg_match($type,$disk['type'])) $disksum += sectors($diskio[$disk['device']],$i)-sectors($lastio[$disk['device']],$i);
|
||||
return my_scale($disksum*512/$time,$unit,1)." $unit/s";
|
||||
} else {
|
||||
return my_scale((sectors($diskio[$id],$i)-sectors($lastio[$id],$i))*512/$time,$unit,1)." $unit/s";
|
||||
}
|
||||
}
|
||||
function array_offline(&$disk,$w) {
|
||||
$warning = $w ? '<span class="red-text"><em>ALL DATA ON THIS DISK WILL BE ERASED WHEN ARRAY IS STARTED</em></span>' : '';
|
||||
echo "<tr>";
|
||||
@@ -179,8 +206,8 @@ function array_online(&$disk) {
|
||||
echo "<td>".device_info($disk)."</td>";
|
||||
echo "<td>".device_desc($disk)."</td>";
|
||||
echo "<td>".my_temp($disk['temp'])."</td>";
|
||||
echo "<td>".my_number($disk['numReads'])."</td>";
|
||||
echo "<td>".my_number($disk['numWrites'])."</td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($disk['device'],0)."</span><span class='number'>".my_number($disk['numReads'])."</span></td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($disk['device'],1)."</span><span class='number'>".my_number($disk['numWrites'])."</span></td>";
|
||||
echo "<td>".my_number($disk['numErrors'])."</td>";
|
||||
fs_info($disk);
|
||||
break;
|
||||
@@ -203,7 +230,7 @@ function read_disk(&$device, $item) {
|
||||
$smart = "/var/local/emhttp/smart/$device";
|
||||
if (!file_exists($smart) || (time()-filemtime($smart)>=$var['poll_attributes'])) exec("smartctl -n standby -A /dev/$device >$smart &");
|
||||
$temp = exec("awk '\$1==190||\$1==194{print \$10;exit}' $smart");
|
||||
return $temp ? $temp : '*';
|
||||
return $temp ?: '*';
|
||||
}
|
||||
}
|
||||
function show_totals($text) {
|
||||
@@ -212,8 +239,8 @@ function show_totals($text) {
|
||||
echo "<td><img src='/webGui/images/sum.png' class='icon'>Total</td>";
|
||||
echo "<td>$text</td>";
|
||||
echo "<td>".($sum['count']>0 ? my_temp(round($sum['temp']/$sum['count'],1)) : '*')."</td>";
|
||||
echo "<td>".my_number($sum['numReads'])."</td>";
|
||||
echo "<td>".my_number($sum['numWrites'])."</td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($text[0],0)."</span><span class='number'>".my_number($sum['numReads'])."</span></td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($text[0],1)."</span><span class='number'>".my_number($sum['numWrites'])."</span></td>";
|
||||
echo "<td>".my_number($sum['numErrors'])."</td>";
|
||||
echo "<td></td>";
|
||||
if (strstr($text,'Array') && ($var['startMode']=='Normal')) {
|
||||
@@ -264,6 +291,21 @@ function cache_slots() {
|
||||
$out .= "</select></form>";
|
||||
return $out;
|
||||
}
|
||||
$time = time();
|
||||
$last = @parse_ini_file($new);
|
||||
if ($_POST['diskio'] && $time-$last['time']>8) {
|
||||
@copy($new, $old);
|
||||
$lastio = $last;
|
||||
exec("grep -o '\(sd[a-z]*\|nvme[0-9]n1\) .*' /proc/diskstats",$diskio);
|
||||
disk_map($diskio);
|
||||
$diskio['time'] = $time;
|
||||
$keys = [];
|
||||
foreach ($diskio as $key => $data) $keys[] = "$key=$data";
|
||||
file_put_contents($new, implode("\n",$keys));
|
||||
} else {
|
||||
$lastio = @parse_ini_file($old);
|
||||
$diskio = $last;
|
||||
}
|
||||
switch ($_POST['device']) {
|
||||
case 'array':
|
||||
if ($var['fsState']=='Stopped') {
|
||||
@@ -284,8 +326,8 @@ case 'flash':
|
||||
echo "<td>".device_info($disk)."</td>";
|
||||
echo "<td>".device_desc($disk)."</td>";
|
||||
echo "<td>*</td>";
|
||||
echo "<td>".my_number($disk['numReads'])."</td>";
|
||||
echo "<td>".my_number($disk['numWrites'])."</td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($disk['device'],0)."</span><span class='number'>".my_number($disk['numReads'])."</span></td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($disk['device'],1)."</span><span class='number'>".my_number($disk['numWrites'])."</span></td>";
|
||||
echo "<td>".my_number($disk['numErrors'])."</td>";
|
||||
fs_info($disk);
|
||||
echo "</tr>";
|
||||
@@ -309,22 +351,24 @@ case 'open':
|
||||
echo "<td>".device_info($dev)."</td>";
|
||||
echo "<td>".device_desc($dev)."</td>";
|
||||
echo "<td>".my_temp($dev['temp'])."</td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($dev['device'],0)."</span><span class='number'>-</span></td>";
|
||||
echo "<td><span class='diskio'>".my_diskio($dev['device'],1)."</span><span class='number'>-</span></td>";
|
||||
if (file_exists("/tmp/preclear_stat_{$dev['device']}")) {
|
||||
$text = exec("cut -d'|' -f3 /tmp/preclear_stat_{$dev['device']}|sed 's:\^n:\<br\>:g'");
|
||||
if (strpos($text,'Total time')===false) $text = 'Preclear in progress... '.$text;
|
||||
echo "<td colspan='8' style='text-align:right'><em>$text</em></td>";
|
||||
echo "<td colspan='6' style='text-align:right'><em>$text</em></td>";
|
||||
} else
|
||||
echo "<td colspan='8'></td>";
|
||||
echo "<td colspan='6'></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
break;
|
||||
case 'parity':
|
||||
$data = array();
|
||||
$data = [];
|
||||
if ($var['mdResync']>0) {
|
||||
$data[] = my_scale($var['mdResync']*1024,$unit)." $unit";
|
||||
$data[] = my_clock(floor(($var['currTime']-$var['sbUpdated'])/60));
|
||||
$data[] = my_scale($var['mdResyncPos']*1024,$unit)." $unit (".number_format(($var['mdResyncPos']/($var['mdResync']/100+1)),1,substr($display['number'],0,1),'')." %)";
|
||||
$data[] = my_scale($var['mdResyncDb']/$var['mdResyncDt']*1024,$unit, 1)." $unit/sec";
|
||||
$data[] = my_scale($var['mdResyncDb']*1024/$var['mdResyncDt'],$unit, 1)." $unit/sec";
|
||||
$data[] = my_clock(round(((($var['mdResyncDt']*(($var['mdResync']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0));
|
||||
$data[] = $var['sbSyncErrs'];
|
||||
echo implode(';',$data);
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'Helpers.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
$shares = parse_ini_file('state/shares.ini',true);
|
||||
$disks = parse_ini_file('state/disks.ini',true);
|
||||
@@ -53,7 +54,7 @@ $myDisks = array_filter(array_diff(array_keys($disks), explode(',',$var['shareUs
|
||||
|
||||
// Share size per disk
|
||||
$preserve = ($path==$prev || $compute=='yes');
|
||||
$ssz2 = array();
|
||||
$ssz2 = [];
|
||||
foreach (glob("state/*.ssz2", GLOB_NOSORT) as $entry) {
|
||||
if ($preserve) {
|
||||
$ssz2[basename($entry, ".ssz2")] = parse_ini_file($entry);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $_SERVER['DOCUMENT_ROOT'];
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$file = $_POST['file'];
|
||||
switch ($_POST['cmd']) {
|
||||
case 'save':
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$var = parse_ini_file('state/var.ini');
|
||||
$unraid = parse_ini_file('/etc/unraid-version');
|
||||
$keyfile = trim(base64_encode(@file_get_contents($var['regFILE'])));
|
||||
@@ -17,7 +18,7 @@ $keyfile = trim(base64_encode(@file_get_contents($var['regFILE'])));
|
||||
if (array_key_exists('getdiagnostics', $_GET)) {
|
||||
$anonymize = empty($_GET['anonymize']) ? '-a' : '';
|
||||
$diag_file = '/tmp/feedback_diagnostics_'.time().'.zip';
|
||||
exec("/usr/local/emhttp/plugins/dynamix/scripts/diagnostics $anonymize $diag_file");
|
||||
exec("$docroot/plugins/dynamix/scripts/diagnostics $anonymize $diag_file");
|
||||
echo base64_encode(@file_get_contents($diag_file));
|
||||
@unlink($diag_file);
|
||||
exit;
|
||||
@@ -138,7 +139,7 @@ function form_submit(url, params, $panel, diagnostics) {
|
||||
data.message = data.message || '';
|
||||
|
||||
var url_parts = url.split('/');
|
||||
var success_message = '<center><h2>Thank You!</h2><img src="/webGui/images/feedback_'+url_parts[4]+'.jpg"/><p style="text-align:center">'+data.message+'</p></center>';
|
||||
var success_message = '<div style="text-align:center"><h2>Thank You!</h2><img src="/webGui/images/feedback_'+url_parts[4]+'.jpg"/><p style="text-align:center">'+data.message+'</p></div>';
|
||||
|
||||
$('#thanks_panel').html(success_message).fadeIn('fast', function() {
|
||||
var resetfunction = window[url_parts[4]+'_reset'];
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
function addLog($line) { echo "<script>addLog('$line');</script>"; }
|
||||
|
||||
readfile("/usr/local/emhttp/logging.htm");
|
||||
readfile("$docroot/logging.htm");
|
||||
$var = parse_ini_file('state/var.ini');
|
||||
|
||||
$parsed_url = parse_url($_GET['url']);
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$notify = "/usr/local/emhttp/webGui/scripts/notify";
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$notify = "$docroot/webGui/scripts/notify";
|
||||
|
||||
switch ($_POST['cmd']) {
|
||||
case 'init':
|
||||
shell_exec("$notify init");
|
||||
@@ -45,7 +47,7 @@ case 'get':
|
||||
echo shell_exec("$notify get");
|
||||
break;
|
||||
case 'archive':
|
||||
shell_exec("$notify archive '{$_POST['file']}'");
|
||||
shell_exec("$notify archive \"{$_POST['file']}\"");
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'Markdown.php';
|
||||
require_once "$docroot/webGui/include/Markdown.php";
|
||||
|
||||
function get_ini_key($key,$default) {
|
||||
$x = strpos($key, '[');
|
||||
@@ -42,7 +42,7 @@ function build_pages($pattern) {
|
||||
|
||||
function find_pages($item) {
|
||||
global $site,$var,$disks,$devs,$users,$shares,$sec,$sec_nfs,$sec_afp,$name,$display;
|
||||
$pages = array();
|
||||
$pages = [];
|
||||
foreach ($site as $page) {
|
||||
if (empty($page['Menu'])) continue;
|
||||
$menu = strtok($page['Menu'], ' ');
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
function PsExecute($command, $timeout = 20, $sleep = 2) {
|
||||
exec($command.'>/dev/null & echo $!',$op);
|
||||
$pid = (int)$op[0];
|
||||
@@ -31,7 +33,7 @@ function PsEnded($pid) {
|
||||
function PsKill($pid) {
|
||||
exec("kill -9 $pid");
|
||||
}
|
||||
if (PsExecute("/usr/local/emhttp/webGui/scripts/notify -s 'unRAID SMTP Test' -d 'Test message received!' -i 'alert' -t")) {
|
||||
if (PsExecute("$docroot/webGui/scripts/notify -s 'unRAID SMTP Test' -d 'Test message received!' -i 'alert' -t")) {
|
||||
$result = exec("tail -3 /var/log/syslog|awk '/sSMTP/ {getline;print}'|cut -d']' -f2|cut -d'(' -f1");
|
||||
$color = strpos($result, 'Sent mail') ? 'green' : 'red';
|
||||
echo "Test result<span class='$color'>$result</span>";
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
// Wrapper functions
|
||||
function parse_plugin_cfg($plugin, $sections=false) {
|
||||
$ram = "/usr/local/emhttp/plugins/$plugin/default.cfg";
|
||||
global $docroot;
|
||||
$ram = "$docroot/plugins/$plugin/default.cfg";
|
||||
$rom = "/boot/config/plugins/$plugin/$plugin.cfg";
|
||||
$cfg = file_exists($ram) ? parse_ini_file($ram, $sections) : array();
|
||||
$cfg = file_exists($ram) ? parse_ini_file($ram, $sections) : [];
|
||||
return file_exists($rom) ? array_replace_recursive($cfg, parse_ini_file($rom, $sections)) : $cfg;
|
||||
}
|
||||
|
||||
@@ -34,7 +37,8 @@ function agent_fullname($agent, $state) {
|
||||
}
|
||||
|
||||
function get_plugin_attr($attr, $file) {
|
||||
exec("/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin $attr $file", $result, $error);
|
||||
global $docroot;
|
||||
exec("$docroot/plugins/dynamix.plugin.manager/scripts/plugin $attr $file", $result, $error);
|
||||
if ($error===0) return $result[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'webGui/include/Wrappers.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
$memory = '/tmp/memory.tmp';
|
||||
if (isset($_POST['#apply'])) {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'webGui/include/Encryption.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Encryption.php";
|
||||
|
||||
$_POST['AuthPass'] = base64_encrypt($_POST['AuthPass']);
|
||||
?>
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
<?
|
||||
echo "<p style='text-align:center'><span class='error label'>Error</span><span class='warn label'>Warning</span><span class='system label'>System</span><span class='array label'>Array</span></p>\n";
|
||||
|
||||
require_once '/usr/local/emhttp/webGui/include/ColorCoding.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/ColorCoding.php";
|
||||
|
||||
$ata = exec("ls -n /sys/block/{$argv[1]}|grep -Po 'ata\d+'");
|
||||
$dev = $ata ? "${argv[1]}|${ata}[.:]" : $argv[1];
|
||||
|
||||
@@ -18,11 +18,12 @@ $disks = parse_ini_file("/var/local/emhttp/disks.ini",true);
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$devs = parse_ini_file("/var/local/emhttp/devs.ini",true);
|
||||
|
||||
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
|
||||
require_once '/usr/local/emhttp/webGui/include/Preselect.php';
|
||||
require_once '/usr/local/emhttp/webGui/include/CustomMerge.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Preselect.php";
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
|
||||
$notify = "/usr/local/emhttp/webGui/scripts/notify";
|
||||
$notify = "$docroot/webGui/scripts/notify";
|
||||
$ram = "/var/local/emhttp/monitor.ini";
|
||||
$rom = "/boot/config/plugins/dynamix/monitor.ini";
|
||||
$saved = @parse_ini_file($ram,true);
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
|
||||
require_once '/usr/local/emhttp/webGui/include/Encryption.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Encryption.php";
|
||||
|
||||
function usage() {
|
||||
echo <<<EOT
|
||||
@@ -136,13 +137,13 @@ case 'smtp-init':
|
||||
case 'cron-init':
|
||||
@mkdir($unread,0755,true);
|
||||
@mkdir($archive,0755,true);
|
||||
$text = empty($notify['status']) ? "" : "# Generated array status check schedule:\n{$notify['status']} /usr/local/emhttp/plugins/dynamix/scripts/statuscheck &> /dev/null\n\n";
|
||||
$text = empty($notify['status']) ? "" : "# Generated array status check schedule:\n{$notify['status']} $docroot/plugins/dynamix/scripts/statuscheck &> /dev/null\n\n";
|
||||
parse_cron_cfg("dynamix", "status-check", $text);
|
||||
$text = empty($notify['version']) ? "" : "# Generated plugins version check schedule:\n{$notify['version']} /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugincheck &> /dev/null\n\n";
|
||||
$text = empty($notify['version']) ? "" : "# Generated plugins version check schedule:\n{$notify['version']} $docroot/plugins/dynamix.plugin.manager/scripts/plugincheck &> /dev/null\n\n";
|
||||
parse_cron_cfg("dynamix", "plugin-check", $text);
|
||||
$text = empty($notify['system']) ? "" : "# Generated system monitoring schedule:\n{$notify['system']} /usr/local/emhttp/plugins/dynamix/scripts/monitor &> /dev/null\n\n";
|
||||
$text = empty($notify['system']) ? "" : "# Generated system monitoring schedule:\n{$notify['system']} $docroot/plugins/dynamix/scripts/monitor &> /dev/null\n\n";
|
||||
parse_cron_cfg("dynamix", "monitor", $text);
|
||||
$text = empty($notify['docker_update']) ? "" : "# Generated docker monitoring schedule:\n{$notify['docker_update']} /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/dockerupdate.php check &> /dev/null\n\n";
|
||||
$text = empty($notify['docker_update']) ? "" : "# Generated docker monitoring schedule:\n{$notify['docker_update']} $docroot/plugins/dynamix.docker.manager/scripts/dockerupdate.php check &> /dev/null\n\n";
|
||||
parse_cron_cfg("dynamix", "docker-update", $text);
|
||||
break;
|
||||
|
||||
@@ -206,9 +207,9 @@ case 'get':
|
||||
$time = true;
|
||||
foreach ($fields as $field) {
|
||||
if (!$field) continue;
|
||||
$item = explode('=', $field);
|
||||
if ($time) {$item[1] = date("{$notify['date']} {$notify['time']}", $item[1]); $time = false;}
|
||||
$output[$i][] = '\"'.trim($item[0]).'\":\"'.trim($item[1]).'\"';
|
||||
list($key,$val) = explode('=', $field);
|
||||
if ($time) {$val = date($notify['date'].' '.$notify['time'], $val); $time = false;}
|
||||
$output[$i][] = '\"'.trim($key).'\":\"'.trim($val).'\"';
|
||||
}
|
||||
$output[$i++][] = '\"file\":\"'.basename($file).'\"';
|
||||
chmod($file,0000);
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
exec("wget -qO /dev/null 127.0.0.1:$(lsof -i -P -sTCP:LISTEN|grep -Pom1 '^emhttp.*:\K\d+')/update.htm?cmdStatus=apply");
|
||||
|
||||
$notify = "/usr/local/emhttp/webGui/scripts/notify";
|
||||
$notify = "$docroot/webGui/scripts/notify";
|
||||
$disks = parse_ini_file("/var/local/emhttp/disks.ini",true);
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$unraid = parse_plugin_cfg("dynamix",true);
|
||||
@@ -23,7 +24,7 @@ $output = $unraid['notify']['report'];
|
||||
$hot = $unraid['display']['hot'];
|
||||
$max = $unraid['display']['max'];
|
||||
$server = strtoupper($var['NAME']);
|
||||
$data = array();
|
||||
$data = [];
|
||||
$parity = false;
|
||||
$cache = false;
|
||||
$error0 = 0;
|
||||
@@ -47,7 +48,7 @@ function my_scale($value, &$unit, $precision = NULL) {
|
||||
global $unraid;
|
||||
$scale = $unraid['display']['scale'];
|
||||
$number = $unraid['display']['number'];
|
||||
$units = array('B','KB','MB','GB','TB','PB');
|
||||
$units = ['B','KB','MB','GB','TB','PB'];
|
||||
if ($scale==0 && $precision===NULL) {
|
||||
$unit = '';
|
||||
return number_format($value, 0, $number[0], ($value>=10000 ? $number[1] : ''));
|
||||
@@ -116,7 +117,7 @@ function my_array(&$disk) {
|
||||
if ($fail) $fail .= ')';
|
||||
$status = $fail ? ' [NOK]' : ' [OK]';
|
||||
$color = strtok($disk['color'],'-');
|
||||
if ($color=='red'||$color=='yellow') { $error3++; $status = ' ['.str_replace(array('NP_','_'),array('',' '),$disk['status']).']'; }
|
||||
if ($color=='red'||$color=='yellow') { $error3++; $status = ' ['.str_replace(['NP_','_'],['',' '],$disk['status']).']'; }
|
||||
$info = "{$disk['id']} ({$disk['device']})";
|
||||
if ($info==" ()") $info = 'No device identification present';
|
||||
$data[] = my_disk($name)." - $info".my_temp($temp).$fail.$status;
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
<?
|
||||
echo "<p style='text-align:center'><span class='error label'>Error</span><span class='warn label'>Warning</span><span class='system label'>System</span><span class='array label'>Array</span><span class='login label'>Login</span></p>\n";
|
||||
|
||||
require_once '/usr/local/emhttp/webGui/include/ColorCoding.php';
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/ColorCoding.php";
|
||||
|
||||
$handle = popen('/usr/bin/tail -n 40 -f '.escapeshellarg("/var/log/{$argv[1]}").' 2>&1', 'r');
|
||||
while (!feof($handle)) {
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once 'include/Helpers.php';
|
||||
require_once 'include/PageBuilder.php';
|
||||
// Define root path
|
||||
$docroot = $_SERVER['DOCUMENT_ROOT'];
|
||||
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
require_once "$docroot/webGui/include/PageBuilder.php";
|
||||
|
||||
// Extract the 'querystring'
|
||||
// variables provided by emhttp:
|
||||
// path=<path> page path, e.g., path=Main/Disk
|
||||
// prev=<path> prev path, e.g., prev=Main (used to deterine if page was refreshed)
|
||||
// prev=<path> prev path, e.g., prev=Main (used to determine if page was refreshed)
|
||||
extract($_GET);
|
||||
|
||||
// Define some paths
|
||||
$docroot = $_SERVER['DOCUMENT_ROOT'];
|
||||
|
||||
// The current "task" is the first element of the path
|
||||
$task = strtok($path, '/');
|
||||
|
||||
// Get the webGui configuration preferences
|
||||
extract(parse_plugin_cfg("dynamix",true));
|
||||
extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
// Read emhttp status
|
||||
$var = parse_ini_file('state/var.ini');
|
||||
@@ -43,7 +43,7 @@ $sec_afp = parse_ini_file('state/sec_afp.ini',true);
|
||||
extract(parse_ini_file('state/network.ini',true));
|
||||
|
||||
// Merge SMART settings
|
||||
require_once 'include/CustomMerge.php';
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
|
||||
// Build webGui pages first, then plugins pages
|
||||
$site = [];
|
||||
@@ -54,9 +54,9 @@ foreach (glob('plugins/*', GLOB_ONLYDIR) as $plugin) {
|
||||
|
||||
// Here's the page we're rendering
|
||||
$myPage = $site[basename($path)];
|
||||
$pageroot = "{$docroot}/".dirname($myPage['file']);
|
||||
$pageroot = $docroot.'/'.dirname($myPage['file']);
|
||||
$update = $display['refresh']>0 || ($display['refresh']<0 && $var['mdResync']==0);
|
||||
|
||||
// Giddyup
|
||||
require_once 'include/DefaultPageLayout.php';
|
||||
require_once "$docroot/webGui/include/DefaultPageLayout.php";
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user