mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-11 18:56:21 +00:00
sync script added and fixed some controllers
This commit is contained in:
@@ -13,6 +13,20 @@ class AltfolderStorage implements StorageController
|
||||
return file_exists($altname);
|
||||
}
|
||||
|
||||
function getItems()
|
||||
{
|
||||
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(ALT_FOLDER.DS));
|
||||
$files = array();
|
||||
|
||||
foreach ($rii as $file) {
|
||||
if ($file->isDir())
|
||||
continue;
|
||||
$files[] = $file->getPathname();
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
function pullFile($hash,$location)
|
||||
{
|
||||
$altname=ALT_FOLDER.DS.$hash;
|
||||
@@ -25,8 +39,7 @@ class AltfolderStorage implements StorageController
|
||||
function pushFile($source,$hash)
|
||||
{
|
||||
$altname=ALT_FOLDER.DS.$hash;
|
||||
$orig = ROOT.DS.'data'.DS.$hash.DS.$hash;
|
||||
if(file_exists($orig) && !$this->hashExists($hash))
|
||||
if(!$this->hashExists($hash))
|
||||
{
|
||||
copy($source,$altname);
|
||||
return true;
|
||||
|
||||
@@ -36,7 +36,23 @@ class S3Storage implements StorageController
|
||||
if(!$this->s3)$this->connect();
|
||||
|
||||
return $this->s3->doesObjectExist(S3_BUCKET,$hash);
|
||||
}
|
||||
}
|
||||
|
||||
function getItems()
|
||||
{
|
||||
if(!$this->s3)$this->connect();
|
||||
|
||||
$iterator = $this->s3->getIterator('ListObjects', [
|
||||
'Bucket' => S3_BUCKET
|
||||
]);
|
||||
|
||||
$items = array();
|
||||
foreach ($iterator as $object) {
|
||||
$items[] = $object['Key'];
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
function pullFile($hash,$location)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user