Skip to content

Commit

Permalink
Deploying version 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmjones committed Jul 3, 2018
1 parent 20d19b0 commit 9898898
Show file tree
Hide file tree
Showing 105 changed files with 582 additions and 142 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Requires at least:** 4.6
**Tested up to:** 4.9
**Requires PHP:** 5.5
**Stable tag:** 1.4.1
**Stable tag:** 1.4.2
**License:** GPLv3

Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
Expand Down Expand Up @@ -71,6 +71,10 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### WP Offload S3 Lite 1.4.2 - 2018-07-03 ###
* Bug fix: Error getting bucket region
* Bug fix: Child themes with missing or broken style.css break diagnostic info

### WP Offload S3 Lite 1.4.1 - 2018-06-21 ###
* Bug fix: Incorrect filesize saved to metadata when image removed from local server

Expand Down
50 changes: 30 additions & 20 deletions classes/amazon-s3-and-cloudfront.php
Original file line number Diff line number Diff line change
Expand Up @@ -2662,7 +2662,7 @@ public function get_bucket_region( $bucket, $use_cache = false ) {
}

try {
$region = $this->get_s3client()->get_bucket_location( array( 'Bucket' => $bucket ) );
$region = $this->get_s3client( false, true )->get_bucket_location( array( 'Bucket' => $bucket ) );
} catch ( Exception $e ) {
$error_msg_title = '<strong>' . __( 'Error Getting Bucket Region', 'amazon-s3-and-cloudfront' ) . '</strong> &mdash;';
$error_msg = sprintf( __( 'There was an error attempting to get the region of the bucket %s: %s', 'amazon-s3-and-cloudfront' ), $bucket, $e->getMessage() );
Expand Down Expand Up @@ -2693,7 +2693,7 @@ public function get_bucket_region( $bucket, $use_cache = false ) {
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'] );
$region = $this->get_bucket_region( $s3object['bucket'], true );
if ( is_wp_error( $region ) ) {
return $region;
}
Expand Down Expand Up @@ -3590,24 +3590,34 @@ function output_diagnostic_info( $escape = true ) {
}

$theme_info = wp_get_theme();
$output .= "Active Theme Name: " . esc_html( $theme_info->get( 'Name' ) );
$output .= "\r\n";
$output .= "Active Theme Version: " . esc_html( $theme_info->get( 'Version' ) );
$output .= "\r\n";
$output .= "Active Theme Folder: " . esc_html( $theme_info->get_stylesheet() );
$output .= "\r\n";

if ( is_child_theme() ) {
$parent_info = $theme_info->parent();
$output .= "Parent Theme Name: " . esc_html( $parent_info->get( 'Name' ) );
$output .= "\r\n";
$output .= "Parent Theme Version: " . esc_html( $parent_info->get( 'Version' ) );
$output .= "\r\n";
$output .= "Parent Theme Folder: " . esc_html( $parent_info->get_stylesheet() );
$output .= "\r\n";
}
if ( ! file_exists( $theme_info->get_stylesheet_directory() ) ) {
$output .= "WARNING: Active Theme Folder Not Found\r\n";

if ( ! empty( $theme_info ) && is_a( $theme_info, 'WP_Theme' ) ) {
$output .= "Active Theme Name: " . esc_html( $theme_info->get( 'Name' ) );
$output .= "\r\n";
$output .= "Active Theme Version: " . esc_html( $theme_info->get( 'Version' ) );
$output .= "\r\n";
$output .= "Active Theme Folder: " . esc_html( $theme_info->get_stylesheet() );
$output .= "\r\n";

if ( is_child_theme() ) {
$parent_info = $theme_info->parent();

if ( ! empty( $parent_info ) && is_a( $parent_info, 'WP_Theme' ) ) {
$output .= "Parent Theme Name: " . esc_html( $parent_info->get( 'Name' ) );
$output .= "\r\n";
$output .= "Parent Theme Version: " . esc_html( $parent_info->get( 'Version' ) );
$output .= "\r\n";
$output .= "Parent Theme Folder: " . esc_html( $parent_info->get_stylesheet() );
$output .= "\r\n";
} else {
$output .= "WARNING: Parent theme metadata not found\r\n";
}
}
if ( ! file_exists( $theme_info->get_stylesheet_directory() ) ) {
$output .= "WARNING: Active theme folder not found\r\n";
}
} else {
$output .= "WARNING: Theme metadata not found\r\n";
}

$output .= "\r\n";
Expand Down
6 changes: 5 additions & 1 deletion classes/providers/aws-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ protected function init_client( Array $args ) {
* @return S3Client
*/
protected function init_service_client( Array $args ) {
$this->s3_client = $this->aws_client->createS3( $args );
if ( empty( $args['region'] ) || $args['region'] === $this->default_region ) {
$this->s3_client = $this->aws_client->createMultiRegionS3( $args );
} else {
$this->s3_client = $this->aws_client->createS3( $args );
}

return $this->s3_client;
}
Expand Down
59 changes: 30 additions & 29 deletions languages/amazon-s3-and-cloudfront-en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: amazon-s3-and-cloudfront\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-06-25 11:52+0100\n"
"POT-Creation-Date: 2018-07-03 16:30+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -155,7 +155,7 @@ msgid "Error getting diagnostic info: "
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:2861
#: classes/amazon-s3-and-cloudfront.php:4581
#: classes/amazon-s3-and-cloudfront.php:4591
msgid "Settings saved."
msgstr ""

Expand Down Expand Up @@ -198,17 +198,17 @@ msgid ""
"Please setup GD or ImageMagick."
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:3861
#: classes/amazon-s3-and-cloudfront.php:3871
#, php-format
msgid ""
"<a href=\"%s\">Define your AWS keys</a> to enable write access to the bucket"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:3868
#: classes/amazon-s3-and-cloudfront.php:3878
msgid "Quick Start Guide"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:3870
#: classes/amazon-s3-and-cloudfront.php:3880
#, php-format
msgid ""
"Looks like we don't have write access to this bucket. It's likely that the "
Expand All @@ -217,47 +217,47 @@ msgid ""
"correctly."
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:3872
#: classes/amazon-s3-and-cloudfront.php:3882
#, php-format
msgid ""
"Looks like we don't have access to the buckets. It's likely that the user "
"you've provided access keys for hasn't been granted the correct permissions. "
"Please see our %s for instructions on setting up permissions correctly."
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4022
#: classes/amazon-s3-and-cloudfront.php:4032
msgid "WP Offload S3 Activation"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4023
#: classes/amazon-s3-and-cloudfront.php:4033
msgid ""
"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
"automatically deactivated WP Offload S3 Lite."
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4025
#: classes/amazon-s3-and-cloudfront.php:4035
msgid "WP Offload S3 Lite Activation"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4026
#: classes/amazon-s3-and-cloudfront.php:4036
msgid ""
"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
"automatically deactivated WP Offload S3."
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4078
#: classes/amazon-s3-and-cloudfront.php:4088
msgid "More&nbsp;info&nbsp;&raquo;"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4173
#: classes/amazon-s3-and-cloudfront.php:4183
msgid "this doc"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4175
#: classes/amazon-s3-and-cloudfront.php:4185
msgid "WP Offload S3 Feature Removed"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4176
#: classes/amazon-s3-and-cloudfront.php:4186
#, php-format
msgid ""
"You had the \"Always non-SSL\" option selected in your settings, but we've "
Expand All @@ -268,50 +268,50 @@ msgid ""
"to the old behavior."
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4206
#: classes/amazon-s3-and-cloudfront.php:4315
#: classes/amazon-s3-and-cloudfront.php:4216
#: classes/amazon-s3-and-cloudfront.php:4325
msgid "Amazon S3"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4316
#: classes/amazon-s3-and-cloudfront.php:4326
msgctxt "Amazon S3 bucket"
msgid "Bucket"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4317
#: classes/amazon-s3-and-cloudfront.php:4327
msgctxt "Path to file on Amazon S3"
msgid "Path"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4318
#: classes/amazon-s3-and-cloudfront.php:4328
msgctxt "Location of Amazon S3 bucket"
msgid "Region"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4319
#: classes/amazon-s3-and-cloudfront.php:4329
msgctxt "Access control list of the file on Amazon S3"
msgid "Access"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4320
#: classes/amazon-s3-and-cloudfront.php:4330
msgid "URL"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4544
#: classes/amazon-s3-and-cloudfront.php:4554
msgid "Assets Pull"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4545
#: classes/amazon-s3-and-cloudfront.php:4555
msgid ""
"An addon for WP Offload S3 to serve your site's JS, CSS, and other enqueued "
"assets from Amazon CloudFront or another CDN."
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4549
#: classes/amazon-s3-and-cloudfront.php:4559
msgid "Feature"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4595
#: classes/amazon-s3-and-cloudfront.php:4605
#, php-format
msgid ""
"<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of "
Expand All @@ -322,7 +322,7 @@ msgid ""
"should be safe to deactivate and delete it. %2$s"
msgstr ""

#: classes/amazon-s3-and-cloudfront.php:4627
#: classes/amazon-s3-and-cloudfront.php:4637
#, php-format
msgid ""
"<strong>WP Offload S3 Settings Moved</strong> &mdash; You now define your "
Expand Down Expand Up @@ -906,9 +906,10 @@ msgstr ""

#: view/settings/settings.php:42
msgid ""
"We recommend defining your Access Keys in wp-config.php so long as you "
"don&#8217;t commit it to source control (you shouldn&#8217;t be). Simply "
"copy the following snippet and replace the stars with the keys."
"We recommend defining your Access Keys <strong>near the top</strong> of your "
"wp-config.php so long as you don&#8217;t commit it to source control (you "
"shouldn&#8217;t be). Simply copy the following snippet and replace the stars "
"with the keys."
msgstr ""

#: view/settings/settings.php:52
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
Requires at least: 4.6
Tested up to: 4.9
Requires PHP: 5.5
Stable tag: 1.4.1
Stable tag: 1.4.2
License: GPLv3

Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
Expand Down Expand Up @@ -67,6 +67,10 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

== Changelog ==

= WP Offload S3 Lite 1.4.2 - 2018-07-03 =
* Bug fix: Error getting bucket region
* Bug fix: Child themes with missing or broken style.css break diagnostic info

= WP Offload S3 Lite 1.4.1 - 2018-06-21 =
* Bug fix: Incorrect filesize saved to metadata when image removed from local server

Expand Down
11 changes: 10 additions & 1 deletion vendor/Aws3/Aws/Api/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Service extends \DeliciousBrains\WP_Offload_S3\Aws3\Aws\Api\AbstractModel
*/
public function __construct(array $definition, callable $provider)
{
static $defaults = ['operations' => [], 'shapes' => [], 'metadata' => []], $defaultMeta = ['apiVersion' => null, 'serviceFullName' => null, 'endpointPrefix' => null, 'signingName' => null, 'signatureVersion' => null, 'protocol' => null, 'uid' => null];
static $defaults = ['operations' => [], 'shapes' => [], 'metadata' => []], $defaultMeta = ['apiVersion' => null, 'serviceFullName' => null, 'serviceId' => null, 'endpointPrefix' => null, 'signingName' => null, 'signatureVersion' => null, 'protocol' => null, 'uid' => null];
$definition += $defaults;
$definition['metadata'] += $defaultMeta;
$this->definition = $definition;
Expand Down Expand Up @@ -108,6 +108,15 @@ public function getServiceFullName()
{
return $this->definition['metadata']['serviceFullName'];
}
/**
* Get the service id
*
* @return string
*/
public function getServiceId()
{
return $this->definition['metadata']['serviceId'];
}
/**
* Get the API version of the service
*
Expand Down
2 changes: 1 addition & 1 deletion vendor/Aws3/Aws/Credentials/EcsCredentialProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __invoke()
{
$client = $this->client;
$request = new \DeliciousBrains\WP_Offload_S3\Aws3\GuzzleHttp\Psr7\Request('GET', self::getEcsUri());
return $client($request, ['timeout' => $this->timeout])->then(function (\DeliciousBrains\WP_Offload_S3\Aws3\Psr\Http\Message\ResponseInterface $response) {
return $client($request, ['timeout' => $this->timeout, 'proxy' => ''])->then(function (\DeliciousBrains\WP_Offload_S3\Aws3\Psr\Http\Message\ResponseInterface $response) {
$result = $this->decodeResult((string) $response->getBody());
return new \DeliciousBrains\WP_Offload_S3\Aws3\Aws\Credentials\Credentials($result['AccessKeyId'], $result['SecretAccessKey'], $result['Token'], strtotime($result['Expiration']));
})->otherwise(function ($reason) {
Expand Down
Loading

0 comments on commit 9898898

Please sign in to comment.