mirror of
https://github.com/unraid/webgui.git
synced 2026-05-11 23:01:41 -05:00
Fixes for ZFS subpools
This commit is contained in:
@@ -12,26 +12,15 @@
|
||||
?>
|
||||
<?
|
||||
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
$device = $_POST['device']??'';
|
||||
$name = $_POST['name']??'';
|
||||
$action = $_POST['action']??'';
|
||||
$state = $_POST['state']??'';
|
||||
$csrf = $_POST['csrf']??'';
|
||||
|
||||
function prefix($key) {
|
||||
return preg_replace('/\d+$/','',$key);
|
||||
}
|
||||
function emhttpd($cmd) {
|
||||
global $state, $csrf;
|
||||
$ch = curl_init("http://127.0.0.1/update");
|
||||
$options = [CURLOPT_UNIX_SOCKET_PATH => '/var/run/emhttpd.socket', CURLOPT_POST => 1, CURLOPT_POSTFIELDS => "$cmd&startState=$state&csrf_token=$csrf"];
|
||||
curl_setopt_array($ch, $options);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
exec("emcmd $cmd");
|
||||
}
|
||||
|
||||
switch ($device) {
|
||||
case 'New':
|
||||
emhttpd("cmdSpin{$action}={$name}");
|
||||
@@ -57,7 +46,7 @@ default:
|
||||
foreach ($disks as $disk) {
|
||||
if (_var($disk,'status') != 'DISK_OK') continue;
|
||||
$array = ($name=='array' && in_array(_var($disk,'type'),['Parity','Data']));
|
||||
if ($array || prefix(_var($disk,'name'))==$name) emhttpd("cmdSpin{$action}="._var($disk,'name'));
|
||||
if ($array || explode($tilde,prefix(_var($disk,'name')))[0]==$name) emhttpd("cmdSpin{$action}="._var($disk,'name'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user