Skip to content

Commit 08c99a4

Browse files
committed
Add Object ACL option.
1 parent 0618558 commit 08c99a4

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

src/Controller.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ public static function seedOptions() : void {
195195

196196
$wpdb->query( $query );
197197

198+
$query = $wpdb->prepare(
199+
$query_string,
200+
's3ObjectACL',
201+
'public-read',
202+
'Object ACL',
203+
''
204+
);
205+
206+
$wpdb->query( $query );
207+
198208
$query = $wpdb->prepare(
199209
$query_string,
200210
'cfMaxPathsToInvalidate',
@@ -433,6 +443,12 @@ public static function saveOptionsFromUI() : void {
433443
[ 'name' => 's3CacheControl' ]
434444
);
435445

446+
$wpdb->update(
447+
$table_name,
448+
[ 'value' => sanitize_text_field( $_POST['s3ObjectACL'] ) ],
449+
[ 'name' => 's3ObjectACL' ]
450+
);
451+
436452
$wpdb->update(
437453
$table_name,
438454
[ 'value' => sanitize_text_field( $_POST['cfMaxPathsToInvalidate'] ) ],
@@ -477,4 +493,5 @@ public function addOptionsPage() : void {
477493
[ $this, 'renderS3Page' ]
478494
);
479495
}
480-
}
496+
}
497+

views/s3-page.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,27 @@
127127
</td>
128128
</tr>
129129

130+
<tr>
131+
<td style="width:50%;">
132+
<label
133+
for="<?php echo $view['options']['s3ObjectACL']->name; ?>"
134+
><?php echo $view['options']['s3ObjectACL']->label; ?></label>
135+
</td>
136+
<td>
137+
<select
138+
id="<?php echo $view['options']['s3ObjectACL']->name; ?>"
139+
name="<?php echo $view['options']['s3ObjectACL']->name; ?>"
140+
>
141+
<option
142+
<?php if ( $view['options']['s3ObjectACL']->value === 'public-read' ) { echo "selected"; } ?>
143+
value="public-read">public-read</option>
144+
<option
145+
<?php if ( $view['options']['s3ObjectACL']->value === 'private' ) { echo "selected"; } ?>
146+
value="private">private</option>
147+
</select>
148+
</td>
149+
</tr>
150+
130151
</tbody>
131152
</table>
132153

0 commit comments

Comments
 (0)