if p1 was done then don't ask the server for every individual file again

This commit is contained in:
Christian Haschek
2021-11-24 23:30:37 +01:00
parent f0cfdeb650
commit b669e69511

View File

@@ -18,6 +18,7 @@ $dir = ROOT.DS.'data'.DS;
$sc = getStorageControllers();
$count = 0;
$controllers = array();
$filehashes = [];
foreach($sc as $contr)
{
if((new $contr())->isEnabled()===true)
@@ -61,6 +62,9 @@ if(!in_array('p2',$argv))
if(endswith($cfile,'.enc'))
$hash = substr($cfile,0,-4);
else $hash = $cfile;
$filehashes[$contr][] = $hash;
if(!is_dir($dir.$hash) || !file_exists($dir.$hash.DS.$hash)) //file only on storage controller. Will download
{
echo " [P1] $hash is not on the Server but on ".get_class($contr)."\n";
@@ -115,10 +119,12 @@ while (false !== ($hash = readdir($dh))) {
continue;
$allhashes++;
$allsize+=$thissize;
$realhash = ($enc===false?$hash:$hash.'.enc');
foreach($controllers as $contr)
{
if((!$enc && !$contr->hashExists($hash)) || $enc && !$contr->hashExists($hash.'.enc'))
if( (count($filehashes[$contr]) > 0 && !in_array($hash,$filehashes[$contr])) || !$contr->hashExists($realhash) )
{
//if($sim!==true)