Skip to content

Commit

Permalink
Deploying version 2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmjones committed Aug 27, 2020
1 parent 6096efe commit 786ac5a
Show file tree
Hide file tree
Showing 322 changed files with 5,995 additions and 552 deletions.
10 changes: 9 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.9
**Tested up to:** 5.5
**Requires PHP:** 5.5
**Stable tag:** 2.4.1
**Stable tag:** 2.4.2
**License:** GPLv3

Copies files to Amazon S3, DigitalOcean Spaces or Google Cloud Storage as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
Expand Down Expand Up @@ -89,6 +89,14 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### WP Offload Media Lite 2.4.2 - 2020-08-27 ###
* Improvement: Updated AWS PHP SDK to v3.150.1
* Bug fix: Image thumbnail URLs in custom HTML not rewritten to delivery provider URLs
* Bug fix: Background processes do not start when PHP memory limit in gigabytes
* Bug fix: PHP Fatal error: require(): Failed opening required '.../vendor/Aws3/Aws/Sts/StsClient.php'
* Bug fix: AWS SDK "Warning: is_readable(): open_basedir restriction in effect" message from Regional Endpoint check
* Bug fix: Bottom and right button borders in settings page are clipped when focused

### WP Offload Media Lite 2.4.1 - 2020-07-21 ###
* Bug fix: Fatal Error with EWWW Image Optimizer 5.5 or earlier installed
* Bug fix: AWS SDK "Warning: is_readable(): open_basedir restriction in effect" message when Use ARN Region in effect
Expand Down
2 changes: 1 addition & 1 deletion assets/css/styles.css

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions assets/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,7 @@ $as3cf_assets: #0769ad;
p.actions {
margin: 30px 0;
border-top: 1px solid #ccc;
//padding: 20px 30px;
padding-top: 15px;
overflow: hidden;

button,
.right {
Expand Down
2 changes: 1 addition & 1 deletion classes/amazon-s3-and-cloudfront.php
Original file line number Diff line number Diff line change
Expand Up @@ -4976,7 +4976,7 @@ public function get_memory_limit() {
$memory_limit = '32000M';
}

return intval( $memory_limit ) * 1024 * 1024;
return wp_convert_hr_to_bytes( $memory_limit );
}

/**
Expand Down
7 changes: 5 additions & 2 deletions classes/filters/as3cf-local-to-s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ protected function get_attachment_ids_from_urls( $urls ) {
}

foreach ( $query_set as $url ) {
$full_url = AS3CF_Utils::remove_scheme( $url );
// Path to search for in query set should be based on bare URL.
$bare_url = AS3CF_Utils::remove_scheme( $url );
// There can be multiple URLs in the query set that belong to the same full URL for the Media Library item.
$full_url = AS3CF_Utils::remove_size_from_filename( $bare_url );

if ( isset( $this->query_cache[ $full_url ] ) ) {
// ID already cached, use it.
Expand All @@ -259,7 +262,7 @@ protected function get_attachment_ids_from_urls( $urls ) {
continue;
}

$path = AS3CF_Utils::decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $full_url ), '/' ) );
$path = AS3CF_Utils::decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $bare_url ), '/' ) );

$paths[ $path ] = $full_url;
$full_urls[ $full_url ][] = $url;
Expand Down
13 changes: 8 additions & 5 deletions classes/providers/storage/aws-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,14 @@ private function batch_command( $command, array $items ) {
*/
protected function default_client_args() {
return array(
'signature_version' => static::SIGNATURE_VERSION,
'version' => static::API_VERSION,
'region' => $this->default_region,
'csm' => apply_filters( 'as3cf_disable_aws_csm', true ) ? false : true,
'use_arn_region' => apply_filters( 'as3cf_disable_aws_use_arn_region', true ) ? false : true,
'signature_version' => static::SIGNATURE_VERSION,
'version' => static::API_VERSION,
'region' => $this->default_region,
'csm' => apply_filters( 'as3cf_disable_aws_csm', true ) ? false : true,
'use_arn_region' => apply_filters( 'as3cf_disable_aws_use_arn_region', true ) ? false : true,
's3_us_east_1_regional_endpoint' => apply_filters( 'as3cf_aws_s3_us_east_1_regional_endpoint', 'legacy' ),
'endpoint_discovery' => apply_filters( 'as3cf_disable_aws_endpoint_discovery', true ) ? array( 'enabled' => false ) : array( 'enabled' => true ),
'sts_regional_endpoints' => apply_filters( 'as3cf_aws_sts_regional_endpoints', 'legacy' ),
);
}

Expand Down
2 changes: 1 addition & 1 deletion 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: nom@deliciousbrains.com\n"
"POT-Creation-Date: 2020-07-21 13:43+0100\n"
"POT-Creation-Date: 2020-08-27 12:18+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
10 changes: 9 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, digitalocean, digitalocean spaces, google
Requires at least: 4.9
Tested up to: 5.5
Requires PHP: 5.5
Stable tag: 2.4.1
Stable tag: 2.4.2
License: GPLv3

Copies files to Amazon S3, DigitalOcean Spaces or Google Cloud Storage as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
Expand Down Expand Up @@ -81,6 +81,14 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

== Changelog ==

= WP Offload Media Lite 2.4.2 - 2020-08-27 =
* Improvement: Updated AWS PHP SDK to v3.150.1
* Bug fix: Image thumbnail URLs in custom HTML not rewritten to delivery provider URLs
* Bug fix: Background processes do not start when PHP memory limit in gigabytes
* Bug fix: PHP Fatal error: require(): Failed opening required '.../vendor/Aws3/Aws/Sts/StsClient.php'
* Bug fix: AWS SDK "Warning: is_readable(): open_basedir restriction in effect" message from Regional Endpoint check
* Bug fix: Bottom and right button borders in settings page are clipped when focused

= WP Offload Media Lite 2.4.1 - 2020-07-21 =
* Bug fix: Fatal Error with EWWW Image Optimizer 5.5 or earlier installed
* Bug fix: AWS SDK "Warning: is_readable(): open_basedir restriction in effect" message when Use ARN Region in effect
Expand Down
60 changes: 59 additions & 1 deletion vendor/Aws3/Aws/Api/DateTimeResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api;

use DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Parser\Exception\ParserException;
use Exception;
/**
* DateTime overrides that make DateTime work more seamlessly as a string,
* with JSON documents, and with JMESPath.
Expand All @@ -10,15 +12,71 @@ class DateTimeResult extends \DateTime implements \JsonSerializable
{
/**
* Create a new DateTimeResult from a unix timestamp.
*
* The Unix epoch (or Unix time or POSIX time or Unix
* timestamp) is the number of seconds that have elapsed since
* January 1, 1970 (midnight UTC/GMT).
* @param $unixTimestamp
*
* @return DateTimeResult
* @throws Exception
*/
public static function fromEpoch($unixTimestamp)
{
return new self(gmdate('c', $unixTimestamp));
}
/**
* @param $iso8601Timestamp
*
* @return DateTimeResult
*/
public static function fromISO8601($iso8601Timestamp)
{
if (is_numeric($iso8601Timestamp) || !is_string($iso8601Timestamp)) {
throw new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Parser\Exception\ParserException('Invalid timestamp value passed to DateTimeResult::fromISO8601');
}
return new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult($iso8601Timestamp);
}
/**
* Create a new DateTimeResult from an unknown timestamp.
*
* @param $timestamp
*
* @return DateTimeResult
* @throws ParserException|Exception
*/
public static function fromTimestamp($timestamp, $expectedFormat = null)
{
if (empty($timestamp)) {
return self::fromEpoch(0);
}
if (!(is_string($timestamp) || is_numeric($timestamp))) {
throw new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Parser\Exception\ParserException('Invalid timestamp value passed to DateTimeResult::fromTimestamp');
}
try {
if ($expectedFormat == 'iso8601') {
try {
return self::fromISO8601($timestamp);
} catch (Exception $exception) {
return self::fromEpoch($timestamp);
}
} else {
if ($expectedFormat == 'unixTimestamp') {
try {
return self::fromEpoch($timestamp);
} catch (Exception $exception) {
return self::fromISO8601($timestamp);
}
} else {
if (\DeliciousBrains\WP_Offload_Media\Aws3\Aws\is_valid_epoch($timestamp)) {
return self::fromEpoch($timestamp);
}
}
}
return self::fromISO8601($timestamp);
} catch (Exception $exception) {
throw new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Parser\Exception\ParserException('Invalid timestamp value passed to DateTimeResult::fromTimestamp');
}
}
/**
* Serialize the DateTimeResult as an ISO 8601 date string.
*
Expand Down
1 change: 1 addition & 0 deletions vendor/Aws3/Aws/Api/ErrorParser/AbstractErrorParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ protected function populateShape(array &$data, \DeliciousBrains\WP_Offload_Media
if ($data['code'] == $error['name'] && $error instanceof StructureShape) {
$modeledError = $error;
$data['body'] = $this->extractPayload($modeledError, $response);
$data['error_shape'] = $modeledError;
foreach ($error->getMembers() as $name => $member) {
switch ($member['location']) {
case 'header':
Expand Down
5 changes: 1 addition & 4 deletions vendor/Aws3/Aws/Api/Parser/AbstractRestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ private function extractHeader($name, \DeliciousBrains\WP_Offload_Media\Aws3\Aws
break;
case 'timestamp':
try {
if (!empty($shape['timestampFormat']) && $shape['timestampFormat'] === 'unixTimestamp') {
$value = \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromEpoch($value);
}
$value = new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult($value);
$value = \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromTimestamp($value, !empty($shape['timestampFormat']) ? $shape['timestampFormat'] : null);
break;
} catch (\Exception $e) {
// If the value cannot be parsed, then do not add it to the
Expand Down
8 changes: 1 addition & 7 deletions vendor/Aws3/Aws/Api/Parser/JsonParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@ public function parse(\DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Shape $shap
}
return $target;
case 'timestamp':
if (!empty($shape['timestampFormat']) && $shape['timestampFormat'] !== 'unixTimestamp') {
return new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult($value);
}
// The Unix epoch (or Unix time or POSIX time or Unix
// timestamp) is the number of seconds that have elapsed since
// January 1, 1970 (midnight UTC/GMT).
return \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromEpoch($value);
return \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromTimestamp($value, !empty($shape['timestampFormat']) ? $shape['timestampFormat'] : null);
case 'blob':
return base64_decode($value);
default:
Expand Down
5 changes: 1 addition & 4 deletions vendor/Aws3/Aws/Api/Parser/MetadataParserTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ protected function extractHeader($name, \DeliciousBrains\WP_Offload_Media\Aws3\A
break;
case 'timestamp':
try {
if (!empty($shape['timestampFormat']) && $shape['timestampFormat'] === 'unixTimestamp') {
$value = \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromEpoch($value);
}
$value = new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult($value);
$value = \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromTimestamp($value, !empty($shape['timestampFormat']) ? $shape['timestampFormat'] : null);
break;
} catch (\Exception $e) {
// If the value cannot be parsed, then do not add it to the
Expand Down
7 changes: 4 additions & 3 deletions vendor/Aws3/Aws/Api/Parser/XmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult;
use DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\ListShape;
use DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\MapShape;
use DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Parser\Exception\ParserException;
use DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Shape;
use DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\StructureShape;
/**
Expand Down Expand Up @@ -99,10 +100,10 @@ private function parse_boolean(\DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Sh
}
private function parse_timestamp(\DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Shape $shape, $value)
{
if (!empty($shape['timestampFormat']) && $shape['timestampFormat'] === 'unixTimestamp') {
return \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromEpoch((string) $value);
if (is_string($value) || is_int($value) || is_object($value) && method_exists($value, '__toString')) {
return \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult::fromTimestamp((string) $value, !empty($shape['timestampFormat']) ? $shape['timestampFormat'] : null);
}
return new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\DateTimeResult($value);
throw new \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Parser\Exception\ParserException('Invalid timestamp value passed to XmlParser::parse_timestamp');
}
private function parse_xml_attribute(\DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Shape $shape, \DeliciousBrains\WP_Offload_Media\Aws3\Aws\Api\Shape $memberShape, $value)
{
Expand Down
24 changes: 18 additions & 6 deletions vendor/Aws3/Aws/AwsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public static function getArguments()
* Provide an instance of Aws\EndpointDiscovery\ConfigurationInterface,
* an instance Aws\CacheInterface, a callable that provides a promise for
* a Configuration object, or an associative array with the following
* keys: enabled: (bool) Set to true to enable endpoint discovery,
* defaults to false; cache_limit: (int) The maximum number of keys in the
* endpoints cache, defaults to 1000.
* keys: enabled: (bool) Set to true to enable endpoint discovery, false
* to explicitly disable it, defaults to false; cache_limit: (int) The
* maximum number of keys in the endpoints cache, defaults to 1000.
* - endpoint_provider: (callable) An optional PHP callable that
* accepts a hash of options including a "service" and "region" key and
* returns NULL or a hash of endpoint data, of which the "endpoint" key
Expand Down Expand Up @@ -136,8 +136,16 @@ public static function getArguments()
* - region: (string, required) Region to connect to. See
* http://docs.aws.amazon.com/general/latest/gr/rande.html for a list of
* available regions.
* - retries: (int, default=int(3)) Configures the maximum number of
* allowed retries for a client (pass 0 to disable retries).
* - retries: (int, Aws\Retry\ConfigurationInterface, Aws\CacheInterface,
* array, callable) Configures the retry mode and maximum number of
* allowed retries for a client (pass 0 to disable retries). Provide an
* integer for 'legacy' mode with the specified number of retries.
* Otherwise provide an instance of Aws\Retry\ConfigurationInterface, an
* instance of Aws\CacheInterface, a callable function, or an array with
* the following keys: mode: (string) Set to 'legacy', 'standard' (uses
* retry quota management), or 'adapative' (an experimental mode that adds
* client-side rate limiting to standard mode); max_attempts (int) The
* maximum number of attempts for a given request.
* - scheme: (string, default=string(5) "https") URI scheme to use when
* connecting connect. The SDK will utilize "https" endpoints (i.e.,
* utilize SSL/TLS connections) by default. You can attempt to connect to
Expand All @@ -152,6 +160,10 @@ public static function getArguments()
* signature version to use with a service (e.g., v4). Note that
* per/operation signature version MAY override this requested signature
* version.
* - use_aws_shared_config_files: (bool, default=bool(true)) Set to false to
* disable checking for shared config file in '~/.aws/config' and
* '~/.aws/credentials'. This will override the AWS_CONFIG_FILE
* environment variable.
* - validate: (bool, default=bool(true)) Set to false to disable
* client-side parameter validation.
* - version: (string, required) The version of the webservice to
Expand Down Expand Up @@ -241,7 +253,7 @@ public function __sleep()
*
* @return callable
*/
protected final function getSignatureProvider()
public final function getSignatureProvider()
{
return $this->signatureProvider;
}
Expand Down
Loading

0 comments on commit 786ac5a

Please sign in to comment.