mirror of
https://github.com/unraid/webgui.git
synced 2026-01-07 18:19:54 -06:00
Fixes for ZFS subpools
This commit is contained in:
@@ -15,7 +15,7 @@ Tag="database"
|
||||
*/
|
||||
?>
|
||||
<script>
|
||||
String.prototype.no_tilde = function(){return this.replace('~','_-_');}
|
||||
String.prototype.no_tilde = function(){return this.replace('<?=$tilde?>','<?=$proxy?>');}
|
||||
String.prototype.master = function(){return this.split('~')[0];}
|
||||
|
||||
function toggle_state(device,name,action) {
|
||||
|
||||
@@ -15,6 +15,10 @@ $docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/Secure.php";
|
||||
|
||||
// ZFS subpool name separator and replacement
|
||||
$tilde = '~';
|
||||
$proxy = '__';
|
||||
|
||||
// Helper functions
|
||||
function my_scale($value, &$unit, $decimals=NULL, $scale=NULL, $kilo=1000) {
|
||||
global $display,$language;
|
||||
@@ -64,7 +68,8 @@ function my_hyperlink($text, $link) {
|
||||
return str_replace(['[',']'],["<a href=\"$link\">","</a>"],$text);
|
||||
}
|
||||
function no_tilde($name) {
|
||||
return str_replace('~','_-_',$name);
|
||||
global $tilde,$proxy;
|
||||
return str_replace($tilde,$proxy,$name);
|
||||
}
|
||||
function prefix($key) {
|
||||
return preg_replace('/\d+$/','',$key);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2021, Lime Technology
|
||||
/* Copyright 2005-2023, 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,21 +10,20 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
function curl_socket($socket, $url, $postdata=NULL)
|
||||
{
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, $socket);
|
||||
if ($postdata !== NULL) {
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
function curl_socket($socket, $url, $message) {
|
||||
$com = curl_init($url);
|
||||
curl_setopt_array($com,[
|
||||
CURLOPT_UNIX_SOCKET_PATH => $socket,
|
||||
CURLOPT_POST=> 1,
|
||||
CURLOPT_POSTFIELDS => $message,
|
||||
CURLOPT_RETURNTRANSFER => true
|
||||
]);
|
||||
$reply = curl_exec($com);
|
||||
curl_close($com);
|
||||
return $reply;
|
||||
}
|
||||
function publish($endpoint, $message, $len=1)
|
||||
{
|
||||
return curl_socket("/var/run/nginx.socket", "http://localhost/pub/$endpoint?buffer_length=$len", $message);
|
||||
|
||||
function publish($endpoint, $message, $len=1) {
|
||||
return curl_socket("/var/run/nginx.socket", "http://localhost/pub/$endpoint?buffer_length=$len", $message);
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user