function get_s3object_region($s3object, $post_id = null)
{
if (!isset($s3object['region'])) {
// if region hasn't been stored in the s3 metadata retrieve using the bucket
$region = $this->get_bucket_region($s3object['bucket']);
if (is_wp_error($region)) {
return $region;
}
$s3object['region'] = $region;
if (!is_null($post_id)) {
// retrospectively update s3 metadata with region
update_post_meta($post_id, 'amazonS3_info', $s3object);
}
}
return $s3object['region'];
}