Fixes for ZFS subpools

This commit is contained in:
bergware
2023-11-02 04:55:10 +01:00
parent af3a468654
commit 46ad2a266d
3 changed files with 12 additions and 12 deletions
@@ -15,10 +15,6 @@ $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;
@@ -67,13 +63,6 @@ function my_disks($disk) {
function my_hyperlink($text, $link) {
return str_replace(['[',']'],["<a href=\"$link\">","</a>"],$text);
}
function no_tilde($name) {
global $tilde,$proxy;
return str_replace($tilde,$proxy,$name);
}
function prefix($key) {
return preg_replace('/\d+$/','',$key);
}
function parity_only($disk) {
return _var($disk,'type')=='Parity';
}
@@ -12,7 +12,7 @@
?>
<?
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/Wrappers.php";
$device = $_POST['device']??'';
$name = $_POST['name']??'';
@@ -13,6 +13,10 @@
<?
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// ZFS subpool name separator and replacement
$tilde = '~';
$proxy = '__';
// Wrapper functions
function parse_plugin_cfg($plugin, $sections=false, $scanner=INI_SCANNER_NORMAL) {
global $docroot;
@@ -86,6 +90,13 @@ function ipaddr($ethX='eth0', $prot=4) {
return _var($$ethX,'IPADDR:0');
}
}
function no_tilde($name) {
global $tilde,$proxy;
return str_replace($tilde,$proxy,$name);
}
function prefix($key) {
return preg_replace('/\d+$/','',$key);
}
// convert strftime to date format
function my_date($fmt, $time) {
$legacy = ['%c' => 'D j M Y h:i A','%A' => 'l','%Y' => 'Y','%B' => 'F','%e' => 'j','%d' => 'd','%m' => 'm','%I' => 'h','%H' => 'H','%M' => 'i','%S' => 's','%p' => 'a','%R' => 'H:i', '%F' => 'Y-m-d', '%T' => 'H:i:s'];