Multi cache support

This commit is contained in:
bergware
2020-03-22 11:11:18 +01:00
parent c7a3637f08
commit 97480b2421
10 changed files with 14 additions and 19 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ $user = $_GET['user'];
$list = [];
$all = $docroot.preg_replace('/([\'" &()[\]\\\\])/','\\\\$1',$dir).'/*';
$fix = substr($dir,0,4)=='/mnt' ? explode('/',trim_slash($dir))[2] : 'flash';
$cache = implode('|',pools_filter(cache_filter($disks))) ?: 'cache';
$cache = implode('|',pools_filter($disks)) ?: 'cache';
exec("shopt -s dotglob; stat -L -c'%F|%n|%s|%Y' $all 2>/dev/null",$file);
if ($user) {
+1 -3
View File
@@ -263,9 +263,7 @@ case 'cache':
require_once "$docroot/webGui/include/CustomMerge.php";
require_once "$docroot/webGui/include/Preselect.php";
$error = $warning = $red = $orange = $fail = $smart = $full = $high = 0;
$cache = cache_filter($disks);
$pools = pools_filter($cache);
foreach ($pools as $pool) if ($cache[$pool]['devices']) {
foreach (pools_filter($disks) as $pool) if ($disks[$pool]['devices']) {
array_group('Cache',$pool);
echo "\0".($error+$warning)."\0".($red+$orange)."\0".($fail+$smart)."\0".($full+$high)."\r";
}
+1 -2
View File
@@ -379,8 +379,7 @@ case 'flash':
break;
case 'cache':
$cache = cache_filter($disks);
$pools = pools_filter($cache);
foreach ($pools as $pool) {
foreach (pools_filter($cache) as $pool) {
$tmp = "/var/tmp/$pool.log.tmp";
foreach ($cache as $disk) if (prefix($disk['name'])==$pool) $crypto |= $disk['luksState']!=0 || vfs_luks($disk['fsType']);
if ($var['fsState']=='Stopped') {
+2 -2
View File
@@ -79,8 +79,8 @@ function data_filter($disks) {
function cache_filter($disks) {
return array_filter($disks,'cache_only');
}
function pools_filter($cache) {
return array_unique(array_map('prefix',array_keys($cache)));
function pools_filter($disks) {
return array_unique(array_map('prefix',array_keys(cache_filter($disks))));
}
function my_id($id) {
global $display;