mirror of
https://github.com/unraid/webgui.git
synced 2026-03-06 00:18:57 -06:00
Merge pull request #196 from bergware/6.4-wip
DeviceList code optimization
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2015, Dan Landon.
|
||||
* Copyright 2015, Bergware International.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2015, Dan Landon.
|
||||
* Copyright 2015, Bergware International.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2014-2016, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2014-2017, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2014-2016, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2014-2017, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
if ( isset( $_GET['cmd'] )) {
|
||||
$command = rawurldecode(($_GET['cmd']));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2014-2016, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2014-2017, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
|
||||
// Autostart file
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
// Copyright 2005-2016, Lime Technology
|
||||
// Copyright 2005-2017, Lime Technology
|
||||
// License: GPLv2 only
|
||||
//
|
||||
// Program updates made by Bergware International (April 2016)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2015-2016, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2015-2017, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2015-2016, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2015-2017, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
// Load emhttp variables if needed.
|
||||
if (!isset($var)){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2016, Lime Technology
|
||||
* Copyright 2016, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
/* Copyright 2017, Lime Technology
|
||||
* Copyright 2017, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2015-2016, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2015-2017, Derek Macias, Eric Schultz, Jon Panozzo.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
|
||||
require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
|
||||
|
||||
@@ -56,13 +56,13 @@ function tab0() {
|
||||
$.removeCookie('one',{path:'/'});
|
||||
$.cookie('tab','tab0',{path:'/'});
|
||||
}
|
||||
function parity_status() {
|
||||
function parityStatus() {
|
||||
$.post('/webGui/include/DeviceList.php',{path:'<?=$path?>',device:'parity'},function(data) {
|
||||
if (data) {$.each(data.split(';'),function(k,v) {if ($('#line'+k).length>0) $('#line'+k).html(v);});}
|
||||
<?if ($tabbed):?>
|
||||
if ($('#tab'+$('input[name$="tabs"]').length).is(':checked')) timer = setTimeout(parity_status,3000);
|
||||
if ($('#tab'+$('input[name$="tabs"]').length).is(':checked')) timer = setTimeout(parityStatus,3000);
|
||||
<?else:?>
|
||||
setTimeout(parity_status,3000);
|
||||
setTimeout(parityStatus,3000);
|
||||
<?endif;?>
|
||||
if (!data && $('#cancelButton').length>0 && $('#cancelButton').val()=='Cancel') {
|
||||
$('#cancelButton').val('Done').unbind().bind({click:function(){refresh();}});
|
||||
@@ -71,7 +71,7 @@ function parity_status() {
|
||||
}
|
||||
});
|
||||
}
|
||||
function parity_warning(form) {
|
||||
function parityWarning(form) {
|
||||
<?if (strpos($disks['parity2']['status'],'_NP')===false):?>
|
||||
var text = '<i>Dual parity valid</i> requires <b>ALL</b> disks in their original slots';
|
||||
<?else:?>
|
||||
@@ -84,7 +84,7 @@ function parity_warning(form) {
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
function stop_array(form) {
|
||||
function stopArray(form) {
|
||||
$(form).append('<input type="hidden" name="cmdStop" value="Stop">');
|
||||
<?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();});
|
||||
@@ -92,7 +92,7 @@ function stop_array(form) {
|
||||
form.submit();
|
||||
<?endif;?>
|
||||
}
|
||||
function stop_parity(form,text) {
|
||||
function stopParity(form,text) {
|
||||
$(form).append('<input type="hidden" name="cmdNoCheck" value="Cancel">');
|
||||
<?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();});
|
||||
@@ -100,7 +100,7 @@ function stop_parity(form,text) {
|
||||
form.submit();
|
||||
<?endif;?>
|
||||
}
|
||||
function shut_down(form,cmd) {
|
||||
function shutdown(form,cmd) {
|
||||
$(form).append('<input type="hidden" name="cmd" value="'+cmd+'">');
|
||||
<?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();});
|
||||
@@ -170,11 +170,11 @@ function getFileContent(event,form) {
|
||||
reader.onload = function(){form.file.value=reader.result;toggleStart(false);};
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
parity_status();
|
||||
parityStatus();
|
||||
<?if ($tabbed):?>
|
||||
$('.tabs').append(ctrl);
|
||||
if ($.cookie('tab')=='tab0') $('i.toggle').hide();
|
||||
$('#tab'+$('input[name$="tabs"]').length).bind({click:function() {clearTimeout(timer); parity_status(); tab0(); $('i.toggle').hide('slow');}});
|
||||
$('#tab'+$('input[name$="tabs"]').length).bind({click:function() {clearTimeout(timer); parityStatus(); tab0(); $('i.toggle').hide('slow');}});
|
||||
<?else:?>
|
||||
$('div[id=title]:not(":last, .disable_diskio")').each(function(){$(this).append(ctrl);});
|
||||
<?endif;?>
|
||||
@@ -219,7 +219,7 @@ $(function(){
|
||||
switch ($var['fsState']):
|
||||
case "Started":?>
|
||||
<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><input type="button" value="Stop" onclick="stopArray(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):?>
|
||||
<tr><td><strong>Unmountable disk<?=$var['fsNumUnmountable']==1?'':'s'?> present:</strong><br>
|
||||
@@ -227,8 +227,8 @@ $(function(){
|
||||
echo "<span class='blue-text'>".my_disk($disk['name'])."</span> • ".my_id($disk['id'])." (".$disk['device'].")<br>";?>
|
||||
</td><td><input type="submit" id="btnFormat" 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="$('#btnFormat').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>
|
||||
<a class="info none img nohand"><input type="checkbox" name="confirmFormat" value="OFF" onclick="$('#btnFormat').prop('disabled',!arrayOps.confirmFormat.checked)">
|
||||
<small>Yes I want to do this <i class="fa fa-asterisk red-text" ></i><span><b>All data is permanently lost !!!<br>This is not used to recover data</b></span></small></a>
|
||||
</td></tr>
|
||||
<? endif;
|
||||
if (!$parity):
|
||||
@@ -242,46 +242,50 @@ $(function(){
|
||||
<? elseif (strstr($var['mdResyncAction'],"check")):?>
|
||||
<tr><td>Parity is valid.</td><td><input type="submit" name="cmdCheck" value="Check"></td><td><strong>Check</strong> will start <strong>Parity-Check</strong>.
|
||||
<br><input type="checkbox" name="optionCorrect" value="correct" checked><small>Write corrections to parity</small></td></tr>
|
||||
<? endif;
|
||||
if ($var['sbSyncExit']!=0):?>
|
||||
<tr><td></td><td><input type="button" value="History" onclick="openBox('/webGui/include/ParityHistory.php','Parity/Read-Check History',600,540,false)"></td>
|
||||
<? endif;?>
|
||||
<tr><td></td><td><input type="button" value="History" onclick="openBox('/webGui/include/ParityHistory.php','Parity/Read-Check History',600,540,false)"></td>
|
||||
<? if ($var['sbSyncExit']!=0):?>
|
||||
<td>Last check incomplete on <strong><?=my_time($var['sbSynced2']).day_count($var['sbSynced2'])?></strong><?if ($var['sbSynced2']):?>, finding <strong><?=$var['sbSyncErrs']?></strong> error<?=$var['sbSyncErrs']==1?'':'s'?>.<?endif;?>
|
||||
<br><i class="fa fa-dot-circle-o icon"></i><small>Error code: <?=my_error($var['sbSyncExit'])?></small></td></tr>
|
||||
<? elseif ($var['sbSynced']==0):?>
|
||||
<tr><td></td><td><input type="button" value="History" onclick="openBox('/webGui/include/ParityHistory.php','Parity/Read-Check History',600,540,false)"></td><td>Last checked on <strong><?=my_time(0).day_count(0)?></strong>
|
||||
<br><i class="fa fa-clock-o icon"></i><small>Duration: <?=my_check(0,0)?></small></td></tr>
|
||||
<? elseif ($var['sbSynced2']==0):?>
|
||||
<tr><td></td><td><input type="button" value="History" onclick="openBox('/webGui/include/ParityHistory.php','Parity/Read-Check History',600,540,false)"></td>
|
||||
<? list($entry,$duration,$speed,$status,$error) = explode('|', read_parity_log($var['sbSynced']));
|
||||
<? elseif ($var['sbSynced']==0):
|
||||
list($date,$duration,$speed,$status,$error) = last_parity_log();?>
|
||||
<? if ($status==0):?>
|
||||
<td>Last checked on <strong><?=my_time($date).day_count($date)?></strong>, finding <strong><?=$error?></strong> error<?=$error==1?'':'s'?>.
|
||||
<br><i class="fa fa-clock-o icon"></i><small>Duration: <?=my_check($duration,$speed)?></small></td></tr>
|
||||
<? else:?>
|
||||
<td>Last check incomplete on <strong><?=my_time($date).day_count($date)?></strong>, finding <strong><?=$error?></strong> error<?=$error==1?'':'s'?>.
|
||||
<br><i class="fa fa-dot-circle-o icon"></i><small>Error code: <?=my_error($status)?></small>
|
||||
<? endif;
|
||||
elseif ($var['sbSynced2']==0):
|
||||
list($date,$duration,$speed,$status,$error) = explode('|', read_parity_log($var['sbSynced']));
|
||||
if ($status==0):?>
|
||||
<td>Last checked on <strong><?=my_time($var['sbSynced']).day_count($var['sbSynced'])?></strong>, finding <strong><?=$error?></strong> error<?=$error==1?'':'s'?>.
|
||||
<br><i class="fa fa-clock-o icon"></i><small>Duration: <?=my_check($duration,$speed)?></small>
|
||||
<? else:?>
|
||||
<td>Last check incomplete on <strong><?=my_time($var['sbSynced']).day_count($var['sbSynced'])?></strong>, finding <strong><?=$error?></strong> error<?=$error==1?'':'s'?>.
|
||||
<br><i class="fa fa-dot-circle-o icon"></i><small>Error code: <?=$status?></small>
|
||||
<br><i class="fa fa-dot-circle-o icon"></i><small>Error code: <?=my_error($status)?></small>
|
||||
<? endif;?>
|
||||
</td></tr>
|
||||
<? else:
|
||||
$duration = $var['sbSynced2']-$var['sbSynced'];
|
||||
$speed = $duration?my_scale($var['mdResyncSize']*1024/$duration,$unit,1)." $unit/sec":'';?>
|
||||
<tr><td></td><td><input type="button" value="History" onclick="openBox('/webGui/include/ParityHistory.php','Parity/Read-Check History',600,540,false)"></td>
|
||||
<td>Last check completed on <strong><?=my_time($var['sbSynced2']).day_count($var['sbSynced2'])?></strong>, finding <strong><?=$var['sbSyncErrs']?></strong> error<?=$var['sbSyncErrs']==1?'':'s'?>.
|
||||
<br><i class="fa fa-clock-o icon"></i><small>Duration: <?=my_check($duration,$speed)?></small></td></tr>
|
||||
<? endif;
|
||||
endif;
|
||||
else:
|
||||
if ($var['mdResyncAction']=="check"):?>
|
||||
<tr><td>Read-Check in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stop_parity(this.form,'Read-Check')"></td>
|
||||
<tr><td>Read-Check in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stopParity(this.form,'Read-Check')"></td>
|
||||
<td id="cancelText"><strong>Cancel</strong> will stop the Read-Check.</td></tr>
|
||||
<? elseif (strstr($var['mdResyncAction'],"check")):?>
|
||||
<tr><td>Parity-Check in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stop_parity(this.form,'Parity-Check')"></td>
|
||||
<tr><td>Parity-Check in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stopParity(this.form,'Parity-Check')"></td>
|
||||
<td id="cancelText"><strong>Cancel</strong> will stop the Parity-Check.</td></tr>
|
||||
<? elseif (strstr($var['mdResyncAction'],"recon")):?>
|
||||
<tr><td>Parity-Sync/Data-Rebuild in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stop_parity(this.form,'Parity-Sync/Data-Rebuild')"></td>
|
||||
<tr><td>Parity-Sync/Data-Rebuild in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stopParity(this.form,'Parity-Sync/Data-Rebuild')"></td>
|
||||
<td id="cancelText"><strong>Cancel</strong> will stop Parity-Sync/Data-Rebuild.
|
||||
<br>WARNING: canceling may leave the array unprotected!</td></tr>
|
||||
<? elseif (strstr($var['mdResyncAction'],"clear")):?>
|
||||
<tr><td>Clearing in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stop_parity(this.form,'Clearing')"></td>
|
||||
<tr><td>Clearing in progress.</td><td><input type="button" id="cancelButton" value="Cancel" onclick="stopParity(this.form,'Clearing')"></td>
|
||||
<td id="cancelText"><strong>Cancel</strong> will stop Clearing.</td></tr>
|
||||
<? endif;?>
|
||||
<tr><td>Total size:</td><td id="line0"></td><td></td></tr>
|
||||
@@ -359,7 +363,7 @@ $(function(){
|
||||
<td><strong>Start</strong> will record all disk information and bring the array on-line.
|
||||
<br>The array will be immediately available, but <strong>unprotected</strong> since <em>parity</em> has not been assigned.</td></tr>
|
||||
<? else:?>
|
||||
<tr><td><?=status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" value="Start" onclick="parity_warning(this.form)"></td>
|
||||
<tr><td><?=status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" value="Start" onclick="parityWarning(this.form)"></td>
|
||||
<td><strong>Start</strong> will record all disk information, bring the array on-line, and start Parity-Sync.
|
||||
<br>The array will be immediately available, but <strong>unprotected</strong> until Parity-Sync completes.
|
||||
<br><input type="checkbox" name="md_invalidslot" value="99">Parity is already valid.</td></tr>
|
||||
@@ -454,38 +458,40 @@ $(function(){
|
||||
<form name="otherOps" method="POST" action="/update.htm" target="progressFrame">
|
||||
<input type="hidden" name="startState" value="<?=$var['mdState']?>">
|
||||
<table class="array_status">
|
||||
<tr><td></td><td><input type="submit" name="cmdSpindownAll" value="Spin Down"<?=$parity?' disabled':''?>><input type="submit" name="cmdSpinupAll" value="Spin Up"<?=$parity?' disabled':''?>></td>
|
||||
<td><strong>Spin Down</strong> will immediately spin down all disks.<br><strong>Spin Up</strong> will immediately spin up all disks.</td></tr>
|
||||
<tr><td></td><td><input type="submit" name="clearStatistics" value="Clear Statistics"></td><td><strong>Clear Statistics</strong> will immediately clear all disk statistics.</td></tr>
|
||||
<tr><td></td><td><input type="submit" name="cmdSpindownAll" value="Spin Down"<?=$parity?' disabled':''?>><input type="submit" name="cmdSpinupAll" value="Spin Up"<?=$parity?' disabled':''?>></td>
|
||||
<td><strong>Spin Down</strong> will immediately spin down all disks.<br><strong>Spin Up</strong> will immediately spin up all disks.</td></tr>
|
||||
<tr><td></td><td><input type="submit" name="clearStatistics" value="Clear Statistics"></td><td><strong>Clear Statistics</strong> will immediately clear all disk statistics.</td></tr>
|
||||
<tr><td></td><td class="line" colspan="2"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?if ($var['shareCacheEnabled']=="yes" && is_dir("/mnt/cache")):?>
|
||||
<form name="mover_schedule" method="POST" action="/update.htm" target="progressFrame">
|
||||
<table class="array_status">
|
||||
<tr><td colspan="3"></td></tr><tr><td></td>
|
||||
<tr><td></td>
|
||||
<?if ($mover):?>
|
||||
<td><input type="submit" name="cmdStartMover" value="Move now" disabled></td><td>Mover is running.</td>
|
||||
<td><input type="submit" name="cmdStartMover" value="Move now" disabled></td><td>Disabled - Mover is running.</td>
|
||||
<?else:?>
|
||||
<td><input type="submit" name="cmdStartMover" value="Move now"></td><td>Click to invoke the Mover.</td>
|
||||
<td><input type="submit" name="cmdStartMover" value="Move now"></td><td><strong>Move now</strong> will immediately invoke the Mover.</td>
|
||||
<?endif;?>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?endif;?>
|
||||
<?if ($keyfile):?>
|
||||
<form markdown="1" name="delete_keyfile" method="POST" action="/update.php" target="progressFrame">
|
||||
<form name="delete_keyfile" method="POST" action="/update.php" target="progressFrame">
|
||||
<input type="hidden" name="#file" value="unused">
|
||||
<input type="hidden" name="#include" value="webGui/include/KeyUpload.php">
|
||||
<table class="array_status">
|
||||
<tr><td></td><td><input type="submit" name="#apply" value="Delete" disabled></td><td><input type="checkbox" onchange="toggleApply(this.checked)">Delete encryption keyfile</td></tr>
|
||||
<tr><td></td><td><input type="submit" name="#apply" value="Delete" disabled></td><td><strong>Delete</strong> will delete the encryption keyfile, device encryption remains functional.
|
||||
<br><input type="checkbox" onchange="toggleApply(this.checked)"><small>Yes I want to do this</small></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?endif;?>
|
||||
<?endif;?>
|
||||
<form name="shutdownOps" method="POST" action="/webGui/include/Boot.php">
|
||||
<table class="array_status">
|
||||
<tr><td></td><td><input type="button" name="reboot" value="Reboot" onclick="shut_down(this.form,'reboot')"><input type="button" name="shutdown" value="Power down" onclick="shut_down(this.form,'shutdown')"></td>
|
||||
<td><strong>Reboot</strong> will activate a <em>clean</em> system reset.<br><strong>Power down</strong> will activate a <em>clean</em> power down.</td></tr>
|
||||
<tr><td></td><td><input type="button" name="reboot" value="Reboot" onclick="shutdown(this.form,'reboot')"><input type="button" name="shutdown" value="Power down" onclick="shutdown(this.form,'shutdown')"></td>
|
||||
<td><strong>Reboot</strong> will activate a <em>clean</em> system reset.<br><strong>Power down</strong> will activate a <em>clean</em> power down.</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
@@ -560,13 +566,14 @@ if (isset($display['sleep'])) @include $display['sleep'];
|
||||
> Once you have assigned all of your hard drives, refer to the Array Status section below
|
||||
> and Start the array.
|
||||
|
||||
<?if (($keyfile && $wrong) || $missing || $encrypt):?>
|
||||
<?if (($keyfile && $wrong) || $missing || $encrypt || (!$keyfile && $crypto)):?>
|
||||
<div></div>
|
||||
> #### Encryption input
|
||||
>
|
||||
> Passphrase or file is stored in /root/keyfile.<br>
|
||||
> This keyfile is read during array Start and is used to encrypt/decrypt content of encrypted devices.
|
||||
>
|
||||
> With array Stopped, the keyfile may be deleted and the user can specify a new encryption key. Note that once a device
|
||||
> With array Stopped, the user can specify a new encryption key. Note that once a device
|
||||
> is formatted with a particular key it may only be opened using that same key. Changing the encryption key requires
|
||||
> encrypted devices to be reformatted **resulting in permanent loss of all existing data on those devices.**
|
||||
>
|
||||
|
||||
@@ -39,7 +39,6 @@ function init_row($label) {
|
||||
}
|
||||
function parity_status() {
|
||||
global $var,$disks;
|
||||
|
||||
$parity_num_slots = 0;
|
||||
$parity_disabled = [];
|
||||
$parity_invalid = [];
|
||||
@@ -54,7 +53,6 @@ function parity_status() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($parity_num_slots == count($parity_disabled)) {
|
||||
echo "<tr style='vertical-align:top'><td><span class='red p0'><strong>Parity disk".($parity_num_slots>1?'s':'')." not present</strong></span></td><td id='parity'></td></tr>";
|
||||
return;
|
||||
@@ -71,7 +69,16 @@ function parity_status() {
|
||||
return;
|
||||
}
|
||||
if ($var['sbSynced']==0) {
|
||||
echo "<tr><td><em>Parity has not been checked yet.<em></td><td id='parity'></td></tr>";
|
||||
list($date,$duration,$speed,$status,$error) = last_parity_log();
|
||||
if (!$date) {
|
||||
echo "<tr><td><em>Parity has not been checked yet.<em></td><td id='parity'></td></tr>";
|
||||
} elseif ($status==0) {
|
||||
echo "<tr><td>Last checked on <strong>".my_time($date).day_count($date)."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
|
||||
echo "<br><i class='fa fa-clock-o icon'></i><em>Duration: ".my_check($duration,$speed)."</em></td><td id='parity'></td></tr>";
|
||||
} else {
|
||||
echo "<tr><td>Last check incomplete on <strong>".my_time($date).day_count($date)."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
|
||||
echo "<br><i class='fa fa-dot-circle-o icon'></i><em>Error code: ".my_error($status)."</em></td><td id='parity'></td></tr>";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ($var['sbSynced2']==0) {
|
||||
@@ -82,7 +89,7 @@ function parity_status() {
|
||||
echo "<br><i class='fa fa-clock-o icon'></i><em>".($idle ? "Duration: " : "Last result: ").my_check($duration,$speed)."</em></td><td id='parity'></td></tr>";
|
||||
} else {
|
||||
echo "<tr><td>Last check incomplete on <strong>".my_time($var['sbSynced']).day_count($var['sbSynced'])."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
|
||||
echo "<br><i class='fa fa-dot-circle-o icon'></i><em>Error code: $status</em></td><td id='parity'></td></tr>";
|
||||
echo "<br><i class='fa fa-dot-circle-o icon'></i><em>Error code: ".my_error($status)."</em></td><td id='parity'></td></tr>";
|
||||
}
|
||||
} else {
|
||||
$status = 0;
|
||||
|
||||
@@ -15,16 +15,12 @@ Tag="calendar-check-o"
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$disabled = '';
|
||||
if (empty($disks['cache']) || $disks['cache']['status']=='DISK_NP') {
|
||||
echo "<p class='notice'>No Cache disk present!</p>";
|
||||
$disabled = 'disabled';
|
||||
} elseif ($var['shareCacheEnabled']!='yes') {
|
||||
echo "<p class='notice'>Cache disk not enabled!</p>";
|
||||
$disabled = 'disabled';
|
||||
} elseif ($var['shareUser']=='-') {
|
||||
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));
|
||||
@@ -124,10 +120,12 @@ Mover logging:
|
||||
|
||||
: <input type="submit" name="changeMover" value="Apply"><input type="button" value="Done" onclick="done()">
|
||||
|
||||
<?if ($var['shareCacheEnabled']=="yes" && is_dir("/mnt/cache")):?>
|
||||
|
||||
<?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"<?=$disabled?>> Click to invoke the Mover.
|
||||
: <input type="submit" name="cmdStartMover" value="Move now"> Click to invoke the Mover.
|
||||
<?endif;?>
|
||||
<?endif;?>
|
||||
</form>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
|
||||
@@ -12,12 +12,8 @@
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
function getVal(&$ref,$n,$d) {
|
||||
global $var;
|
||||
$val = $ref[$n] ?? -1;
|
||||
return $val!==-1 ? $val : ($var[$n] ?? $d);
|
||||
}
|
||||
function normalize($type,$count) {
|
||||
$words = explode('_',$type);
|
||||
foreach ($words as &$word) $word = $word==strtoupper($word) ? $word : preg_replace(['/^(ct|cnt)$/','/^blk$/'],['count','block'],strtolower($word));
|
||||
@@ -29,9 +25,9 @@ function my_insert(&$source,$string) {
|
||||
function my_smart(&$source,$name,$page) {
|
||||
global $var,$disks,$path,$failed,$numbers,$saved;
|
||||
$disk = &$disks[$name];
|
||||
$select = getVal($disk,'smSelect',0);
|
||||
$level = getVal($disk,'smLevel',1);
|
||||
$events = explode('|',getVal($disk,'smEvents',$numbers));
|
||||
$select = get_value($disk,'smSelect',0);
|
||||
$level = get_value($disk,'smLevel',1);
|
||||
$events = explode('|',get_value($disk,'smEvents',$numbers));
|
||||
$title = '';
|
||||
$thumb = 'good';
|
||||
$smart = "state/smart/$name";
|
||||
@@ -78,9 +74,8 @@ switch ($_POST['cmd']) {
|
||||
case 'disk':
|
||||
$i = 1;
|
||||
$var = [];
|
||||
$disks = @array_filter(parse_ini_file('state/disks.ini',true),'active_disks');
|
||||
$devs = @parse_ini_file('state/devs.ini',true);
|
||||
$saved = @parse_ini_file('state/monitor.ini',true);
|
||||
$disks = array_filter(parse_ini_file('state/disks.ini',true),'active_disks');
|
||||
$devs = parse_ini_file('state/devs.ini',true);
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
require_once "$docroot/webGui/include/Preselect.php";
|
||||
$slots = $_POST['slots'];
|
||||
@@ -122,9 +117,10 @@ case 'disk':
|
||||
my_insert($row5[$n],"<img src=$path/$state.png>");
|
||||
break;}
|
||||
$temp = $disk['temp'];
|
||||
$hot = $disk['hotTemp'] ?? $_POST['hot'];
|
||||
$max = $disk['maxTemp'] ?? $_POST['max'];
|
||||
$heat = $temp>=$max && $max>0 ? 'max' : ($temp>=$hot && $hot>0 ? 'hot' : '');
|
||||
$hot = $disk['hotTemp'] ?? $_POST['hot'];
|
||||
$max = $disk['maxTemp'] ?? $_POST['max'];
|
||||
$top = $_POST['top'] ?? 120;
|
||||
$heat = exceed($temp,$max,$top) ? 'max' : (exceed($temp,$hot,$top) ? 'hot' : '');
|
||||
if ($heat)
|
||||
my_insert($row6[$n],"<span class='heat-img'><img src='$path/$heat.png'></span><span class='heat-text' style='display:none'>".my_temp($temp,$_POST['unit'])."</span>");
|
||||
else
|
||||
@@ -136,13 +132,14 @@ case 'disk':
|
||||
$devRow = function($n,$disk) use (&$row4,&$row6,&$row7,$path) {
|
||||
$hot = $_POST['hot'];
|
||||
$max = $_POST['max'];
|
||||
$top = $_POST['top'] ?? 120;
|
||||
$name = $dev['device'];
|
||||
$port = substr($name,-2)!='n1' ? $name : substr($name,0,-2);
|
||||
$smart = "state/smart/$name";
|
||||
$state = exec("hdparm -C ".escapeshellarg("/dev/$port")."|grep -Po 'active|unknown'") ? 'blue-on' : 'blue-blink';
|
||||
if ($state=='blue-on') my_smart($row7[$n],$name,'New');
|
||||
$temp = file_exists($smart) ? exec("awk 'BEGIN{t=\"*\"} \$1==190||\$1==194{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit} END{print t}' ".escapeshellarg($smart)) : '*';
|
||||
$heat = $temp>=$max && $max>0 ? 'max' : ($temp>=$hot && $hot>0 ? 'hot' : '');
|
||||
$heat = exceed($temp,$max,$top) ? 'max' : (exceed($temp,$hot,$top) ? 'hot' : '');
|
||||
if ($heat)
|
||||
my_insert($row6[$n],"<span class='heat-img'><img src='$path/$heat.png'></span><span class='heat-text' style='display:none'>".my_temp($temp,$_POST['unit'])."</span>");
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
$dynamix = parse_plugin_cfg('dynamix',true);
|
||||
|
||||
@@ -27,7 +27,7 @@ require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
function in_parity_log($log,$timestamp) {
|
||||
if (file_exists($log)) {
|
||||
$handle = fopen($log, 'r');
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
while (($line = fgets($handle))!==false) {
|
||||
if (strpos($line,$timestamp)!==false) break;
|
||||
}
|
||||
fclose($handle);
|
||||
@@ -35,7 +35,7 @@ function in_parity_log($log,$timestamp) {
|
||||
return !empty($line);
|
||||
}
|
||||
function device_info(&$disk,$online) {
|
||||
global $path, $var, $show;
|
||||
global $path, $var, $crypto;
|
||||
$name = $disk['name'];
|
||||
$fancyname = $disk['type']=='New' ? $name : my_disk($name);
|
||||
$type = $disk['type']=='Flash' || $disk['type']=='New' ? $disk['type'] : 'Device';
|
||||
@@ -58,12 +58,12 @@ function device_info(&$disk,$online) {
|
||||
}
|
||||
$status = "$ctrl<a class='info nohand' onclick='return false'><img src='/webGui/images/{$disk['color']}.png' class='icon'><span>$help</span></a>";
|
||||
$link = (strcmp($disk['status'], 'DISK_NP')!=0 || $disk['name']=="cache") ? "<a href=\"".htmlspecialchars("$path/$type?name=$name")."\">".$fancyname."</a>" : $fancyname;
|
||||
if ($show && $online) switch ($disk['luksState']) {
|
||||
if ($crypto && $online) switch ($disk['luksState']) {
|
||||
case 0: $luks = "<i class='nolock fa fa-lock'></i>"; break;
|
||||
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>Encrypted and unlocked</span></a>"; break;
|
||||
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Locked: missing encryption key</span></a>"; break;
|
||||
case 3: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Locked: wrong encryption key</span></a>"; break;
|
||||
default: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Locked: unknown error</span></a>"; break;
|
||||
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>Device encrypted and unlocked</span></a>"; break;
|
||||
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Device locked: missing encryption key</span></a>"; break;
|
||||
case 3: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Device locked: wrong encryption key</span></a>"; break;
|
||||
default: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Device locked: unknown error</span></a>"; break;
|
||||
} else $luks = '';
|
||||
return $status.$luks.$link;
|
||||
}
|
||||
@@ -90,19 +90,22 @@ function assignment(&$disk) {
|
||||
$out .= "<option value=''>$empty</option>";
|
||||
} else
|
||||
$out .= "<option value='' selected>$empty</option>";
|
||||
if ($disk['type']=="Cache")
|
||||
if ($disk['type']=='Cache')
|
||||
foreach ($devs as $dev) {$out .= "<option value=\"{$dev['id']}\">".device_desc($dev)."</option>";}
|
||||
else
|
||||
foreach ($devs as $dev) if ($dev['tag']==0) {$out .= "<option value=\"{$dev['id']}\">".device_desc($dev)."</option>";}
|
||||
return "$out</select></form>";
|
||||
}
|
||||
function str_strip($fs) {
|
||||
return str_replace('luks:','',$fs);
|
||||
}
|
||||
function fs_info(&$disk) {
|
||||
global $display;
|
||||
if ($disk['fsStatus']=='-') {
|
||||
echo $disk['type']=='Cache' ? "<td>".str_replace('luks:','',$disk['fsType'])."</td><td colspan='3'>Device is part of cache pool</td><td></td>" : "<td colspan='5'></td>";
|
||||
echo $disk['type']=='Cache' ? "<td>".str_strip($disk['fsType'])."</td><td colspan='3'>Device is part of cache pool</td><td></td>" : "<td colspan='5'></td>";
|
||||
return;
|
||||
} elseif ($disk['fsStatus']=='Mounted') {
|
||||
echo "<td>".str_replace('luks:','',$disk['fsType'])."</td>";
|
||||
echo "<td>".str_strip($disk['fsType'])."</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>";
|
||||
@@ -118,27 +121,31 @@ function fs_info(&$disk) {
|
||||
}
|
||||
echo "<td>".device_browse($disk)."</td>";
|
||||
} else
|
||||
echo "<td>".str_replace('luks:','',$disk['fsType'])."</td><td colspan='4' style='text-align:center'>{$disk['fsStatus']}";
|
||||
echo "<td>".str_strip($disk['fsType'])."</td><td colspan='4' style='text-align:center'>{$disk['fsStatus']}";
|
||||
}
|
||||
function my_diskio($data) {
|
||||
return my_scale($data,$unit,1)." $unit/s";
|
||||
}
|
||||
function parity_only($disk) {
|
||||
return $disk['type']=='Parity';
|
||||
}
|
||||
function data_only($disk) {
|
||||
return $disk['type']=='Data';
|
||||
}
|
||||
function cache_only($disk) {
|
||||
return $disk['type']=='Cache';
|
||||
}
|
||||
function array_offline(&$disk) {
|
||||
global $var, $disks;
|
||||
if (strpos($var['mdState'],"ERROR:")===false) {
|
||||
$w = '<span class="red-text"><em>All existing data on this device will be OVERWRITTEN when array is Started</em></span>';
|
||||
if ($disk['type']=="Cache") {
|
||||
if (!empty($disks['cache']['uuid']) && $disk['status']=="DISK_NEW") $warning = $w;
|
||||
}
|
||||
else {
|
||||
if ($var['mdState']=="NEW_ARRAY") {
|
||||
if ($disk['type']=="Parity") $warning = $w;
|
||||
}
|
||||
else {
|
||||
if ($disk['status']=="DISK_INVALID" ||
|
||||
$disk['status']=="DISK_DSBL_NEW" ||
|
||||
$disk['status']=="DISK_WRONG" ||
|
||||
$disk['status']=="DISK_NEW") $warning = $w;
|
||||
if (strpos($var['mdState'],'ERROR:')===false) {
|
||||
$text = '<span class="red-text"><em>All existing data on this device will be OVERWRITTEN when array is Started</em></span>';
|
||||
if ($disk['type']=='Cache') {
|
||||
if (!empty($disks['cache']['uuid']) && $disk['status']=='DISK_NEW') $warning = $text;
|
||||
} else {
|
||||
if ($var['mdState']=='NEW_ARRAY') {
|
||||
if ($disk['type']=='Parity') $warning = $text;
|
||||
} else {
|
||||
if (in_array($disk['status'],['DISK_INVALID','DISK_DSBL_NEW','DISK_WRONG','DISK_NEW'])) $warning = $text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +238,7 @@ function my_clock($time) {
|
||||
}
|
||||
function read_disk($name, $part) {
|
||||
global $var;
|
||||
$port = substr($name,-2)!='n1' ? $name : substr($name,0,-2);
|
||||
$port = port_name($name);
|
||||
switch ($part) {
|
||||
case 'color':
|
||||
return exec("hdparm -C ".escapeshellarg("/dev/$port")."|grep -Po 'active|unknown'") ? 'blue-on' : 'blue-blink';
|
||||
@@ -302,24 +309,26 @@ function cache_slots() {
|
||||
$out .= "</select></form>";
|
||||
return $out;
|
||||
}
|
||||
$show = false;
|
||||
$crypto = false;
|
||||
switch ($_POST['device']) {
|
||||
case 'array':
|
||||
foreach ($disks as $disk) if ($disk['type']=='Data') $show |= strpos($disk['fsType'],'luks:')!==false;
|
||||
$parity = array_filter($disks,'parity_only');
|
||||
$data = array_filter($disks,'data_only');
|
||||
foreach ($data as $disk) $crypto |= strpos($disk['fsType'],'luks:')!==false;
|
||||
if ($var['fsState']=='Stopped') {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Parity') array_offline($disk);}
|
||||
foreach ($parity as $disk) array_offline($disk);
|
||||
echo "<tr class='tr_last'><td style='height:12px' colspan='11'></td></tr>";
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Data') array_offline($disk);}
|
||||
foreach ($data as $disk) array_offline($disk);
|
||||
echo "<tr class='tr_last'><td><img src='/webGui/images/sum.png' class='icon'>Slots:</td><td colspan='9'>".array_slots()."</td><td></td></tr>";
|
||||
} else {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Parity' && $disk['status']!='DISK_NP_DSBL') array_online($disk);}
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Data') array_online($disk);}
|
||||
foreach ($parity as $disk) if ($disk['status']!='DISK_NP_DSBL') array_online($disk);
|
||||
foreach ($data as $disk) array_online($disk);
|
||||
if ($display['total']) show_totals('Array of '.my_word($var['mdNumDisks']).' devices');
|
||||
}
|
||||
break;
|
||||
case 'flash':
|
||||
$disk = &$disks['flash'];
|
||||
$data = $diskio ? explode(' ',$diskio[$disk['device']]) : [];
|
||||
$data = explode(' ',$diskio[$disk['device']] ?? '');
|
||||
$disk['fsUsed'] = $disk['fsSize']-$disk['fsFree'];
|
||||
echo "<tr>";
|
||||
echo "<td>".device_info($disk,true)."</td>";
|
||||
@@ -332,19 +341,20 @@ case 'flash':
|
||||
echo "</tr>";
|
||||
break;
|
||||
case 'cache':
|
||||
foreach ($disks as $disk) if ($disk['type']=='Cache') $show |= strpos($disk['fsType'],'luks:')!==false;
|
||||
$cache = array_filter($disks,'cache_only');
|
||||
foreach ($cache as $disk) $crypto |= strpos($disk['fsType'],'luks:')!==false;
|
||||
if ($var['fsState']=='Stopped') {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Cache') array_offline($disk);}
|
||||
foreach ($cache as $disk) array_offline($disk);
|
||||
echo "<tr class='tr_last'><td><img src='/webGui/images/sum.png' class='icon'>Slots:</td><td colspan='9'>".cache_slots()."</td><td></td></tr>";
|
||||
} else {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Cache') array_online($disk);}
|
||||
foreach ($cache as $disk) array_online($disk);
|
||||
if ($display['total'] && $var['cacheSbNumDisks']>1) show_totals('Pool of '.my_word($var['cacheNumDevices']).' devices');
|
||||
}
|
||||
break;
|
||||
case 'open':
|
||||
foreach ($devs as $disk) {
|
||||
$dev = $disk['device'];
|
||||
$data = $diskio ? explode(' ',$diskio[$dev]) : [];
|
||||
$data = explode(' ',$diskio[$dev] ?? '');
|
||||
$disk['name'] = $dev;
|
||||
$disk['type'] = 'New';
|
||||
$disk['color'] = read_disk($dev,'color');
|
||||
|
||||
@@ -46,11 +46,17 @@ function shareInclude($name) {
|
||||
return !$include || substr($name,0,4)!='disk' || strpos("$include,", "$name,")!==false;
|
||||
}
|
||||
|
||||
function sharesOnly($disk) {
|
||||
return strpos('Data,Cache',$disk['type'])!==false && $disk['exportable']=='yes';
|
||||
}
|
||||
// filter disk shares
|
||||
$disks = array_filter($disks,'sharesOnly');
|
||||
|
||||
// Compute all disk shares & check encryption
|
||||
$show = false;
|
||||
$crypto = false;
|
||||
foreach ($disks as $name => $disk) {
|
||||
if ($compute=='yes' && $disk['exportable']=='yes') exec("webGui/scripts/disk_size ".escapeshellarg($name)." ssz2");
|
||||
if (strstr('Data,Cache',$disk['type'])) $show |= strpos($disk['fsType'],'luks:')!==false;
|
||||
if ($compute=='yes') exec("webGui/scripts/disk_size ".escapeshellarg($name)." ssz2");
|
||||
$crypto |= strpos($disk['fsType'],'luks:')!==false;
|
||||
}
|
||||
|
||||
// global shares include/exclude
|
||||
@@ -66,14 +72,14 @@ else
|
||||
// Build table
|
||||
$row = 0;
|
||||
foreach ($disks as $name => $disk) {
|
||||
if (!strstr('Data,Cache',$disk['type']) || $disk['fsColor']=='grey-off' || $disk['exportable']=='no') continue;
|
||||
$color = $disk['fsColor'];
|
||||
$row++;
|
||||
$ball = "/webGui/images/{$disk['fsColor']}.png";
|
||||
switch ($disk['fsColor']) {
|
||||
$ball = "/webGui/images/$color.png";
|
||||
switch ($color) {
|
||||
case 'green-on': $help = 'All files protected'; break;
|
||||
case 'yellow-on': $help = 'All files unprotected'; break;
|
||||
}
|
||||
if ($show) switch ($disk['luksState']) {
|
||||
if ($crypto) switch ($disk['luksState']) {
|
||||
case 0: $luks = "<i class='nolock fa fa-lock'></i>"; break;
|
||||
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>All files encrypted</span></a>"; break;
|
||||
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>Some or all files unencrypted</span></a>"; break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
|
||||
@@ -112,7 +112,7 @@ function my_check($time, $speed) {
|
||||
function my_error($code) {
|
||||
switch ($code) {
|
||||
case -4:
|
||||
return "<em>user abort</em>";
|
||||
return "<em>aborted</em>";
|
||||
default:
|
||||
return "<strong>$code</strong>";
|
||||
}
|
||||
@@ -176,6 +176,13 @@ function read_parity_log($epoch, $busy=false) {
|
||||
}
|
||||
return $line ?: $last ?: '0|0|0|0|0';
|
||||
}
|
||||
function last_parity_log() {
|
||||
$log = '/boot/config/parity-checks.log';
|
||||
if (!file_exists($log)) return [0,0,0,0,0];
|
||||
list($date,$duration,$speed,$status,$error) = explode('|',exec("tail -1 $log"));
|
||||
list($y,$m,$d,$t) = preg_split('/ +/',$date);
|
||||
return [strtotime("$d-$m-$y $t"), $duration, $speed, $status, $error];
|
||||
}
|
||||
function urlencode_path($path) {
|
||||
return str_replace("%2F", "/", urlencode($path));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
function addLog($line) { echo "<script>addLog('$line');</script>"; }
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Markdown Extra - A text-to-HTML conversion tool for web writers
|
||||
#
|
||||
# LimeTech - Give all blockquotes class="inline_help".
|
||||
# Copyright 2005-2016, Lime Technology
|
||||
# Copyright 2005-2017, Lime Technology
|
||||
# <http://lime-technology.com/>
|
||||
#
|
||||
# PHP Markdown & Extra
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2012-2017, Bergware International.
|
||||
* Copyright 2012, Andrew Hamer-Adams, http://www.pixeleyes.co.nz.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$notify = "$docroot/webGui/scripts/notify";
|
||||
|
||||
switch ($_POST['cmd']) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2015-2016, Bergware International
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2015-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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2015-2016, Bergware International
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2015-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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
function PsExecute($command, $timeout = 20, $sleep = 2) {
|
||||
exec($command.'>/dev/null & echo $!',$op);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
|
||||
@@ -54,10 +54,10 @@ function shareInclude($name) {
|
||||
}
|
||||
|
||||
// Compute all user shares & check encryption
|
||||
$show = false;
|
||||
$crypto = false;
|
||||
foreach ($shares as $name => $share) {
|
||||
if ($compute=='yes') exec("webGui/scripts/share_size ".escapeshellarg($name)." ssz1");
|
||||
$show |= $share['luksStatus']>0;
|
||||
$crypto |= $share['luksStatus']>0;
|
||||
}
|
||||
|
||||
// global shares include/exclude
|
||||
@@ -74,12 +74,13 @@ else
|
||||
$row = 0;
|
||||
foreach ($shares as $name => $share) {
|
||||
$row++;
|
||||
$ball = "/webGui/images/{$share['color']}.png";
|
||||
switch ($share['color']) {
|
||||
$color = $share['color'];
|
||||
$ball = "/webGui/images/$color.png";
|
||||
switch ($color) {
|
||||
case 'green-on': $help = 'All files protected'; break;
|
||||
case 'yellow-on': $help = 'Some or all files unprotected'; break;
|
||||
}
|
||||
if ($show) switch ($share['luksStatus']) {
|
||||
if ($crypto) switch ($share['luksStatus']) {
|
||||
case 0: $luks = "<i class='nolock fa fa-lock'></i>"; break;
|
||||
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>All files encrypted</span></a>"; break;
|
||||
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>Some or all files unencrypted</span></a>"; break;
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$disks = []; $var = [];
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Preselect.php";
|
||||
|
||||
function normalize($text, $glue='_') {
|
||||
$words = explode($glue,$text);
|
||||
@@ -35,10 +39,6 @@ function spindownDelay($port) {
|
||||
function append(&$ref, &$info) {
|
||||
if ($info) $ref .= ($ref ? " " : "").$info;
|
||||
}
|
||||
$disks = []; $var = [];
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Preselect.php";
|
||||
$name = $_POST['name'] ?? '';
|
||||
$port = $_POST['port'] ?? '';
|
||||
if ($name) {
|
||||
@@ -58,6 +58,7 @@ case "attributes":
|
||||
$unraid = parse_plugin_cfg('dynamix',true);
|
||||
$max = $disk['maxTemp'] ?? $unraid['display']['max'];
|
||||
$hot = $disk['hotTemp'] ?? $unraid['display']['hot'];
|
||||
$top = $_POST['top'] ?? 120;
|
||||
exec("smartctl -A $type ".escapeshellarg("/dev/$port")."|awk 'NR>4'",$output);
|
||||
if (strpos($output[0], 'SMART Attributes Data Structure')===0) {
|
||||
$output = array_slice($output, 3);
|
||||
@@ -69,7 +70,7 @@ case "attributes":
|
||||
$highlight = strpos($info[8],'FAILING_NOW')!==false || ($select ? $info[5]>0 && $info[3]<=$info[5]*$level : $info[9]>0);
|
||||
if (in_array($info[0], $events) && $highlight) $color = " class='warn'";
|
||||
elseif (in_array($info[0], [190,194])) {
|
||||
if ($info[9]>=$max && $max>0) $color = " class='alert'"; elseif ($info[9]>=$hot && $hot>0) $color = " class='warn'";
|
||||
if (exceed($info[9],$max,$top)) $color = " class='alert'"; elseif (exceed($info[9],$hot,$top)) $color = " class='warn'";
|
||||
}
|
||||
if ($info[8]=='-') $info[8] = 'Never';
|
||||
if ($info[0]==9 && is_numeric($info[9])) duration($info[9]);
|
||||
@@ -88,7 +89,7 @@ case "attributes":
|
||||
switch ($name) {
|
||||
case 'Temperature':
|
||||
$temp = strtok($value,' ');
|
||||
if ($temp>=$max && $max>0) $color = " class='alert'"; elseif ($temp>=$hot && $hot>0) $color = " class='warn'";
|
||||
if (exceed($temp,$max)) $color = " class='alert'"; elseif (exceed($temp,$hot)) $color = " class='warn'";
|
||||
break;
|
||||
case 'Power on hours':
|
||||
if (is_numeric($value)) duration($value);
|
||||
|
||||
@@ -21,13 +21,11 @@ function parse_plugin_cfg($plugin, $sections=false) {
|
||||
$cfg = file_exists($ram) ? parse_ini_file($ram, $sections) : [];
|
||||
return file_exists($rom) ? array_replace_recursive($cfg, parse_ini_file($rom, $sections)) : $cfg;
|
||||
}
|
||||
|
||||
function parse_cron_cfg($plugin, $job, $text = "") {
|
||||
$cron = "/boot/config/plugins/$plugin/$job.cron";
|
||||
if ($text) file_put_contents($cron, $text); else @unlink($cron);
|
||||
exec("/usr/local/sbin/update_cron");
|
||||
}
|
||||
|
||||
function agent_fullname($agent, $state) {
|
||||
switch ($state) {
|
||||
case 'enabled' : return "/boot/config/plugins/dynamix/notifications/agents/$agent";
|
||||
@@ -35,13 +33,11 @@ function agent_fullname($agent, $state) {
|
||||
default : return $agent;
|
||||
}
|
||||
}
|
||||
|
||||
function get_plugin_attr($attr, $file) {
|
||||
global $docroot;
|
||||
exec("$docroot/plugins/dynamix.plugin.manager/scripts/plugin ".escapeshellarg($attr)." ".escapeshellarg($file), $result, $error);
|
||||
if ($error===0) return $result[0];
|
||||
}
|
||||
|
||||
function plugin_update_available($plugin, $os=false) {
|
||||
$local = get_plugin_attr('version', "/var/log/plugins/$plugin.plg");
|
||||
$remote = get_plugin_attr('version', "/tmp/plugins/$plugin.plg");
|
||||
@@ -52,13 +48,11 @@ function plugin_update_available($plugin, $os=false) {
|
||||
if (version_compare($server, $unraid, '>=')) return $remote;
|
||||
}
|
||||
}
|
||||
|
||||
function get_value(&$object,$name,$default) {
|
||||
function get_value(&$object, $name, $default) {
|
||||
global $var;
|
||||
$value = $object[$name] ?? -1;
|
||||
return $value!==-1 ? $value : ($var[$name] ?? $default);
|
||||
}
|
||||
|
||||
function get_ctlr_options(&$type, &$disk) {
|
||||
if (!$type) return;
|
||||
$ports = [];
|
||||
@@ -70,4 +64,7 @@ function get_ctlr_options(&$type, &$disk) {
|
||||
function port_name($port) {
|
||||
return substr($port,-2)!='n1' ? $port : substr($port,0,-2);
|
||||
}
|
||||
function exceed($value, $limit, $top=100) {
|
||||
return ($value>$limit && $limit>0 && $value<=$top);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
$memory = '/tmp/memory.tmp';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Encryption.php";
|
||||
|
||||
$_POST['AuthPass'] = base64_encrypt($_POST['AuthPass']);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -14,7 +14,7 @@
|
||||
<?
|
||||
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";
|
||||
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/ColorCoding.php";
|
||||
|
||||
$ata = exec("ls -n ".escapeshellarg("/sys/block/{$argv[1]}")."|grep -Po 'ata\d+'");
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/publish.php";
|
||||
curl_socket("/var/run/emhttpd.socket", "http://localhost/status.htm");
|
||||
?>
|
||||
|
||||
@@ -30,6 +30,7 @@ $high1 = $unraid['display']['critical'];
|
||||
$high2 = $unraid['display']['warning'];
|
||||
$server = strtoupper($var['NAME']);
|
||||
$errors = [];
|
||||
$top = 120;
|
||||
|
||||
function plus($val,$word,$last) {
|
||||
return $val>0 ? (($val||$last) ? ($val.' '.$word.($val!=1?'s':'').($last ?'':', ')) : '') : '';
|
||||
@@ -90,11 +91,11 @@ function read_write_parity_log($epoch,$duration,$speed,$status,$error) {
|
||||
return str_replace("\n","",$line);
|
||||
}
|
||||
function check_temp($name,$temp,$text,$info) {
|
||||
global $notify,$disks,$saved,$unraid,$server;
|
||||
global $notify,$disks,$saved,$unraid,$server,$top;
|
||||
$disk = &$disks[$name];
|
||||
$hot = $disk['hotTemp'] ?? $unraid['display']['hot'];
|
||||
$max = $disk['maxTemp'] ?? $unraid['display']['max'];
|
||||
$warn = $temp>=$max && $max>0 ? 'alert' : ($temp>=$hot && $hot>0 ? 'warning' : '');
|
||||
$warn = exceed($temp,$max,$top) ? 'alert' : (exceed($temp,$hot,$top) ? 'warning' : '');
|
||||
$item = 'temp';
|
||||
$last = $saved[$item][$name] ?? 0;
|
||||
if ($warn) {
|
||||
@@ -103,7 +104,7 @@ function check_temp($name,$temp,$text,$info) {
|
||||
$saved[$item][$name] = $max>0 && $temp<=$max ? $max : $temp;
|
||||
}
|
||||
} else {
|
||||
if ($last) {
|
||||
if ($last && $temp<=$top) {
|
||||
exec("$notify -e ".escapeshellarg("unRAID $text message")." -s ".escapeshellarg("Notice [$server] - $text returned to normal temperature")." -d ".escapeshellarg("$info"));
|
||||
unset($saved[$item][$name]);
|
||||
}
|
||||
@@ -171,9 +172,9 @@ function check_usage($name,$used,$text,$info) {
|
||||
global $notify,$disks,$saved,$unraid,$server;
|
||||
if ($used == -1) return;
|
||||
$disk = &$disks[$name];
|
||||
$warning = $disk['warning'] ?? $unraid['display']['warning'];
|
||||
$warning = $disk['warning'] ?? $unraid['display']['warning'];
|
||||
$critical = $disk['critical'] ?? $unraid['display']['critical'];
|
||||
$warn = $used>=$critical && $critical>0 ? 'alert' : ($used>=$warning && $warning>0 ? 'warning' : '');
|
||||
$warn = exceed($used,$critical) ? 'alert' : (exceed($used,$warning) ? 'warning' : '');
|
||||
$item = 'used';
|
||||
$last = $saved[$item][$name] ?? 0;
|
||||
if ($warn) {
|
||||
@@ -182,7 +183,7 @@ function check_usage($name,$used,$text,$info) {
|
||||
$saved[$item][$name] = $critical>0 && $used<=$critical ? $critical : $used;
|
||||
}
|
||||
} else {
|
||||
if ($last) {
|
||||
if ($last && $used<=100) {
|
||||
exec("$notify -e ".escapeshellarg("unRAID $text message")." -s ".escapeshellarg("Notice [$server] - $text returned to normal utilization level")." -d ".escapeshellarg("$info"));
|
||||
unset($saved[$item][$name]);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Encryption.php";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -12,10 +12,10 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$disks = parse_ini_file("/var/local/emhttp/disks.ini",true);
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$disks = parse_ini_file("/var/local/emhttp/disks.ini",true);
|
||||
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* 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,
|
||||
@@ -14,7 +14,7 @@
|
||||
<?
|
||||
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";
|
||||
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$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');
|
||||
|
||||
@@ -138,7 +138,7 @@ table.disk_status tr td:last-child{width:4%;padding-right:10px}
|
||||
table.disk_status tbody tr{border-bottom:#F3F0F4 1px solid;line-height:30px}
|
||||
table.disk_status.stats tr>td+td{text-align:left;padding-left:0;padding-right:12px}
|
||||
table.array_status{line-height:30px}
|
||||
table.array_status td{padding:12px 0}
|
||||
table.array_status td{padding:4px 0}
|
||||
table.array_status td:first-child{text-transform:uppercase}
|
||||
table.array_status tr>td{text-align:left;white-space:nowrap;padding-left:12px;width:30%}
|
||||
table.array_status tr>td+td{padding-left:2px;width:20%}
|
||||
|
||||
@@ -138,7 +138,7 @@ table.disk_status tr td:last-child{width:4%;padding-right:10px}
|
||||
table.disk_status tbody tr{border-bottom:#0C0F0B 1px solid;line-height:30px}
|
||||
table.disk_status.stats tr>td+td{text-align:left;padding-left:0;padding-right:12px}
|
||||
table.array_status{line-height:30px}
|
||||
table.array_status td{padding:12px 0}
|
||||
table.array_status td{padding:4px 0}
|
||||
table.array_status td:first-child{text-transform:uppercase}
|
||||
table.array_status tr>td{text-align:left;white-space:nowrap;padding-left:12px;width:30%}
|
||||
table.array_status tr>td+td{padding-left:2px;width:20%}
|
||||
|
||||
Reference in New Issue
Block a user