mirror of
https://github.com/unraid/webgui.git
synced 2026-01-16 14:39:57 -06:00
Merge pull request #184 from bergware/6.4-wip
Take both parity disks in consideration on scheduler page
This commit is contained in:
@@ -15,7 +15,6 @@ Tag="snowflake-o"
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$hide = '/var/tmp/hide_format_button.tmp';
|
||||
$stop = ($var['fsEncryption']=='wrong' || ($var['fsEncryption']=='missing' && $var['luksRestricted']=='yes')) ? 'disabled':'';
|
||||
|
||||
function maintenance_mode() {
|
||||
@@ -41,8 +40,6 @@ function status_indicator() {
|
||||
td.gap{padding-left:26px!important}
|
||||
</style>
|
||||
<script>
|
||||
var ask1 = <?=$confirm['stop'] ? 'true' : 'false'?>;
|
||||
var ask2 = <?=$confirm['down'] ? 'true' : 'false'?>;
|
||||
var ctrl = "<span class='status'><a style='cursor:pointer' class='tooltip_diskio' title='Toggle reads/writes display' onclick='toggle_diskio();return false'><i class='toggle fa'></i></a></span>";
|
||||
|
||||
function tab0() {
|
||||
@@ -79,27 +76,27 @@ function parity_warning(form) {
|
||||
}
|
||||
function stop_array(form) {
|
||||
$(form).append('<input type="hidden" name="cmdStop" value="Stop">');
|
||||
if (ask1) {
|
||||
swal({title:'Proceed?',text:'This will stop the array',type:'warning',showCancelButton:true},function(p){if (p) $.post('/webGui/include/HideFormatButton.php',{hide:'no'},function(){form.submit();}); else $('input[name="cmdStop"]').remove();});
|
||||
} else {
|
||||
$.post('/webGui/include/HideFormatButton.php',{hide:'no'},function(){form.submit();});
|
||||
}
|
||||
<?if ($confirm['stop']):?>
|
||||
swal({title:'Proceed?',text:'This will stop the array',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdStop"]').remove();});
|
||||
<?else:?>
|
||||
form.submit();
|
||||
<?endif;?>
|
||||
}
|
||||
function stop_parity(form,text) {
|
||||
$(form).append('<input type="hidden" name="cmdNoCheck" value="Cancel">');
|
||||
if (ask1) {
|
||||
swal({title:'Proceed?',text:'This will stop the running '+text+' operation',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdNoCheck"]').remove();});
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
<?if ($confirm['stop']):?>
|
||||
swal({title:'Proceed?',text:'This will stop the running '+text+' operation',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdNoCheck"]').remove();});
|
||||
<?else:?>
|
||||
form.submit();
|
||||
<?endif;?>
|
||||
}
|
||||
function shut_down(form,cmd) {
|
||||
$(form).append('<input type="hidden" name="cmd" value="'+cmd+'">');
|
||||
if (ask2) {
|
||||
swal({title:'Proceed?',text:'This will '+cmd+' the system',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmd"]').remove();});
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
<?if ($confirm['down']):?>
|
||||
swal({title:'Proceed?',text:'This will '+cmd+' the system',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmd"]').remove();});
|
||||
<?else:?>
|
||||
form.submit();
|
||||
<?endif;?>
|
||||
}
|
||||
function prepareInput(form) {
|
||||
$(form).append('<input type="hidden" name="cmdStart" value="Start">');
|
||||
@@ -186,13 +183,19 @@ toggle_diskio(true);
|
||||
<tr><td><?=status_indicator()?><span class="strong big">Started<?=(($var['startMode']=='Maintenance')?' - Maintenance Mode':'')?></span></td>
|
||||
<td><input type="button" value="Stop" onclick="stop_array(this.form)"<?if ($parity||$mover):?> disabled<?endif;?>></td>
|
||||
<td><strong>Stop</strong> will take the array off-line.<?=$parity?"<br>$parity":($mover?"<br>$mover":"")?></td></tr>
|
||||
<? if ($var['fsNumUnmountable']>0 && !file_exists($hide)):?>
|
||||
<? if ($var['fsNumUnmountable']>0):?>
|
||||
<tr><td><strong>Unmountable disk<?=$var['fsNumUnmountable']==1?'':'s'?> present:</strong><br>
|
||||
<? foreach ($disks as $disk) if (strpos($disk['fsStatus'],'Unmountable')!==false)
|
||||
echo "<span class='blue-text'>".my_disk($disk['name'])."</span> • ".my_id($disk['id'])." (".$disk['device'].")<br>";
|
||||
?> </td><td><input type="submit" id="submit" name="cmdFormat" value="Format" disabled><input type="hidden" name="unmountable_mask" value="<?=$var['fsUnmountableMask']?>"></td>
|
||||
echo "<span class='blue-text'>".my_disk($disk['name'])."</span> • ".my_id($disk['id'])." (".$disk['device'].")<br>";?>
|
||||
</td><td><input type="submit" id="submit" name="cmdFormat" value="Format" disabled><input type="hidden" name="unmountable_mask" value="<?=$var['fsUnmountableMask']?>"></td>
|
||||
<td><strong>Format</strong> will create a file system in all <strong>Unmountable</strong> disks, discarding all data currently on those disks.<br>
|
||||
<input type="checkbox" name="confirmFormat" value="OFF" onclick="$('#submit').prop('disabled',!arrayOps.confirmFormat.checked)"><small>Yes I want to do this</small></td></tr>
|
||||
<? if ($var['mdResync']==0):?>
|
||||
<input type="checkbox" name="confirmFormat" value="OFF" onclick="$('#submit').prop('disabled',!arrayOps.confirmFormat.checked)">
|
||||
<small>Yes I want to do this <i class="fa fa-asterisk red-text" style="cursor:help" title="All data is permanently lost. This is not used to recover data."></i></small>
|
||||
<? else:?>
|
||||
<small>Disabled -- Parity operation is running</small>
|
||||
<? endif;?>
|
||||
</td></tr>
|
||||
<? endif;
|
||||
if (!$parity):
|
||||
if (strstr($var['mdResyncAction'],"recon")):?>
|
||||
@@ -261,7 +264,7 @@ toggle_diskio(true);
|
||||
<tr><td><?=status_indicator()?><span class="strong big">Starting...</span></td><td><input type="submit" name="cmdStart" value="Start" disabled></td><td></td></tr>
|
||||
<? break;
|
||||
case "Formatting":?>
|
||||
<tr><td><?=status_indicator()?><span class="strong big">Started, formatting...</span></td><td><input type="submit" name="cmdStart" value="Start" disabled></td><td></td></tr>
|
||||
<tr><td><?=status_indicator()?><span class="strong big">Started, formatting...</span></td><td><input type="submit" name="cmdStop" value="Stop" disabled></td><td></td></tr>
|
||||
<? break;
|
||||
case "Copying":?>
|
||||
<tr><td><?=status_indicator()?><span id="fsState" class="strong big">Copying, <?=$var['fsCopyPrcnt']?>% complete...</span></td><td><input type="submit" name="cmdNoCopy" value="Cancel"></td><td></td></tr>
|
||||
@@ -306,8 +309,8 @@ toggle_diskio(true);
|
||||
<td><strong>Start</strong> will bring the array on-line.</td></tr>
|
||||
<? endif;
|
||||
maintenance_mode();
|
||||
if ($var['fsEncryption']=='wrong' || $var['fsEncryption']=='missing'):
|
||||
?> <tr><td></td><td class="gap">Encryption status:</td><td><span class="red-text"><?=$var['fsEncryption']=='wrong'?'Wrong key':'Missing key'?></span></td></tr>
|
||||
if ($var['fsEncryption']=='wrong' || $var['fsEncryption']=='missing'):?>
|
||||
<tr><td></td><td class="gap">Encryption status:</td><td><span class="red-text"><?=$var['fsEncryption']=='wrong'?'Wrong key':'Missing key'?></span></td></tr>
|
||||
<tr><td></td><td class="gap">Encryption input:</td><td><select name="input" size="1" onchange="selectInput(this.form)"><?=mk_option(1,"text","Passphrase")?><?=mk_option(1,"file","Keyfile")?></select></td></tr>
|
||||
<tr id="text"><td></td><td class="gap">Passphrase:</td><td><input type="password" name="text" maxlength="512" value="" onkeyup="toggleStart(this.value)"><input type="checkbox" onchange="showPass(this.checked)">show passphrase</td></tr>
|
||||
<tr id="file" style="display:none"><td></td><td class="gap">Keyfile:</td><td><input type="file" name="local" onchange="getFileContent(event,this.form)"></td></tr>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Menu="Shares:2"
|
||||
Title="Disk Shares"
|
||||
Tag="user-circle-o"
|
||||
Cond="$var['fsState']=='Started' && $var['shareDisk']!='no'"
|
||||
Cond="$var['fsState']!="Stopped" && $var['shareDisk']!='no'"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
|
||||
@@ -74,6 +74,7 @@ span.pin i{font-size:16px;cursor:pointer;}
|
||||
span.red{color:#E68A00;}
|
||||
span.blue{color:#00529B;}
|
||||
span.green{color:#4F8A10;}
|
||||
input.gap{margin-right:10px}
|
||||
div.shade-white{background-color:#F8F8F8;}
|
||||
div.shade-black{background-color:#0C0C0C;}
|
||||
</style>
|
||||
@@ -593,7 +594,7 @@ Enable VLANs:
|
||||
<?else:?>
|
||||
<div class="access-eth0 shade-<?=$display['theme']?>" style="display:none" markdown="1">
|
||||
VLAN number:
|
||||
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=$eth0["VLANID:$i"]?>" class="narrow" required>
|
||||
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=$eth0["VLANID:$i"]?>" class="narrow gap" required>
|
||||
<span class="pin" onclick="removeVLAN($('#index-eth0-<?=$i?>'),<?=$service?'true':'false'?>)"><i class="fa fa-minus-circle red"></i><em>remove VLAN</em></span>
|
||||
|
||||
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
|
||||
@@ -687,7 +688,7 @@ IPv6 privacy extensions:
|
||||
<script type="text/html" id="network-template-eth0" markdown="1">
|
||||
<div id="index-eth0-INDEX" class="access-eth0 shade-<?=$display['theme']?>" markdown="1">
|
||||
VLAN number:
|
||||
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=$eth0["VLANID:INDEX"]?>" class="narrow" required>
|
||||
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=$eth0["VLANID:INDEX"]?>" class="narrow gap" required>
|
||||
<span class="pin" onclick="removeVLAN($('#index-eth0-INDEX'),false)"><i class="fa fa-minus-circle red"></i><em>remove VLAN</em></span>
|
||||
|
||||
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
|
||||
|
||||
@@ -252,7 +252,7 @@ Enable VLANs:
|
||||
<?else:?>
|
||||
<div class="access-ethX shade-<?=$display['theme']?>" style="display:none" markdown="1">
|
||||
VLAN number:
|
||||
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=$ethX["VLANID:$i"]?>" class="narrow" required>
|
||||
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=$ethX["VLANID:$i"]?>" class="narrow gap" required>
|
||||
<span class="pin" onclick="removeVLAN($('#index-ethX-<?=$i?>'),<?=$service?'true':'false'?>)"><i class="fa fa-minus-circle red"></i><em>remove VLAN</em></span>
|
||||
|
||||
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
|
||||
@@ -344,7 +344,7 @@ IPv6 privacy extensions:
|
||||
<script type="text/html" id="network-template-ethX" markdown="1">
|
||||
<div id="index-ethX-INDEX" class="access-ethX shade-<?=$display['theme']?>" markdown="1">
|
||||
VLAN number:
|
||||
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=$ethX["VLANID:INDEX"]?>" class="narrow" required>
|
||||
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=$ethX["VLANID:INDEX"]?>" class="narrow gap" required>
|
||||
<span class="pin" onclick="removeVLAN($('#index-ethX-INDEX'),false)"><i class="fa fa-minus-circle red"></i><em>remove VLAN</em></span>
|
||||
|
||||
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
|
||||
|
||||
@@ -15,15 +15,16 @@ Tag="calendar-check-o"
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$disabled = '';
|
||||
if (empty($disks['cache']) || $disks['cache']['status']=='DISK_NP') {
|
||||
echo "<span class='big orange-text'>No Cache disk present!</span>";
|
||||
return;
|
||||
echo "<p class='notice'>No Cache disk present!</p>";
|
||||
$disabled = 'disabled';
|
||||
} elseif ($var['shareCacheEnabled']!='yes') {
|
||||
echo "<span class='big orange-text'>Cache disk not enabled!</span>";
|
||||
return;
|
||||
echo "<p class='notice'>Cache disk not enabled!</p>";
|
||||
$disabled = 'disabled';
|
||||
} elseif ($var['shareUser']=='-') {
|
||||
echo "<span class='big orange-text'>User shares not enabled!</span>";
|
||||
return;
|
||||
echo "<p class='notice'>User shares not enabled!</p>";
|
||||
$disabled = 'disabled';
|
||||
}
|
||||
$cron = explode(' ',$var['shareMoverSchedule']);
|
||||
$move = $cron[2]!='*' ? 3 : ($cron[4]!='*' ? 2 : (substr($cron[1],0,1)!='*' ? 1 : 0));
|
||||
@@ -127,6 +128,6 @@ Mover logging:
|
||||
<?if (file_exists("/var/run/mover.pid")):?>
|
||||
: <input type="submit" name="cmdStartMover" value="Move now" disabled> Mover is running.
|
||||
<?else:?>
|
||||
: <input type="submit" name="cmdStartMover" value="Move now"> Click to invoke the Mover.
|
||||
: <input type="submit" name="cmdStartMover" value="Move now"<?=$disabled?>> Click to invoke the Mover.
|
||||
<?endif;?>
|
||||
</form>
|
||||
@@ -15,9 +15,8 @@ Tag="calendar"
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
if ($disks['parity']['status']=='DISK_NP_DSBL') {
|
||||
echo "<span class='big orange-text'>No Parity disk present!</span>";
|
||||
return;
|
||||
if ($disks['parity']['status']=='DISK_NP_DSBL' && $disks['parity2']['status']=='DISK_NP_DSBL') {
|
||||
echo "<p class='notice'>No Parity disk present!</p>";
|
||||
}
|
||||
$width = strstr('gray,azure',$display['theme']) ? [166,305]:[131,300];
|
||||
$mode = ['Disabled','Daily','Weekly','Monthly','Yearly','Custom'];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Menu="Shares:1"
|
||||
Title="User Shares"
|
||||
Tag="user-circle"
|
||||
Cond="$var['fsState']=="Started" && $var['shareUser']=='e'"
|
||||
Cond="$var['fsState']!="Stopped" && $var['shareUser']=='e'"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
|
||||
@@ -2,8 +2,8 @@ Menu="Tasks:2"
|
||||
Type="xmenu"
|
||||
----
|
||||
<?PHP
|
||||
if ($var['fsState']!="Started") {
|
||||
echo "<p class='notice'>Array must be <span class='strong big'>started</span> to view Shares.</p>";
|
||||
if ($var['fsState']=="Stopped") {
|
||||
echo "<p class='notice'>Array must be <span class='strong big'>Started</span> to view Shares.</p>";
|
||||
return;
|
||||
}
|
||||
if (count($pages)==2) $tabbed = false;
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
list($luks,$size,$hash,$rng) = explode(',',exec("/usr/sbin/cryptsetup --help|tail -1"));
|
||||
$luks = str_replace('-plain64','',trim(explode(':',$luks)[1]));
|
||||
$size = str_replace(' bits','',trim(explode(':',$size)[1]));
|
||||
$hash = trim(explode(':',$hash)[1]);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -26,7 +32,7 @@ var test = 'sha1,sha256,sha512,ripemd160,whirlpool,aes-cbc:128,serpent-cbc:128,t
|
||||
|
||||
function benchmark(index,last){
|
||||
if (index > last) return;
|
||||
$.get('/webGui/include/update.crypto.php',{index:index,test:test},function(data){
|
||||
$.get('/webGui/include/update.crypto.php',{index:index,test:test,luks:'<?=$luks?>:<?=$size?>',hash:'<?=$hash?>'},function(data){
|
||||
$('pre').append(data);
|
||||
benchmark(index+1,last);
|
||||
});
|
||||
|
||||
@@ -535,7 +535,7 @@ $(function() {
|
||||
else if (ini['mdResyncAction'] == "check") action="Read-Check";
|
||||
else if (ini['mdResyncAction'].indexOf("check")>=0) action="Parity-Check";
|
||||
action+=" "+(ini['mdResyncPos']/(ini['mdResync']/100+1)).toFixed(1)+" %";
|
||||
status+="•<span class='orange strong'>"+action+"</span>";
|
||||
status+="•<span class='orange strong'>"+action.replace('.','<?=$display['number'][0]?>')+"</span>";
|
||||
}
|
||||
if (progress)
|
||||
status+="•<span class='blue strong'>"+progress+"</span>";
|
||||
|
||||
@@ -74,7 +74,7 @@ function device_browse(&$disk) {
|
||||
}
|
||||
function device_desc(&$disk) {
|
||||
global $var;
|
||||
$size = my_scale($disk['size'] ? $disk['size']*1024 : $disk['sectors']*$disk['sector_size'],$unit);
|
||||
$size = my_scale($disk['size'] ? $disk['size']*1024 : $disk['sectors']*$disk['sector_size'],$unit,-1);
|
||||
$log = $var['fsState']=='Started' ? "<a href=\"#\" title=\"Disk Log Information\" onclick=\"openBox('/webGui/scripts/disk_log&arg1={$disk['device']}','Disk Log Information',600,900,false);return false\"><i class=\"fa fa-hdd-o icon\"></i></a>" : "";
|
||||
return $log.my_id($disk['id'])." - $size $unit ({$disk['device']})";
|
||||
}
|
||||
@@ -103,7 +103,7 @@ function fs_info(&$disk) {
|
||||
return;
|
||||
} elseif ($disk['fsStatus']=='Mounted') {
|
||||
echo "<td>".str_replace('luks:','',$disk['fsType'])."</td>";
|
||||
echo "<td>".my_scale($disk['fsSize']*1024,$unit)." $unit</td>";
|
||||
echo "<td>".my_scale($disk['fsSize']*1024,$unit,-1)." $unit</td>";
|
||||
if ($display['text']%10==0) {
|
||||
echo "<td>".my_scale($disk['fsUsed']*1024,$unit)." $unit</td>";
|
||||
} else {
|
||||
@@ -236,7 +236,7 @@ function show_totals($text) {
|
||||
echo "<td>".my_number($sum['numErrors'])."</td>";
|
||||
echo "<td></td>";
|
||||
if (strstr($text,'Array') && ($var['startMode']=='Normal')) {
|
||||
echo "<td>".my_scale($sum['fsSize']*1024,$unit)." $unit</td>";
|
||||
echo "<td>".my_scale($sum['fsSize']*1024,$unit,-1)." $unit</td>";
|
||||
if ($display['text']%10==0) {
|
||||
echo "<td>".my_scale($sum['fsUsed']*1024,$unit)." $unit</td>";
|
||||
} else {
|
||||
|
||||
@@ -15,20 +15,23 @@ $docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
// Helper functions
|
||||
function my_scale($value, &$unit, $decimals = NULL) {
|
||||
function my_scale($value, &$unit, $decimals=NULL, $scale=NULL) {
|
||||
global $display;
|
||||
$scale = $display['scale'];
|
||||
$scale = $scale ?? $display['scale'];
|
||||
$number = $display['number'];
|
||||
$units = ['B','KB','MB','GB','TB','PB'];
|
||||
if ($scale==0 && $decimals===NULL) {
|
||||
$units = ['B','KB','MB','GB','TB','PB','EB','ZB','YB'];
|
||||
$size = count($units);
|
||||
if ($scale==0 && ($decimals===NULL || $decimals<0)) {
|
||||
$decimals = 0;
|
||||
$unit = '';
|
||||
} else {
|
||||
$base = $value ? floor(log($value, 1000)) : 0;
|
||||
if ($scale>0 && $base>$scale) $base = $scale;
|
||||
if ($base>$size) $base = $size-1;
|
||||
$value /= pow(1000, $base);
|
||||
if ($decimals===NULL) $decimals = $value>=100 ? 0 : ($value>=10 ? 1 : (round($value*100)%100==0 ? 0 : 2));
|
||||
if ($scale<0 && round($value,$decimals)==1000) { $value = 1; $base++; }
|
||||
if ($decimals===NULL) $decimals = $value>=100 ? 0 : ($value>=10 ? 1 : (round($value*100)%100===0 ? 0 : 2));
|
||||
elseif ($decimals<0) $decimals = $value>=100||round($value*10)%10===0 ? 0 : abs($decimals);
|
||||
if ($scale<0 && round($value,-1)==1000) {$value = 1; $base++;}
|
||||
$unit = $units[$base];
|
||||
}
|
||||
return number_format($value, $decimals, $number[0], $value>=10000 ? $number[1] : '');
|
||||
@@ -38,7 +41,7 @@ function my_number($value) {
|
||||
$number = $display['number'];
|
||||
return number_format($value, 0, $number[0], ($value>=10000 ? $number[1] : ''));
|
||||
}
|
||||
function my_time($time, $fmt = NULL) {
|
||||
function my_time($time, $fmt=NULL) {
|
||||
global $display;
|
||||
if (!$fmt) $fmt = $display['date'].($display['date']!='%c' ? ", {$display['time']}" : "");
|
||||
return $time ? strftime($fmt, $time) : "unknown";
|
||||
@@ -82,7 +85,7 @@ function my_usage() {
|
||||
echo "<div class='usage-bar'><span style='text-align:center'>".($var['fsState']=='Started'?'Maintenance':'off-line')."</span></div>";
|
||||
}
|
||||
}
|
||||
function usage_color(&$disk,$limit,$free) {
|
||||
function usage_color(&$disk, $limit, $free) {
|
||||
global $display;
|
||||
if ($display['text']==1 || intval($display['text']/10)==1) return '';
|
||||
$critical = !empty($disk['critical']) ? $disk['critical'] : $display['critical'];
|
||||
@@ -97,7 +100,7 @@ function usage_color(&$disk,$limit,$free) {
|
||||
return 'greenbar';
|
||||
}
|
||||
}
|
||||
function my_check($time,$speed) {
|
||||
function my_check($time, $speed) {
|
||||
if (!$time) return 'unavailable (no parity-check entries logged)';
|
||||
$days = floor($time/86400);
|
||||
$hmss = $time-$days*86400;
|
||||
@@ -114,10 +117,10 @@ function my_error($code) {
|
||||
return "<strong>$code</strong>";
|
||||
}
|
||||
}
|
||||
function mk_option($select, $value, $text, $extra = "") {
|
||||
function mk_option($select, $value, $text, $extra="") {
|
||||
return "<option value='$value'".($value==$select ? " selected" : "").(strlen($extra) ? " $extra" : "").">$text</option>";
|
||||
}
|
||||
function mk_option_check($name, $value, $text = "") {
|
||||
function mk_option_check($name, $value, $text="") {
|
||||
if ($text) {
|
||||
$checked = in_array($value,explode(',',$name)) ? " selected" : "";
|
||||
return "<option value='$value'$checked>$text</option>";
|
||||
@@ -160,7 +163,7 @@ function day_count($time) {
|
||||
function plus($val, $word, $last) {
|
||||
return $val>0 ? (($val || $last) ? ($val.' '.$word.($val!=1?'s':'').($last ?'':', ')) : '') : '';
|
||||
}
|
||||
function read_parity_log($epoch,$busy=false) {
|
||||
function read_parity_log($epoch, $busy=false) {
|
||||
$log = '/boot/config/parity-checks.log';
|
||||
if (file_exists($log)) {
|
||||
$timestamp = str_replace(['.0','.'],[' ',' '],date('M.d H:i:s',$epoch));
|
||||
@@ -176,7 +179,7 @@ function read_parity_log($epoch,$busy=false) {
|
||||
function urlencode_path($path) {
|
||||
return str_replace("%2F", "/", urlencode($path));
|
||||
}
|
||||
function pgrep($process_name,$escape_arg=true) {
|
||||
function pgrep($process_name, $escape_arg=true) {
|
||||
$pid = exec("pgrep ".($escape_arg?escapeshellarg($process_name):$process_name), $output, $retval);
|
||||
return $retval == 0 ? $pid : false;
|
||||
}
|
||||
@@ -229,7 +232,7 @@ function input_private_users($sec) {
|
||||
echo "</table>";
|
||||
}
|
||||
function is_block($path) {
|
||||
return (@filetype(realpath($path)) == 'block');
|
||||
return (@filetype(realpath($path))=='block');
|
||||
}
|
||||
function autov($file) {
|
||||
global $docroot;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2012-2017, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$hide = '/var/tmp/hide_format_button.tmp';
|
||||
$flag = file_exists($hide);
|
||||
|
||||
switch ($_POST['hide']) {
|
||||
case 'yes': if (!$flag) touch($hide); break;
|
||||
case 'no' : if ($flag) unlink($hide); break;
|
||||
}
|
||||
?>
|
||||
@@ -70,7 +70,7 @@ case "attributes":
|
||||
$max = $unraid['display']['max'];
|
||||
$hot = $unraid['display']['hot'];
|
||||
exec("smartctl -A $type ".escapeshellarg("/dev/$port")."|awk 'NR>4'",$output);
|
||||
if (strpos($output[0], 'SMART Attributes Data Structure') === 0) {
|
||||
if (strpos($output[0], 'SMART Attributes Data Structure')===0) {
|
||||
$output = array_slice($output, 3);
|
||||
$empty = true;
|
||||
foreach ($output as $line) {
|
||||
@@ -91,7 +91,9 @@ case "attributes":
|
||||
} else {
|
||||
// probably a NMVe or SAS device that smartmontools doesn't know how to parse in to a SMART Attributes Data Structure
|
||||
foreach ($output as $line) {
|
||||
echo "<tr><td colspan='10'>".str_replace(' ', ' ', htmlspecialchars($line))."</td></tr>";
|
||||
if (strpos($line,':')===false) continue;
|
||||
list($name,$value) = explode(':', $line);
|
||||
echo "<tr><td>-</td><td>".ucfirst(strtolower($name))."</td><td colspan='8'>".trim($value)."</td></tr>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -17,11 +17,17 @@ if ($index < count($tests)) {
|
||||
$test = $tests[$index];
|
||||
list($name,$size) = explode(':',$test);
|
||||
if (!$size) {
|
||||
$default = $test==$_GET['hash'];
|
||||
if ($index>0) $test .= '|tail -1';
|
||||
echo shell_exec("/usr/sbin/cryptsetup benchmark -h $test");
|
||||
if ($default) echo "<b>";
|
||||
echo preg_replace(['/^(# Tests.*\n)/','/\n$/'],["$1\n",""],shell_exec("/usr/sbin/cryptsetup benchmark -h $test"));
|
||||
echo $default ? " (default)</b>\n" : "\n";
|
||||
} else {
|
||||
$default = $test==$_GET['luks'];
|
||||
if ($index>5) $size .= '|tail -1';
|
||||
echo preg_replace('/^# Tests.*\n/',"\n",shell_exec("/usr/sbin/cryptsetup benchmark -c $name -s $size"));
|
||||
if ($default) echo "<b>";
|
||||
echo preg_replace(['/^# Tests.*\n/','/\n$/'],["\n",""],shell_exec("/usr/sbin/cryptsetup benchmark -c $name -s $size"));
|
||||
echo $default ? " (default)</b>\n" : "\n";
|
||||
}
|
||||
} else {
|
||||
$bm = popen('/usr/sbin/cryptsetup --help','r');
|
||||
@@ -32,6 +38,6 @@ if ($index < count($tests)) {
|
||||
elseif (strpos($text,'LUKS1:')!==false) echo str_replace("\t"," ",$text);
|
||||
}
|
||||
pclose($bm);
|
||||
echo "<div style='text-align:center'><input type='button' value='Done' onclick='top.Shadowbox.close()'></div>";
|
||||
echo "<div style='text-align:center;margin-top:12px'><input type='button' value='Done' onclick='top.Shadowbox.close()'></div>";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -42,7 +42,7 @@ function my_temp($value) {
|
||||
function my_disk($name) {
|
||||
return ucfirst(preg_replace('/^(disk|cache)([0-9]+)/','$1 $2',$name));
|
||||
}
|
||||
function my_scale($value,&$unit,$precision = NULL) {
|
||||
function my_scale($value,&$unit,$precision=NULL) {
|
||||
global $unraid;
|
||||
$scale = $unraid['display']['scale'];
|
||||
$number = $unraid['display']['number'];
|
||||
@@ -88,8 +88,8 @@ function read_write_parity_log($epoch,$duration,$speed,$status,$error) {
|
||||
function check_temp($name,$temp,$text,$info) {
|
||||
global $notify,$disks,$saved,$unraid,$server;
|
||||
$disk = &$disks[$name];
|
||||
$hot = strlen($disk['hotTemp']) ? $disk['hotTemp'] : $unraid['display']['hot'];
|
||||
$max = strlen($disk['maxTemp']) ? $disk['maxTemp'] : $unraid['display']['max'];
|
||||
$hot = $disk['hotTemp'] ?? $unraid['display']['hot'];
|
||||
$max = $disk['maxTemp'] ?? $unraid['display']['max'];
|
||||
$warn = $temp>=$max && $max>0 ? 'alert' : ($temp>=$hot && $hot>0 ? 'warning' : '');
|
||||
$item = 'temp';
|
||||
$last = isset($saved[$item][$name]) ? $saved[$item][$name] : 0;
|
||||
@@ -177,8 +177,8 @@ function check_usage($name,$used,$text,$info) {
|
||||
global $notify,$disks,$saved,$unraid,$server;
|
||||
if ($used == -1) return;
|
||||
$disk = &$disks[$name];
|
||||
$warning = strlen($disk['warning']) ? $disk['warning'] : $unraid['display']['warning'];
|
||||
$critical = strlen($disk['critical']) ? $disk['critical'] : $unraid['display']['critical'];
|
||||
$warning = $disk['warning'] ?? $unraid['display']['warning'];
|
||||
$critical = $disk['critical'] ?? $unraid['display']['critical'];
|
||||
$warn = $used>=$critical && $critical>0 ? 'alert' : ($used>=$warning && $warning>0 ? 'warning' : '');
|
||||
$item = 'used';
|
||||
$last = isset($saved[$item][$name]) ? $saved[$item][$name] : 0;
|
||||
@@ -302,7 +302,7 @@ if ($var['mdResync']>0) {
|
||||
} elseif (strstr($var['mdResyncAction'],"check")) {
|
||||
$last = 'Parity check';
|
||||
}
|
||||
$info = "Size: ".my_scale($var['mdResyncSize']*1024, $unit)." $unit";
|
||||
$info = "Size: ".my_scale($var['mdResyncSize']*1024,$unit)." $unit";
|
||||
exec("$notify -e ".escapeshellarg("unRAID $last")." -s ".escapeshellarg("Notice [$server] - $last started")." -d ".escapeshellarg("$info")." -i \"warning\"");
|
||||
$saved[$item][$name] = $last;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user