Skip to content

Commit

Permalink
include v2 object to listall more then 1000 files
Browse files Browse the repository at this point in the history
  • Loading branch information
muriloelias authored and cnpj committed Jul 21, 2021
1 parent 2cfb885 commit 84ca28a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Laravel CDN Assets Manager

[![Latest Stable Version](https://poser.pugx.org/publiux/laravelcdn/v/stable)](https://packagist.org/packages/publiux/laravelcdn)
[![Total Downloads](https://poser.pugx.org/publiux/laravelcdn/downloads)](https://packagist.org/packages/publiux/laravelcdn)
[![Build Status](https://travis-ci.org/publiux/laravelcdn.svg)](https://travis-ci.org/publiux/laravelcdn)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/publiux/laravelcdn/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/publiux/laravelcdn/?branch=master)
[![License](https://poser.pugx.org/publiux/laravelcdn/license)](https://packagist.org/packages/publiux/laravelcdn)
[![Latest Stable Version](https://poser.pugx.org/muriloelias/laravelcdn/v/stable)](https://packagist.org/packages/muriloelias/laravelcdn)
[![Total Downloads](https://poser.pugx.org/muriloelias/laravelcdn/downloads)](https://packagist.org/packages/muriloelias/laravelcdn)
[![Build Status](https://travis-ci.org/muriloelias/laravelcdn.svg)](https://travis-ci.org/muriloelias/laravelcdn)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/muriloelias/laravelcdn/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/muriloelias/laravelcdn/?branch=master)
[![License](https://poser.pugx.org/muriloelias/laravelcdn/license)](https://packagist.org/packages/muriloelias/laravelcdn)


##### Content Delivery Network Package for Laravel
Expand Down Expand Up @@ -43,7 +43,7 @@ This project has been forked from https://github.com/publiux/laravelcdn. All cre
Require `publiux/laravelcdn` in your project:

```bash
composer require "publiux/laravelcdn:~2.0"
composer require "muriloelias/laravelcdn:~2.0"
```

*If you are using Laravel 5.4 or below, you need to register the service provider:*
Expand Down
20 changes: 16 additions & 4 deletions src/Publiux/laravelcdn/Providers/AwsS3Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,23 @@ private function getFilesAlreadyOnBucket($assets)
{
$filesOnAWS = new Collection([]);

$files = $this->s3_client->listObjects([
'Bucket' => $this->getBucket(),
]);
$params = ['Bucket' => $this->getBucket()];
do {
$files = $this->s3_client->listObjectsV2($params);
$params['ContinuationToken'] = $files->get('NextContinuationToken');

foreach ($files->get('Contents') as $file) {
$a = [
'Key' => $file['Key'],
"LastModified" => $file['LastModified']->getTimestamp(),
'Size' => intval($file['Size'])
];
$filesOnAWS->put($file['Key'], $a);
}
} while ($files->get('IsTruncated'));


if (!$files['Contents']) {
if ($filesOnAWS->isEmpty()) {
//no files on bucket. lets upload everything found.
return $assets;
}
Expand Down

0 comments on commit 84ca28a

Please sign in to comment.