Skip to content

Commit

Permalink
Deploying version 2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmjones committed Jul 18, 2019
1 parent b76f400 commit 6371429
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 87 deletions.
7 changes: 6 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.2
**Requires PHP:** 5.5
**Stable tag:** 2.2
**Stable tag:** 2.2.1
**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 @@ -86,6 +86,11 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### WP Offload Media Lite 2.2.1 - 2019-07-18 ###
* Improvement: Menu option and settings page title now include "Lite"
* Improvement: Remove Files From Server option now warns about media backups when switched on
* Bug fix: Undefined index in file amazon-s3-and-cloudfront/classes/filters/as3cf-local-to-s3.php at line 286

### WP Offload Media Lite 2.2 - 2019-06-10 ###
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-2-2-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
* New: Use IAM Roles without having to update wp-config.php
Expand Down
20 changes: 13 additions & 7 deletions classes/amazon-s3-and-cloudfront.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ function __construct( $plugin_file_path, $slug = null ) {
* @throws Exception
*/
function init( $plugin_file_path ) {
$this->plugin_title = __( 'Offload Media', 'amazon-s3-and-cloudfront' );
$this->plugin_menu_title = __( 'Offload Media', 'amazon-s3-and-cloudfront' );
$this->plugin_title = __( 'Offload Media Lite', 'amazon-s3-and-cloudfront' );
$this->plugin_menu_title = __( 'Offload Media Lite', 'amazon-s3-and-cloudfront' );

static::$provider_classes = array(
AWS_Provider::get_provider_key_name() => 'DeliciousBrains\WP_Offload_Media\Providers\AWS_Provider',
Expand Down Expand Up @@ -231,9 +231,6 @@ public function set_provider( $provider = null ) {
$provider = $this->get_core_setting( 'provider', static::$default_provider );
}

if ( empty( $provider ) ) {
$wibble = $provider;
}
if ( is_string( $provider ) ) {
$provider = new self::$provider_classes[ $provider ]( $this );
}
Expand Down Expand Up @@ -300,6 +297,15 @@ function get_plugin_page_title() {
return apply_filters( 'as3cf_settings_page_title', $this->plugin_title );
}

/**
* Get the plugin title to be used in admin menu
*
* @return string
*/
function get_plugin_menu_title() {
return apply_filters( 'as3cf_settings_menu_title', $this->plugin_menu_title );
}

/**
* Get the plugin prefix in slug format, ie. replace underscores with hyphens
*
Expand Down Expand Up @@ -2548,7 +2554,7 @@ public function admin_menu() {
$this->hook_suffix = add_submenu_page(
$this->get_plugin_pagenow(),
$this->get_plugin_page_title(),
$this->plugin_menu_title,
$this->get_plugin_menu_title(),
'manage_options',
$this->plugin_slug,
array( $this, 'render_page' )
Expand All @@ -2567,7 +2573,7 @@ public function admin_menu() {
public function aws_admin_menu( $aws ) {
$aws->add_page(
$this->get_plugin_page_title(),
$this->plugin_menu_title,
$this->get_plugin_menu_title(),
'manage_options',
$this->plugin_slug,
array( $this, 'render_page' )
Expand Down
17 changes: 11 additions & 6 deletions classes/filters/as3cf-local-to-s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,24 @@ protected function get_attachment_ids_from_urls( $urls ) {
SELECT post_id, meta_value FROM {$wpdb->postmeta}
WHERE meta_key = '_wp_attached_file'
AND meta_value IN ( " . implode( ',', array_unique( $meta_values ) ) . " )
ORDER BY post_id
";

$query_results = $wpdb->get_results( $sql );

if ( ! empty( $query_results ) ) {
foreach ( $query_results as $postmeta ) {
$attachment_id = (int) $postmeta->post_id;
$full_url = $paths[ $postmeta->meta_value ];
$this->query_cache[ $full_url ] = $attachment_id;
foreach ( $full_urls[ $full_url ] as $url ) {
$results[ $url ] = $attachment_id;
$full_url = $paths[ $postmeta->meta_value ];

if ( ! empty( $full_urls[ $full_url ] ) ) {
$attachment_id = (int) $postmeta->post_id;
$this->query_cache[ $full_url ] = $attachment_id;

foreach ( $full_urls[ $full_url ] as $url ) {
$results[ $url ] = $attachment_id;
}
unset( $full_urls[ $full_url ] );
}
unset( $full_urls[ $full_url ] );
}
}

Expand Down
Loading

0 comments on commit 6371429

Please sign in to comment.