Merge pull request #5 from limetech/master

Merge upstream changes
This commit is contained in:
itimpi
2019-11-21 15:30:52 +00:00
committed by GitHub
6 changed files with 112 additions and 113 deletions
@@ -136,7 +136,8 @@ span.disabled{color:#404040}
<form markdown="1" id="settingsForm" name="settingsForm" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareDocker(this)">
<input type="hidden" name="#file" value="<?=$docker_cfgfile?>">
<input type="hidden" name="#include" value="/plugins/dynamix.docker.manager/include/PruneConfig.php">
<input type="hidden" name="#command" value="/plugins/dynamix/scripts/emhttpd_update">
<input type="hidden" name="#command" value="/plugins/dynamix/scripts/emcmd">
<input type="hidden" name="#arg[1]" value="cmdStatus=Apply">
<input type="hidden" name="#cleanup" value="true">
<input type="hidden" name="DOCKER_CUSTOM_NETWORKS" value="<?=implode(' ',$unset)?> ">
Enable Docker:
+2 -1
View File
@@ -80,7 +80,8 @@ body{-webkit-overflow-scrolling:touch}
<span class="status vhshift"><input type="checkbox" class="advancedview"></span>
<form markdown="1" id="settingsForm" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file" value="<?=htmlspecialchars($domain_cfgfile)?>">
<input type="hidden" name="#command" value="/plugins/dynamix/scripts/emhttpd_update">
<input type="hidden" name="#command" value="/plugins/dynamix/scripts/emcmd">
<input type="hidden" name="#arg[1]" value="cmdStatus=Apply">
Enable VMs:
: <select id="SERVICE" name="SERVICE">
<?= mk_option($libvirt_service, 'disable', 'No'); ?>
+91 -91
View File
@@ -17,18 +17,18 @@ Tag="snowflake-o"
<?
$keyfile = file_exists($var['luksKeyfile']);
$encrypt = false;
/* only one of $forced, $missing, or $wrong will be true, or all will be false */
$forced = $missing = $wrong = false;
/* only one of $present, $missing, or $wrong will be true, or all will be false */
$forced = $present = $missing = $wrong = false;
foreach ($disks as $disk) {
if (strpos($disk['fsType'],'luks:')!==false || ($disk['fsType']=='auto' && (strpos($var['defaultFsType'],'luks:')!==false || $disk['luksState']==2 || $disk['luksState']==3))) {
$encrypt = true;
if ($disk['luksState']==0) $forced = true;
if ($disk['luksState']==1) $present = true;
if ($disk['luksState']==2) $missing = true;
if ($disk['luksState']==3) $wrong = true;
}
}
if ($forced && ($missing || $wrong)) $forced = false;
if ($forced && ($present || $missing || $wrong)) $forced = false;
function check_encryption() {
global $forced, $missing, $wrong;
@@ -345,7 +345,7 @@ function formatWarning(val) {
<tr><td>Estimated speed:</td><td id="line3"></td><td></td></tr>
<tr><td>Estimated finish:</td><td id="line4"></td><td></td></tr>
<? if (strstr($var['mdResyncAction'],"check ")):?>
<tr><td>Sync errors <?if ($var['mdResyncCorr']==0):?>detected:<?else:?>corrected:<?endif;?></td><td id="line5"></td><td></td></tr>
<tr><td>Sync errors <?if ($var['mdResyncCorr']==0):?>detected:<?else:?>corrected:<?endif;?></td><td id="line5"></td><td></td></tr>
<? endif;
endif;
break;
@@ -378,95 +378,95 @@ function formatWarning(val) {
<tr><td><?status_indicator()?><span class="strong big">Stopped.</span></td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>This Unraid OS release has been withdrawn and may no longer be used. Please <a href="/Plugins">update</a> your server.</td></tr>
<? else:
switch ($var['mdState']):
case "STOPPED":
if (strstr($var['mdResyncAction'],"recon")):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line and start <strong>Parity-Sync</strong> and/or <strong>Data-Rebuild</strong>.</td></tr>
<? elseif ($var['mdResyncAction']=="clear"):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. New data disk(s) detected.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line and start <strong>Clearing</strong> new data disk(s).</td></tr>
<? elseif ($var['sbClean']!="yes" && $var['mdResyncAction']=="check"):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Unclean shutdown detected.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line.</td></tr>
<? elseif ($var['sbClean']!="yes" && strstr($var['mdResyncAction'],"check")):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Unclean shutdown detected.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line and start <strong>Parity-Check</strong>.
<br><input type="checkbox" name="optionCorrect" value="correct" checked><small>Write corrections to parity</small></td></tr>
<? elseif (missing_cache()):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Missing Cache disk.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)" disabled></td>
<td><strong>Start</strong> will remove the missing cache disk and then bring the array on-line.
switch ($var['mdState']):
case "STOPPED":
if (strstr($var['mdResyncAction'],"recon")):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line and start <strong>Parity-Sync</strong> and/or <strong>Data-Rebuild</strong>.</td></tr>
<? elseif ($var['mdResyncAction']=="clear"):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. New data disk(s) detected.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line and start <strong>Clearing</strong> new data disk(s).</td></tr>
<? elseif ($var['sbClean']!="yes" && $var['mdResyncAction']=="check"):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Unclean shutdown detected.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line.</td></tr>
<? elseif ($var['sbClean']!="yes" && strstr($var['mdResyncAction'],"check")):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Unclean shutdown detected.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line and start <strong>Parity-Check</strong>.
<br><input type="checkbox" name="optionCorrect" value="correct" checked><small>Write corrections to parity</small></td></tr>
<? elseif (missing_cache()):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Missing Cache disk.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)" disabled></td>
<td><strong>Start</strong> will remove the missing cache disk and then bring the array on-line.
<br><input type="checkbox" name="confirmStart" value="OFF" onclick="$('#cmdStart').prop('disabled',!arrayOps.confirmStart.checked)"><small>Yes I want to do this</small></td></tr>
<? else:?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line.</td></tr>
<? endif;
maintenance_mode();
check_encryption();
break;
case "NEW_ARRAY":
if (strpos($disks['parity']['status'],"DISK_NP")===0 && strpos($disks['parity2']['status'],"DISK_NP")===0):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<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" id="cmdStart" 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>
<? endif;
maintenance_mode();
check_encryption();
break;
case "DISABLE_DISK":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Missing disk.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)" disabled></td>
<td><strong>Start</strong> will disable the missing disk and then bring the array on-line. Install a replacement disk as soon as possible.
<br><input type="checkbox" name="confirmStart" value="OFF" onclick="$('#cmdStart').prop('disabled',!arrayOps.confirmStart.checked)"><small>Yes I want to do this</small></td></tr>
<? else:?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will bring the array on-line.</td></tr>
<? endif;
maintenance_mode();
check_encryption();
break;
case "NEW_ARRAY":
if (strpos($disks['parity']['status'],"DISK_NP")===0 && strpos($disks['parity2']['status'],"DISK_NP")===0):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Configuration valid.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<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" id="cmdStart" 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>
<? endif;
maintenance_mode();
check_encryption();
break;
case "DISABLE_DISK":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Missing disk.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)" disabled></td>
<td><strong>Start</strong> will disable the missing disk and then bring the array on-line. Install a replacement disk as soon as possible.
<br><input type="checkbox" name="confirmStart" value="OFF" onclick="$('#cmdStart').prop('disabled',!arrayOps.confirmStart.checked)"><small>Yes I want to do this</small></td></tr>
<? maintenance_mode();
check_encryption();
break;
case "RECON_DISK":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Replacement disk installed.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will start <strong>Parity-Sync</strong> and/or <strong>Data-Rebuild</strong>.</td></tr>
<? maintenance_mode();
check_encryption();
break;
case "SWAP_DSBL":
if ($var['fsCopyPrcnt']=="100"):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Upgrading disk/swapping parity.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will expand the file system of the data disk (if possible); then bring the array on-line and start Data-Rebuild.</td></tr>
<? maintenance_mode();
check_encryption();
else:?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Upgrading disk/swapping parity.</td><td><input type="submit" name="cmdCopy" value="Copy" disabled></td>
<td><strong>Copy</strong> will copy the parity information to the new <em>parity</em> disk.
<br>Once copy completes, the array may be Started, to initiate Data-Rebuild of the disabled disk.
<br><input type="checkbox" name="confirmStart" value="OFF" onclick="arrayOps.cmdCopy.disabled=!arrayOps.confirmStart.checked"><small>Yes I want to do this</small></td></tr>
<? endif;
break;
case "ERROR:INVALID_EXPANSION":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Invalid expansion.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>You may not add new disk(s) and also remove existing disk(s).</td></tr>
<? break;
case "ERROR:NEW_DISK_TOO_SMALL":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Replacement disk is too small.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>The replacement disk must be as big or bigger than the original.</td></tr>
<? break;
case "ERROR:PARITY_NOT_BIGGEST":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Disk in parity slot is not biggest.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>If this is a new array, move the largest disk into the <em>parity</em> slot.
<br>If you are adding a new disk or replacing a disabled disk, try Parity-Swap.</td></tr>
<? break;
case "ERROR:TOO_MANY_MISSING_DISKS":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Invalid configuration.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>Too many wrong and/or missing disks!</td></tr>
<? break;
case "ERROR:NO_DATA_DISKS":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. No data disks.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>No array data disks have been assigned!</td></tr>
<? break;
endswitch;
endif;
break;
case "RECON_DISK":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Replacement disk installed.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will start <strong>Parity-Sync</strong> and/or <strong>Data-Rebuild</strong>.</td></tr>
<? maintenance_mode();
check_encryption();
break;
case "SWAP_DSBL":
if ($var['fsCopyPrcnt']=="100"):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Upgrading disk/swapping parity.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<td><strong>Start</strong> will expand the file system of the data disk (if possible); then bring the array on-line and start Data-Rebuild.</td></tr>
<? maintenance_mode();
check_encryption();
else:?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Upgrading disk/swapping parity.</td><td><input type="submit" name="cmdCopy" value="Copy" disabled></td>
<td><strong>Copy</strong> will copy the parity information to the new <em>parity</em> disk.
<br>Once copy completes, the array may be Started, to initiate Data-Rebuild of the disabled disk.
<br><input type="checkbox" name="confirmStart" value="OFF" onclick="arrayOps.cmdCopy.disabled=!arrayOps.confirmStart.checked"><small>Yes I want to do this</small></td></tr>
<? endif;
break;
case "ERROR:INVALID_EXPANSION":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Invalid expansion.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>You may not add new disk(s) and also remove existing disk(s).</td></tr>
<? break;
case "ERROR:NEW_DISK_TOO_SMALL":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Replacement disk is too small.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>The replacement disk must be as big or bigger than the original.</td></tr>
<? break;
case "ERROR:PARITY_NOT_BIGGEST":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Disk in parity slot is not biggest.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>If this is a new array, move the largest disk into the <em>parity</em> slot.
<br>If you are adding a new disk or replacing a disabled disk, try Parity-Swap.</td></tr>
<? break;
case "ERROR:TOO_MANY_MISSING_DISKS":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Invalid configuration.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>Too many wrong and/or missing disks!</td></tr>
<? break;
case "ERROR:NO_DATA_DISKS":?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. No data disks.</td><td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td>No array data disks have been assigned!</td></tr>
<? break;
endswitch;
endif;
endswitch;?>
<tr><td></td><td class="line" colspan="2"></td></tr>
</table>
+3 -2
View File
@@ -19,11 +19,12 @@ function curl_socket($socket, $url, $postdata = NULL)
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function publish($endpoint, $message)
{
curl_socket("/var/run/nginx.socket", "http://localhost/pub/$endpoint?buffer_length=1", $message);
return curl_socket("/var/run/nginx.socket", "http://localhost/pub/$endpoint?buffer_length=1", $message);
}
?>
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/php
<?PHP
require_once "/usr/local/emhttp/webGui/include/publish.php";
function emhttp_command($cmd)
{
$var = parse_ini_file("/var/local/emhttp/var.ini");
$cmd .= "&csrf_token={$var['csrf_token']}";
return curl_socket("/var/run/emhttpd.socket", "http://localhost/update", $cmd);
}
$result = emhttp_command($argv[1]);
if ($result === "") exit(0);
echo "$result".PHP_EOL;
exit(1);
?>
-18
View File
@@ -1,18 +0,0 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$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");
?>