Merge pull request #79 from bergware/master

Miscellaneous updates
This commit is contained in:
Eric Schultz
2016-10-29 16:52:16 -05:00
committed by GitHub
27 changed files with 133 additions and 112 deletions

View File

@@ -150,7 +150,7 @@ img.stopped{opacity:0.3;}
$updateStatus = $info[$ct['Name']]['updated'];
if ($updateStatus == "false") {
echo "<a class=\"exec\" onclick=\"updateContainer('" . addslashes($ct["Name"]) . "');\"><span style=\"white-space:nowrap;\"><i class=\"fa fa-cloud-download\"></i> update ready</span></a>";
} else if ($updateStatus == "true") {
} elseif ($updateStatus == "true") {
echo "<span style=\"color:#44B012;white-space:nowrap;\"><i class=\"fa fa-check\"></i> up-to-date</span>";
echo "<div class=\"advanced\"><a class=\"exec\" onclick=\"updateContainer('" . addslashes($ct["Name"]) . "');\" style=\"color:#888;\"><span style=\"white-space:nowrap;\"><i class=\"fa fa-cloud-download\"></i> force update</span></a></div>";
} else {

View File

@@ -224,12 +224,12 @@ function postToXML($post, $setOwnership = false) {
$port->HostPort = $post['confValue'][$i];
$port->ContainerPort = $post['confTarget'][$i];
$port->Protocol = $post['confMode'][$i];
} else if ($Type == "Path") {
} elseif ($Type == "Path") {
$path = $xml->Data->addChild("Volume");
$path->HostDir = $post['confValue'][$i];
$path->ContainerDir = $post['confTarget'][$i];
$path->Mode = $post['confMode'][$i];
} else if ($Type == "Variable") {
} elseif ($Type == "Variable") {
$variable = $xml->Environment->addChild("Variable");
$variable->Value = $post['confValue'][$i];
$variable->Name = $post['confTarget'][$i];

View File

@@ -80,9 +80,9 @@ class DockerTemplates {
if ($type == "all") {
$dirs[] = $dockerManPaths['templates-user'];
$dirs[] = $dockerManPaths['templates-storage'];
} else if ($type == "user") {
} elseif ($type == "user") {
$dirs[] = $dockerManPaths['templates-user'];
} else if ($type == "default") {
} elseif ($type == "default") {
$dirs[] = $dockerManPaths['templates-storage'];
} else {
$dirs[] = $type;
@@ -102,7 +102,7 @@ class DockerTemplates {
$this->removeDir(realpath($path) . '/' . $file);
}
return rmdir($path);
} else if (is_file($path)) {
} elseif (is_file($path)) {
return unlink($path);
}
return false;
@@ -526,20 +526,20 @@ class DockerUpdate{
$changed = false;
$DockerTemplates = new DockerTemplates();
$validElements = [
"Support",
"Overview",
"Category",
"WebUI",
"Icon"
0 => "Support",
1 => "Overview",
2 => "Category",
3 => "WebUI",
4 => "Icon"
];
$validAttributes = [
"Name",
"Default",
"Description",
"Display",
"Required",
"Mask"
0 => "Name",
1 => "Default",
2 => "Description",
3 => "Display",
4 => "Required",
5 => "Mask"
];
// Get user template file and abort if fail
@@ -575,12 +575,12 @@ class DockerUpdate{
$value = $this->xml_decode($local_element);
// Values changed, updating.
if ($value != $rvalue) {
$local_element[0] = $this->xml_encode($rvalue);
$local_element->{0} = $this->xml_encode($rvalue);
$this->debug("Updating $name from [$value] to [$rvalue]");
$changed = true;
}
// Compare atributes on Config if they are in the validAttributes list
} else if ($name == "Config") {
} elseif ($name == "Config") {
$type = $this->xml_decode($remote_element['Type']);
$target = $this->xml_decode($remote_element['Target']);
if ($type == "Port") {
@@ -618,8 +618,6 @@ class DockerUpdate{
$dom->formatOutput = true;
$dom->loadXML($template->asXML());
file_put_contents($file, $dom->saveXML());
} else {
$this->debug("Template is up to date.");
}
}
}
@@ -941,7 +939,7 @@ class DockerClient {
$c["ParentId"] = substr(str_replace('sha256:', '', $obj['ParentId']), 0, 12);
$c["Size"] = $this->formatBytes($obj['Size']);
$c["VirtualSize"] = $this->formatBytes($obj['VirtualSize']);
$c["Tags"] = array_map("htmlentities", $obj['RepoTags']);
$c["Tags"] = isset($obj['RepoTags']) ? array_map("htmlentities", $obj['RepoTags']) : array();
$c["Repository"] = vsprintf('%1$s/%2$s', preg_split("#[:\/]#", DockerUtil::ensureImageTag($obj['RepoTags'][0])));
$c["usedBy"] = $this->usedBy($c["Id"]);
@@ -969,7 +967,7 @@ class DockerUtil {
if (strpos($strRepo, 'sha256:') === 0) {
// sha256 was provided instead of actual repo name so truncate it for display:
$strRepo = substr(str_replace('sha256:', '', $strRepo), 0, 12);
} else if (strpos($strRepo, '/') === false) {
} elseif (strpos($strRepo, '/') === false) {
// Prefix library/ if there's no author (maybe a Docker offical image?)
$strRepo = 'library/'.$strRepo;
}

View File

@@ -245,7 +245,7 @@ function plugin($method, $plugin_file, &$error) {
// skip if not our $method
if (isset($file->attributes()->Method)) {
if (!in_array($method, explode(" ", $file->attributes()->Method))) continue;
} else if ($method != "install") continue;
} elseif ($method != "install") continue;
$name = $file->attributes()->Name;
// bergware - check unRAID version dependency (if present)
$min = $file->attributes()->Min;

View File

@@ -196,7 +196,7 @@ if ($action) {
if (!empty($vmtemplateicon)) {
if (file_exists($vmtemplateicon)) {
$vmicon = $vmtemplateicon;
} else if (file_exists("$docroot/plugins/dynamix.vm.manager/templates/images/".$vmtemplateicon)) {
} elseif (file_exists("$docroot/plugins/dynamix.vm.manager/templates/images/".$vmtemplateicon)) {
$vmicon = "/plugins/dynamix.vm.manager/templates/images/".$vmtemplateicon;
}
}

View File

@@ -293,7 +293,7 @@ switch ($action) {
$arrResponse['dirty-flag'] = $json_info['dirty-flag'];
$arrResponse['resizable'] = true;
}
} else if (is_block($file)) {
} elseif (is_block($file)) {
$strDevSize = trim(shell_exec("blockdev --getsize64 " . escapeshellarg($file)));
if (!empty($strDevSize) && is_numeric($strDevSize)) {
$arrResponse['actual-size'] = (int)$strDevSize;
@@ -459,9 +459,9 @@ switch ($action) {
if (empty($arrDownloadVirtIO)) {
$arrResponse = ['error' => 'Unknown version: ' . $_POST['download_version']];
} else if (empty($_POST['download_path'])) {
} elseif (empty($_POST['download_path'])) {
$arrResponse = ['error' => 'Specify a ISO storage path first'];
} else if (!is_dir($_POST['download_path'])) {
} elseif (!is_dir($_POST['download_path'])) {
$arrResponse = ['error' => 'ISO storage path doesn\'t exist, please create the user share (or empty folder) first'];
} else {
@mkdir($_POST['download_path'], 0777, true);
@@ -539,12 +539,12 @@ switch ($action) {
$arrResponse['status'] = 'Downloading ... ' . $strPercent . '%';
} else if (pgrep($strVerifyPgrep)) {
} elseif (pgrep($strVerifyPgrep)) {
// Status = running md5 check
$arrResponse['status'] = 'Verifying ... ';
} else if (file_exists($strMD5StatusFile)) {
} elseif (file_exists($strMD5StatusFile)) {
// Status = running extract
$arrResponse['status'] = 'Cleanup ... ';
@@ -560,7 +560,7 @@ switch ($action) {
}
} else if (!file_exists($strMD5File)) {
} elseif (!file_exists($strMD5File)) {
// Status = running md5 check
$arrResponse['status'] = 'Downloading ... 100%';
@@ -578,7 +578,7 @@ switch ($action) {
}
} else if (!$boolCheckOnly) {
} elseif (!$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep)) {
@@ -608,9 +608,9 @@ switch ($action) {
if (empty($arrDownloadVirtIO)) {
$arrResponse = ['error' => 'Unknown version: ' . $_POST['download_version']];
} else if (empty($_POST['download_path'])) {
} elseif (empty($_POST['download_path'])) {
$arrResponse = ['error' => 'ISO storage path was empty'];
} else if (!is_dir($_POST['download_path'])) {
} elseif (!is_dir($_POST['download_path'])) {
$arrResponse = ['error' => 'ISO storage path doesn\'t exist'];
} else {
$strInstallScriptPgrep = '-f "VirtIOWin_' . $strKeyName . '_install.sh"';

View File

@@ -43,7 +43,7 @@ if (!empty($_GET['uuid'])) {
if (!empty($strIcon)) {
if (is_file($strIcon)) {
$strIconURL = $strIcon;
} else if (is_file("$docroot/plugins/dynamix.vm.manager/templates/images/" . $strIcon)) {
} elseif (is_file("$docroot/plugins/dynamix.vm.manager/templates/images/" . $strIcon)) {
$strIconURL = '/plugins/dynamix.vm.manager/templates/images/' . $strIcon;
}
} else {

View File

@@ -309,7 +309,7 @@
foreach($domain['vcpu'] as $i => $vcpu) {
$vcpupinstr .= "<vcpupin vcpu='$i' cpuset='$vcpu'/>";
}
} else if (!empty($domain['vcpus'])) {
} elseif (!empty($domain['vcpus'])) {
$vcpus = $domain['vcpus'];
for ($i=0; $i < $vcpus; $i++) {
$vcpupinstr .= "<vcpupin vcpu='$i' cpuset='$i'/>";

View File

@@ -585,7 +585,7 @@
if (preg_match('/.+\[(?P<gpuname>.+)\]/', $arrMatch['productname'], $arrGPUMatch)) {
$arrMatch['productname'] = $arrGPUMatch['gpuname'];
}
} else if (preg_match($arrWhitelistAudioClassIDregex, $arrMatch['typeid'])) {
} elseif (preg_match($arrWhitelistAudioClassIDregex, $arrMatch['typeid'])) {
$strClass = 'audio';
}

View File

@@ -1007,7 +1007,7 @@
$extra = '';
if (count(array_filter($arrConfig['pci'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) {
$extra .= ' checked="checked"';
} else if (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) {
} elseif (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) {
//$extra .= ' disabled="disabled"';
continue;
}

View File

@@ -83,7 +83,7 @@
if (empty($arrDownloadLibreELEC)) {
$arrResponse = ['error' => 'Unknown version: ' . $_POST['download_version']];
} else if (empty($_POST['download_path'])) {
} elseif (empty($_POST['download_path'])) {
$arrResponse = ['error' => 'Please choose a folder the LibreELEC image will download to'];
} else {
@mkdir($_POST['download_path'], 0777, true);
@@ -162,7 +162,7 @@
}
}
} else if (file_exists($strTempFile)) {
} elseif (file_exists($strTempFile)) {
if (pgrep($strDownloadPgrep)) {
@@ -175,12 +175,12 @@
$arrResponse['status'] = 'Downloading ... ' . $strPercent . '%';
} else if (pgrep($strVerifyPgrep)) {
} elseif (pgrep($strVerifyPgrep)) {
// Status = running md5 check
$arrResponse['status'] = 'Verifying ... ';
} else if (file_exists($strMD5StatusFile)) {
} elseif (file_exists($strMD5StatusFile)) {
// Status = running extract
$arrResponse['status'] = 'Extracting ... ';
@@ -198,7 +198,7 @@
}
}
} else if (!file_exists($strMD5File)) {
} elseif (!file_exists($strMD5File)) {
// Status = running md5 check
$arrResponse['status'] = 'Downloading ... 100%';
@@ -214,7 +214,7 @@
}
} else if (!$boolCheckOnly) {
} elseif (!$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep)) {
@@ -898,7 +898,7 @@
$extra = '';
if (count(array_filter($arrConfig['pci'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) {
$extra .= ' checked="checked"';
} else if (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) {
} elseif (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) {
//$extra .= ' disabled="disabled"';
continue;
}

View File

@@ -83,7 +83,7 @@
if (empty($arrDownloadOpenELEC)) {
$arrResponse = ['error' => 'Unknown version: ' . $_POST['download_version']];
} else if (empty($_POST['download_path'])) {
} elseif (empty($_POST['download_path'])) {
$arrResponse = ['error' => 'Please choose a folder the OpenELEC image will download to'];
} else {
@mkdir($_POST['download_path'], 0777, true);
@@ -162,7 +162,7 @@
}
}
} else if (file_exists($strTempFile)) {
} elseif (file_exists($strTempFile)) {
if (pgrep($strDownloadPgrep)) {
@@ -175,12 +175,12 @@
$arrResponse['status'] = 'Downloading ... ' . $strPercent . '%';
} else if (pgrep($strVerifyPgrep)) {
} elseif (pgrep($strVerifyPgrep)) {
// Status = running md5 check
$arrResponse['status'] = 'Verifying ... ';
} else if (file_exists($strMD5StatusFile)) {
} elseif (file_exists($strMD5StatusFile)) {
// Status = running extract
$arrResponse['status'] = 'Extracting ... ';
@@ -198,7 +198,7 @@
}
}
} else if (!file_exists($strMD5File)) {
} elseif (!file_exists($strMD5File)) {
// Status = running md5 check
$arrResponse['status'] = 'Downloading ... 100%';
@@ -214,7 +214,7 @@
}
} else if (!$boolCheckOnly) {
} elseif (!$boolCheckOnly) {
if (!pgrep($strInstallScriptPgrep)) {
@@ -898,7 +898,7 @@
$extra = '';
if (count(array_filter($arrConfig['pci'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) {
$extra .= ' checked="checked"';
} else if (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) {
} elseif (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) {
//$extra .= ' disabled="disabled"';
continue;
}

View File

@@ -194,27 +194,27 @@ toggle_diskio(true);
if ($var['sbSyncExit']!=0):?>
<tr>
<td></td>
<td><input type="button" value="History" onclick="openBox('/webGui/include/ParityHistory.php','Parity/Read-Check History',490,430,false)"></td>
<td><input type="button" value="History" onclick="openBox('/webGui/include/ParityHistory.php','Parity/Read-Check History',600,540,false)"></td>
<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',490,430,false)"></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',490,430,false)"></td>
<? list($entry,$duration,$speed,$status) = explode('|', read_parity_log($var['sbSynced']));
<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']));
if ($status==0):?>
<td>Last checked on <strong><?=my_time($var['sbSynced']).day_count($var['sbSynced'])?></strong>, finding <strong><?=$var['sbSyncErrs']?></strong> error<?=$var['sbSyncErrs']==1?'':'s'?>.
<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><?=$var['sbSyncErrs']?></strong> error<?=$var['sbSyncErrs']==1?'':'s'?>.
<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>
<? endif;?>
</td></tr>
@@ -223,7 +223,7 @@ toggle_diskio(true);
$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',490,430,false)"></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>

View File

@@ -75,12 +75,12 @@ function parity_status() {
}
if ($var['sbSynced2']==0) {
$idle = $var['mdResync']==0;
list($entry,$duration,$speed,$status) = explode('|', read_parity_log($var['sbSynced'],!$idle));
list($entry,$duration,$speed,$status,$error) = explode('|', read_parity_log($var['sbSynced'],!$idle));
if ($status==0) {
echo "<tr><td>".($idle ? "Last checked on " : "Activity started on ")."<strong>".my_time($var['sbSynced']).day_count($var['sbSynced'])."</strong>, finding <strong>{$var['sbSyncErrs']}</strong> error".($var['sbSyncErrs']==1?'.':'s.');
echo "<tr><td>".($idle ? "Last checked on " : "Activity started 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-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>{$var['sbSyncErrs']}</strong> error".($var['sbSyncErrs']==1?'.':'s.');
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>";
}
} else {

View File

@@ -148,7 +148,7 @@ foreach ($allVMs as $name) {
if (!empty($vmtemplateicon)) {
if (file_exists($vmtemplateicon)) {
$vmicon = $vmtemplateicon;
} else if (file_exists("$docroot/plugins/dynamix.vm.manager/templates/images/" . $vmtemplateicon)) {
} elseif (file_exists("$docroot/plugins/dynamix.vm.manager/templates/images/" . $vmtemplateicon)) {
$vmicon = '/plugins/dynamix.vm.manager/templates/images/' . $vmtemplateicon;
}
}

View File

@@ -41,8 +41,8 @@ foreach ($ports as $port) {
}
}
// enable interface only when VMs and Docker are stopped
$service = exec("pgrep libvirt") ? 'VMs' : '';
$service .= exec("pgrep docker") ? ($service ? ' and ' : '').'Docker' : '';
$service = exec("pgrep libvirt") ? 'VM manager' : '';
$service .= exec("pgrep docker") ? ($service ? ' and ' : '').'Docker service' : '';
// eth0 port status
$no_eth0 = exec("ip link show eth0|grep -Pom1 '(NO-CARRIER|state DOWN)'");
@@ -536,5 +536,5 @@ Network mask:
</script>
&nbsp;
: <input type="submit" value="Apply" onclick="$('#wait_eth0').show()"><input type="button" value="Done" onclick="done()"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change" : ""?>
: <input type="submit" value="Apply" onclick="$('#wait_eth0').show()"><input type="button" value="Done" onclick="done()"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change (see Settings)" : ""?>
</form>

View File

@@ -263,5 +263,5 @@ Network mask:
</script>
&nbsp;
: <input type="submit" value="Apply" onclick="$(waitid).show()"><input type="button" value="Done" onclick="done()"><input type="button" name="#shut_ethX" value="Port <?=$cmd?>" onclick="portToggle('ethX','<?=$cmd?>')"><?if ($service) echo "$service must be <span class='strong big'>Stopped</span> to change"?>
: <input type="submit" value="Apply" onclick="$(waitid).show()"><input type="button" value="Done" onclick="done()"><input type="button" name="#shut_ethX" value="Port <?=$cmd?>" onclick="portToggle('ethX','<?=$cmd?>')"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change (see Settings)" : ""?>
</form>

View File

@@ -20,30 +20,38 @@ function data_disks($disk) {
?>
<script>
function setNewPerms(form) {
var disks = '';
var all = form.includeDisk.options[0].selected;
var dirs = '';
for (var i=1,item; item=form.includeDisk.options[i]; i++) {
if (item.selected) {
if (disks.length) disks += '|';
if (!all) disks += item.value;
item.selected = false;
if (dirs.length) dirs += '|';
dirs += item.value;
}
}
if (all||disks) openBox('/webGui/scripts/newperms&arg1='+disks,'New Permissions',490,430);
for (var i=1,item; item=form.includeShare.options[i]; i++) {
if (item.selected) {
if (dirs.length) dirs += '|';
dirs += item.value;
}
}
if (dirs) swal({title:'Proceed?',text:'This will update folder & file permissions',type:'warning',showCancelButton:true},function(){openBox('/webGui/scripts/newperms&arg1='+dirs,'New Permissions',490,430,true);});
}
$(function() {
$('#s1').dropdownchecklist({emptyText:'None', width:131, firstItemChecksAll:true, explicitClose:'...close'});
$('#s2').dropdownchecklist({emptyText:'None', width:131, firstItemChecksAll:true, explicitClose:'...close'});
<?if ($var['fsState']!="Started"):?>
$('#s1').dropdownchecklist('disable');
$('#s2').dropdownchecklist('disable');
<?endif;?>
});
</script>
This is a one-time action to be taken after upgrading from a pre-5.0 unRAID server
release to version 5.0. It is also useful for restoring default ownership/permissions on files and
This is a mandatory one-time action to be taken after upgrading from a pre-5.0 unRAID server release to unRAID v5 or a later release.
Select **ALL DISKS** when performing this one-time action.
This utility is also useful for restoring default ownership/permissions on files and
directories when transitioning back from Active Directory to non-Active Directory integration.
This utility starts a background process that goes to each of your data disks and cache disk
and changes file and directory ownership to nobody/users (i.e., uid/gid to 99/100), and sets permissions
The utility starts a background process that goes to each of your data disks and cache disks and selected user shares
and changes file and directory ownership to *nobody/users* (i.e., uid/gid to 99/100), and sets permissions
as follows:
~~~
For directories:
@@ -59,21 +67,32 @@ Clicking **Start** will open another window and start the background process.
Closing the window before completion will terminate the background process - so don't do that. This process can take a long time if you have many files.
<form method="POST" action="/update.htm" target="progressFrame" onsubmit="setNewPerms(this);return false">
<form method="POST" action="/update.htm" target="progressFrame">
<span style="display:inline-block;margin-top:8px">
<span style="display:block;margin-bottom:4px;font-weight:bold">Disks</span>
<select id="s1" name="includeDisk" size="1" multiple="multiple" style="display:none">
<option value=''>All</option>
<?if (isset($disks['cache'])):?>
<option value='/mnt/cache' selected>Cache</option>
<option value='/mnt/cache'>Cache</option>
<?endif;?>
<?foreach (array_filter($disks,'data_disks') as $disk):?>
<?=mk_option(0,"/mnt/{$disk['name']}",my_disk($disk['name']))?>
<?=mk_option(1,"/mnt/{$disk['name']}",my_disk($disk['name']))?>
<?endforeach;?>
</select>&nbsp;&nbsp;
<input type="submit" name="start" value="Start" disabled><input type="button" value=" Done " onclick="done()">
<?if ($var['fsState']!="Started"):?>
Array must be <span class="strong big">Started</span> to change permissions.
</select>
</span>
<span style="display:inline-block">
<span style="display:block;margin-bottom:4px;font-weight:bold">User Shares</span>
<select id="s2" name="includeShare" size="1" multiple="multiple" style="display:none">
<option value=''>All</option>
<?foreach ($shares as $share):?>
<?=mk_option(1,"/mnt/user/{$share['name']}",$share['name'])?>
<?endforeach;?>
</select>
</span>
<br><br>
<?if ($var['fsState']=="Started"):?>
<input type="button" value="Start" onclick="setNewPerms(this.form)"><input type="button" value=" Done " onclick="done()">
<?else:?>
<input type="checkbox" onClick="start.disabled=!this.checked"><small>Yes I want to do this</small>
<input type="button" value="Start" disabled><input type="button" value=" Done " onclick="done()"> Array must be <span class="strong big">Started</span> to change permissions.
<?endif;?>
</form>

View File

@@ -34,7 +34,7 @@ function show_map($menu, $level) {
$link="<a href='/{$page['name']}'>{$page['name']}</a>";
if ($page['Type'] == "menu") {
echo "{$level} ({$link}) - {$page['Title']}<br>";
} else if ($page['Type'] == "xmenu") {
} elseif ($page['Type'] == "xmenu") {
echo "{$level} [{$link}] - {$page['Title']}<br>";
} else {
echo "{$level} {$link} - {$page['Title']}<br>";

View File

@@ -27,7 +27,7 @@ if ($name == "") {
"exclude" => "",
"useCache" => "no",
"cow" => "auto"];
} else if (array_key_exists($name, $shares)) {
} elseif (array_key_exists($name, $shares)) {
/* edit existing share */
$share = $shares[$name];
} else {

View File

@@ -181,7 +181,7 @@ case 'port':
$mtu = file_get_contents("/sys/class/net/$port/mtu");
if (substr($port,0,4)=='bond') {
$ports[$i++] = exec("grep -Pom1 '^Bonding Mode: \K.+' /proc/net/bonding/$port").", mtu $mtu";
} else if ($port=='lo') {
} elseif ($port=='lo') {
$ports[$i++] = str_replace('yes','loopback',exec("ethtool lo|grep -Pom1 '^\s+Link detected: \K.+'"));
} else {
unset($info);

View File

@@ -92,7 +92,7 @@ function fs_info(&$disk) {
if ($disk['fsStatus']=='-') {
echo "<td colspan='5'></td>";
return;
} else if ($disk['fsStatus']=='Mounted') {
} elseif ($disk['fsStatus']=='Mounted') {
echo "<td>{$disk['fsType']}</td>";
echo "<td>".my_scale($disk['fsSize']*1024,$unit)." $unit</td>";
if ($display['text']%10==0) {
@@ -380,8 +380,9 @@ case 'parity':
$duration = $var['sbSynced2'] - $var['sbSynced'];
$status = $var['sbSyncExit'];
$speed = ($status==0) ? my_scale($var['mdResyncSize']*1024/$duration,$unit,1)." $unit/s" : "Unavailable";
$error = $var['sbSyncErrs'];
$year = date('Y',$var['sbSynced2']);
if ($status==0||file_exists($log)) file_put_contents($log,"$year $timestamp|$duration|$speed|$status\n",FILE_APPEND);
if ($status==0||file_exists($log)) file_put_contents($log,"$year $timestamp|$duration|$speed|$status|$error\n",FILE_APPEND);
}
break;
}

View File

@@ -165,7 +165,7 @@ function read_parity_log($epoch,$busy=false) {
}
fclose($handle);
}
return $line ?: ($last ?: '0|0|0|0');
return $line ?: $last ?: '0|0|0|0|0';
}
function urlencode_path($path) {
return str_replace("%2F", "/", urlencode($path));

View File

@@ -33,23 +33,23 @@ function my_duration($time) {
<link type="text/css" rel="stylesheet" href="/webGui/styles/default-white.css">
</head>
<body>
<table class='share_status' style='margin-top:0'><thead><tr><td>Date</td><td>Duration</td><td>Speed</td><td>Status</td></tr></thead><tbody>
<table class='share_status' style='margin-top:0'><thead><tr><td>Date</td><td>Duration</td><td>Speed</td><td>Status</td><td>Errors</td></tr></thead><tbody>
<?
$log = '/boot/config/parity-checks.log'; $list = [];
if (file_exists($log)) {
$handle = fopen($log, 'r');
while (($line = fgets($handle)) !== false) {
list($date,$duration,$speed,$status) = explode('|',$line);
list($date,$duration,$speed,$status,$error) = explode('|',$line);
if ($speed==0) $speed = 'Unavailable';
$date = str_replace(' ',', ',strtr(str_replace(' ',' 0',$date),$month));
if ($duration>0||$status<>0) $list[] = "<tr><td>$date</td><td>".my_duration($duration)."</td><td>$speed</td><td>".($status==0?'OK':($status==-4?'Canceled':$status))."</td></tr>";
if ($duration>0||$status<>0) $list[] = "<tr><td>$date</td><td>".my_duration($duration)."</td><td>$speed</td><td>".($status==0?'OK':($status==-4?'Canceled':$status))."</td><td>$error</td></tr>";
}
fclose($handle);
}
if ($list)
for ($i=count($list); $i>=0; --$i) echo $list[$i];
else
echo "<tr><td colspan='4' style='text-align:center;padding-top:12px'>No parity check history present!</td></tr>";
echo "<tr><td colspan='5' style='text-align:center;padding-top:12px'>No parity check history present!</td></tr>";
?>
</tbody></table>
<div style="text-align:center"><input type="button" value="Done" onclick="top.Shadowbox.close()"></div>

View File

@@ -69,8 +69,8 @@ case "attributes":
$color = "";
$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'";
else if (in_array($info[0], $temps)) {
if ($info[9]>=$max) $color = " class='alert'"; else if ($info[9]>=$hot) $color = " class='warn'";
elseif (in_array($info[0], $temps)) {
if ($info[9]>=$max) $color = " class='alert'"; elseif ($info[9]>=$hot) $color = " class='warn'";
}
if ($info[8]=='-') $info[8] = 'Never';
if ($info[0]==9 && is_numeric($info[9])) duration($info[9]);

View File

@@ -70,7 +70,7 @@ function my_check($time,$speed) {
$secs = $hmss%60;
return plus($days,'day',($hour|$mins|$secs)==0).plus($hour,'hour',($mins|$secs)==0).plus($mins,'minute',$secs==0).plus($secs,'second',true).". Average speed: $speed";
}
function read_write_parity_log($epoch,$duration,$speed,$status) {
function read_write_parity_log($epoch,$duration,$speed,$status,$error) {
$log = '/boot/config/parity-checks.log';
$timestamp = str_replace(['.0','.'],[' ',' '],date('M.d H:i:s',$epoch));
if (file_exists($log)) {
@@ -82,7 +82,7 @@ function read_write_parity_log($epoch,$duration,$speed,$status) {
}
if (empty($line)) {
$year = date('Y',$epoch);
$line = "$year $timestamp|$duration|$speed|$status";
$line = "$year $timestamp|$duration|$speed|$status|$error";
if ($status==0||file_exists($log)) file_put_contents($log,"$line\n",FILE_APPEND);
}
return $line;
@@ -295,10 +295,10 @@ if ($var['mdResync']>0) {
$duration = $var['sbSynced2'] - $var['sbSynced'];
$status = $var['sbSyncExit'];
$speed = $status==0 ? my_scale($var['mdResyncSize']*1024/$duration,$unit,1)." $unit/s" : "Unavailable";
list($entry,$duration,$speed,$status) = explode('|', read_write_parity_log($var['sbSynced2'],$duration,$speed,$status));
list($entry,$duration,$speed,$status,$error) = explode('|', read_write_parity_log($var['sbSynced2'],$duration,$speed,$status,$var['sbSyncErrs']));
$info = $status==0 ? "Duration: ".my_check($duration, $speed) : ($status==-4 ? "Canceled" : "Error code: $status");
$level = ($status==0 && $var['sbSyncErrs']==0) ? "normal" : "warning";
exec("$notify -e \"unRAID $last\" -s \"Notice [$server] - $last finished ({$var['sbSyncErrs']} errors)\" -d \"$info\" -i \"$level\"");
exec("$notify -e \"unRAID $last\" -s \"Notice [$server] - $last finished ($error errors)\" -d \"$info\" -i \"$level\"");
unset($saved[$item][$name]);
}
}
@@ -338,7 +338,7 @@ if ($retval===0) {
exec("$notify -e \"Docker critical image disk utilization\" -s \"Alert [$server] - Docker image disk utilization of ${warn}%\" -d \"$info\" -i \"alert\"");
$saved[$item][$name] = $warn;
}
} else if ($warn>=$high2 && $high2>0) {
} elseif ($warn>=$high2 && $high2>0) {
if ($warn>$last) {
exec("$notify -e \"Docker high image disk utilization\" -s \"Warning [$server] - Docker image disk utilization of ${warn}%\" -d \"$info\" -i \"warning\"");
$saved[$item][$name] = $warn;

View File

@@ -12,17 +12,18 @@
*/
?>
<?
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
exec("wget -qO /dev/null 127.0.0.1:$(lsof -i -P -sTCP:LISTEN|grep -Pom1 '^emhttp.*:\K\d+')/update.htm?cmdStatus=apply");
$notify = "$docroot/webGui/scripts/notify";
$disks = parse_ini_file("/var/local/emhttp/disks.ini",true);
$var = parse_ini_file("/var/local/emhttp/var.ini");
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/webGui/include/CustomMerge.php";
$notify = "$docroot/webGui/scripts/notify";
$unraid = parse_plugin_cfg("dynamix",true);
$output = $unraid['notify']['report'];
$hot = $unraid['display']['hot'];
$max = $unraid['display']['max'];
$server = strtoupper($var['NAME']);
$data = [];
$parity = false;
@@ -96,14 +97,16 @@ function my_clock($time) {
}
function my_array(&$disk) {
global $data,$max,$hot,$error0,$error1,$error2,$error3;
global $data,$unraid,$error0,$error1,$error2,$error3;
$name = $disk['name'];
$hot = strlen($disk['hotTemp']) ? $disk['hotTemp'] : $unraid['display']['hot'];
$max = strlen($disk['maxTemp']) ? $disk['maxTemp'] : $unraid['display']['max'];
if (strpos($disk['status'],'_NP')!==false) return false;
$temp = $disk['temp'];
if ($temp>=$max) {
$fail = ' (disk is overheated';
$error0++;
} else if ($temp>=$hot) {
} elseif ($temp>=$hot) {
$fail = ' (disk is hot';
$error1++;
} else {
@@ -162,9 +165,9 @@ if ($mdResync>0) {
if ($var['sbSyncExit']!=0) {
$data[] = "Last check incomplete on ".my_time($sbSynced2).", finding $sbSyncErrs error".($sbSyncErrs==1?'.':'s.');
$data[] = "Error code: ".$var['sbSyncExit'];
} else if ($sbSynced==0) {
} elseif ($sbSynced==0) {
$data[] = "Parity has not been checked yet";
} else if ($sbSynced2>0) {
} elseif ($sbSynced2>0) {
if (strstr($var['mdResyncAction'],"recon")) {
$data[] = 'Parity or Data is invalid';
} else {