mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-15 12:38:01 +00:00
if p1 was done then don't ask the server for every individual file again
This commit is contained in:
@@ -18,6 +18,7 @@ $dir = ROOT.DS.'data'.DS;
|
|||||||
$sc = getStorageControllers();
|
$sc = getStorageControllers();
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$controllers = array();
|
$controllers = array();
|
||||||
|
$filehashes = [];
|
||||||
foreach($sc as $contr)
|
foreach($sc as $contr)
|
||||||
{
|
{
|
||||||
if((new $contr())->isEnabled()===true)
|
if((new $contr())->isEnabled()===true)
|
||||||
@@ -61,6 +62,9 @@ if(!in_array('p2',$argv))
|
|||||||
if(endswith($cfile,'.enc'))
|
if(endswith($cfile,'.enc'))
|
||||||
$hash = substr($cfile,0,-4);
|
$hash = substr($cfile,0,-4);
|
||||||
else $hash = $cfile;
|
else $hash = $cfile;
|
||||||
|
|
||||||
|
$filehashes[$contr][] = $hash;
|
||||||
|
|
||||||
if(!is_dir($dir.$hash) || !file_exists($dir.$hash.DS.$hash)) //file only on storage controller. Will download
|
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";
|
echo " [P1] $hash is not on the Server but on ".get_class($contr)."\n";
|
||||||
@@ -115,10 +119,12 @@ while (false !== ($hash = readdir($dh))) {
|
|||||||
continue;
|
continue;
|
||||||
$allhashes++;
|
$allhashes++;
|
||||||
$allsize+=$thissize;
|
$allsize+=$thissize;
|
||||||
|
$realhash = ($enc===false?$hash:$hash.'.enc');
|
||||||
|
|
||||||
foreach($controllers as $contr)
|
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)
|
//if($sim!==true)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user