From 0af02565ac646882e922a09c129a71fb397521bb Mon Sep 17 00:00:00 2001 From: Danae Miller-Clendon Date: Wed, 19 Jun 2019 17:38:44 +1200 Subject: [PATCH] - Register health check through _config.php as YML was not registering - Change date formate to SS3 --- _config.php | 5 +++++ _config/environmentcheck.yml | 4 ---- composer.json | 8 +------- src/Configuration/RotateConfig.php | 5 +++-- src/Storage/RotateStorage.php | 6 +++++- src/Storage/S3ClientFactory.php | 1 + 6 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 _config.php 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 {