diff --git a/_config.php b/_config.php new file mode 100644 index 0000000..24e361c --- /dev/null +++ b/_config.php @@ -0,0 +1,5 @@ + SS_Datetime::now()->Format('y-MM-dd'), - 'time' => SS_Datetime::now()->Format('HH.mm.ss'), + 'date' => SS_Datetime::now()->Format('Y-m-d'), + 'time' => SS_Datetime::now()->Format('H.i.s'), ]; } @@ -110,6 +110,7 @@ public static function parse($path): ?array return null; } + // Return array of matched parts $result = []; foreach ($patterns as $name => $value) { diff --git a/src/Storage/RotateStorage.php b/src/Storage/RotateStorage.php index b39a15a..e0f0a67 100644 --- a/src/Storage/RotateStorage.php +++ b/src/Storage/RotateStorage.php @@ -4,7 +4,9 @@ use Aws\Result; use Aws\S3\S3Client; +use Debug; use Exception; +use Injector; use LittleGiant\SpinDB\Configuration\RotateConfig; use Object; @@ -66,7 +68,9 @@ public function getFiles() ]); $files = []; $objects = $objects->get('Contents'); - if ($objects) { + + if (!empty($objects)) { + foreach ($objects as $object) { $parts = RotateConfig::parse($object['Key']); if ($parts) { diff --git a/src/Storage/S3ClientFactory.php b/src/Storage/S3ClientFactory.php index f29ce66..14c62bd 100644 --- a/src/Storage/S3ClientFactory.php +++ b/src/Storage/S3ClientFactory.php @@ -5,6 +5,7 @@ use Aws\Credentials\Credentials; use Aws\S3\S3Client; use LittleGiant\SpinDB\Configuration\RotateConfig; +use SilverStripe\Framework\Injector\Factory; class S3ClientFactory implements Factory {