@@ -35,6 +35,16 @@ public function upload_files( string $processed_site_path ) : void {
3535 )
3636 );
3737
38+ $ put_data = [
39+ 'Bucket ' => Controller::getValue ( 's3Bucket ' ),
40+ 'ACL ' => 'public-read ' ,
41+ ];
42+
43+ $ cache_control = Controller::getValue ( 's3CacheControl ' );
44+ if ( $ cache_control ) {
45+ $ put_data ['CacheControl ' ] = $ cache_control ;
46+ }
47+
3848 foreach ( $ iterator as $ filename => $ file_object ) {
3949 $ base_name = basename ( $ filename );
4050 if ( $ base_name != '. ' && $ base_name != '.. ' ) {
@@ -69,15 +79,11 @@ public function upload_files( string $processed_site_path ) : void {
6979
7080 $ mime_type = MimeTypes::GuessMimeType ( $ filename );
7181
72- $ result = $ s3 ->putObject (
73- [
74- 'Bucket ' => Controller::getValue ( 's3Bucket ' ),
75- 'Key ' => $ s3_key ,
76- 'Body ' => file_get_contents ( $ filename ),
77- 'ACL ' => 'public-read ' ,
78- 'ContentType ' => $ mime_type ,
79- ]
80- );
82+ $ put_data ['Key ' ] = $ s3_key ;
83+ $ put_data ['Body ' ] = file_get_contents ( $ filename );
84+ $ put_data ['ContentType ' ] = $ mime_type ;
85+
86+ $ result = $ s3 ->putObject ( $ put_data );
8187
8288 if ( $ result ['@metadata ' ]['statusCode ' ] === 200 ) {
8389 \WP2Static \DeployCache::addFile ( $ cache_key );
0 commit comments