diff --git a/README.md b/README.md index 648fdccb..275b0f1c 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 diff --git a/classes/amazon-s3-and-cloudfront.php b/classes/amazon-s3-and-cloudfront.php index 3fdfbc4a..a4cbd1d0 100644 --- a/classes/amazon-s3-and-cloudfront.php +++ b/classes/amazon-s3-and-cloudfront.php @@ -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', @@ -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 ); } @@ -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 * @@ -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' ) @@ -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' ) diff --git a/classes/filters/as3cf-local-to-s3.php b/classes/filters/as3cf-local-to-s3.php index 20d271c9..523565d3 100644 --- a/classes/filters/as3cf-local-to-s3.php +++ b/classes/filters/as3cf-local-to-s3.php @@ -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 ] ); } } diff --git a/languages/amazon-s3-and-cloudfront-en.pot b/languages/amazon-s3-and-cloudfront-en.pot index f3402615..49de0dc5 100644 --- a/languages/amazon-s3-and-cloudfront-en.pot +++ b/languages/amazon-s3-and-cloudfront-en.pot @@ -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: 2019-06-11 14:00+0100\n" +"POT-Creation-Date: 2019-07-18 14:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,175 +19,175 @@ msgstr "" #: classes/amazon-s3-and-cloudfront.php:136 #: classes/amazon-s3-and-cloudfront.php:137 -msgid "Offload Media" +msgid "Offload Media Lite" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:277 -#: classes/amazon-s3-and-cloudfront.php:291 +#: classes/amazon-s3-and-cloudfront.php:274 +#: classes/amazon-s3-and-cloudfront.php:288 msgid "Unknown" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:345 +#: classes/amazon-s3-and-cloudfront.php:351 #: view/bucket-setting.php:17 #: view/provider-select.php:122 msgid "defined in wp-config.php" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:1091 -#: classes/amazon-s3-and-cloudfront.php:1225 +#: classes/amazon-s3-and-cloudfront.php:1097 +#: classes/amazon-s3-and-cloudfront.php:1231 #, php-format msgid "File %s does not exist" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:1104 +#: classes/amazon-s3-and-cloudfront.php:1110 #, php-format msgid "Mime type %s is not allowed" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:1115 +#: classes/amazon-s3-and-cloudfront.php:1121 msgid "Already offloaded to a different provider" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:1189 -#: classes/amazon-s3-and-cloudfront.php:1233 +#: classes/amazon-s3-and-cloudfront.php:1195 +#: classes/amazon-s3-and-cloudfront.php:1239 #, php-format msgid "Error offloading %s to provider: %s" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2375 +#: classes/amazon-s3-and-cloudfront.php:2381 msgid "This action can only be performed through an admin screen." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2377 +#: classes/amazon-s3-and-cloudfront.php:2383 msgid "Cheatin’ eh?" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2379 +#: classes/amazon-s3-and-cloudfront.php:2385 msgid "You do not have sufficient permissions to access this page." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2659 +#: classes/amazon-s3-and-cloudfront.php:2665 msgid "Error Getting Bucket Region" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2660 +#: classes/amazon-s3-and-cloudfront.php:2666 #, php-format msgid "There was an error attempting to get the region of the bucket %s: %s" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2791 +#: classes/amazon-s3-and-cloudfront.php:2797 msgid "" "This is a test file to check if the user has write permission to the bucket. " "Delete me if found." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2797 +#: classes/amazon-s3-and-cloudfront.php:2803 #, php-format msgid "" "There was an error attempting to check the permissions of the bucket %s: %s" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2879 +#: classes/amazon-s3-and-cloudfront.php:2885 msgid "Error creating bucket" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2880 +#: classes/amazon-s3-and-cloudfront.php:2886 msgid "Bucket name too short." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2881 +#: classes/amazon-s3-and-cloudfront.php:2887 msgid "Bucket name too long." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2882 +#: classes/amazon-s3-and-cloudfront.php:2888 msgid "" "Invalid character. Bucket names can contain lowercase letters, numbers, " "periods and hyphens." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2883 +#: classes/amazon-s3-and-cloudfront.php:2889 msgid "Error saving bucket" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2884 +#: classes/amazon-s3-and-cloudfront.php:2890 msgid "Error fetching buckets" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2885 +#: classes/amazon-s3-and-cloudfront.php:2891 msgid "Error getting URL preview: " msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2886 +#: classes/amazon-s3-and-cloudfront.php:2892 msgid "The changes you made will be lost if you navigate away from this page" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2887 +#: classes/amazon-s3-and-cloudfront.php:2893 msgid "Getting diagnostic info..." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2888 +#: classes/amazon-s3-and-cloudfront.php:2894 msgid "Error getting diagnostic info: " msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2889 +#: classes/amazon-s3-and-cloudfront.php:2895 msgctxt "placeholder for hidden access key, 39 char max" msgid "-- not shown --" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2891 -#: classes/amazon-s3-and-cloudfront.php:4928 +#: classes/amazon-s3-and-cloudfront.php:2897 +#: classes/amazon-s3-and-cloudfront.php:4934 msgid "Settings saved." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:2981 +#: classes/amazon-s3-and-cloudfront.php:2987 msgid "Cheatin' eh?" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3065 +#: classes/amazon-s3-and-cloudfront.php:3071 msgid "No bucket name provided." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3074 +#: classes/amazon-s3-and-cloudfront.php:3080 msgid "Bucket name not valid." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3087 +#: classes/amazon-s3-and-cloudfront.php:3093 msgid "No region provided." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3164 +#: classes/amazon-s3-and-cloudfront.php:3170 #: view/provider-select.php:329 msgctxt "placeholder for hidden secret access key, 39 char max" msgid "-- not shown --" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3187 +#: classes/amazon-s3-and-cloudfront.php:3193 msgid "Key File not valid JSON." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3233 +#: classes/amazon-s3-and-cloudfront.php:3239 msgctxt "Show the media library tab" msgid "Media Library" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3234 +#: classes/amazon-s3-and-cloudfront.php:3240 msgctxt "Show the addons tab" msgid "Addons" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3235 +#: classes/amazon-s3-and-cloudfront.php:3241 msgctxt "Show the support tab" msgid "Support" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3455 +#: classes/amazon-s3-and-cloudfront.php:3461 #, php-format msgid "" "WP Offload Media — The file %s has been given %s " "permissions in the bucket." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:3474 +#: classes/amazon-s3-and-cloudfront.php:3480 msgid "" "WP Offload Media Requirement Missing — Looks like you " "don't have an image manipulation library installed on this server and " @@ -195,18 +195,18 @@ msgid "" "Please setup GD or ImageMagick." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4187 +#: classes/amazon-s3-and-cloudfront.php:4193 #, php-format msgid "" "Define your access keys to enable write access to the " "bucket" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4194 +#: classes/amazon-s3-and-cloudfront.php:4200 msgid "Quick Start Guide" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4196 +#: classes/amazon-s3-and-cloudfront.php:4202 #, php-format msgid "" "Looks like we don't have write access to this bucket. It's likely that the " @@ -215,7 +215,7 @@ msgid "" "correctly." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4198 +#: classes/amazon-s3-and-cloudfront.php:4204 #, php-format msgid "" "Looks like we don't have access to the buckets. It's likely that the user " @@ -223,39 +223,39 @@ msgid "" "Please see our %s for instructions on setting up permissions correctly." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4369 +#: classes/amazon-s3-and-cloudfront.php:4375 msgid "WP Offload Media Activation" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4370 +#: classes/amazon-s3-and-cloudfront.php:4376 msgid "" "WP Offload Media Lite and WP Offload Media cannot both be active. We've " "automatically deactivated WP Offload Media Lite." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4372 +#: classes/amazon-s3-and-cloudfront.php:4378 msgid "WP Offload Media Lite Activation" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4373 +#: classes/amazon-s3-and-cloudfront.php:4379 msgid "" "WP Offload Media Lite and WP Offload Media cannot both be active. We've " "automatically deactivated WP Offload Media." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4425 +#: classes/amazon-s3-and-cloudfront.php:4431 msgid "More info »" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4520 +#: classes/amazon-s3-and-cloudfront.php:4526 msgid "this doc" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4522 +#: classes/amazon-s3-and-cloudfront.php:4528 msgid "WP Offload Media Feature Removed" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4523 +#: classes/amazon-s3-and-cloudfront.php:4529 #, php-format msgid "" "You had the \"Always non-SSL\" option selected in your settings, but we've " @@ -266,59 +266,59 @@ msgid "" "to the old behavior." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4553 +#: classes/amazon-s3-and-cloudfront.php:4559 msgid "Offload" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4661 +#: classes/amazon-s3-and-cloudfront.php:4667 msgctxt "Storage provider key name" msgid "Storage Provider" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4662 +#: classes/amazon-s3-and-cloudfront.php:4668 msgctxt "Storage provider name" msgid "Storage Provider" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4663 +#: classes/amazon-s3-and-cloudfront.php:4669 msgctxt "Bucket name" msgid "Bucket" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4664 +#: classes/amazon-s3-and-cloudfront.php:4670 msgctxt "Path to file in bucket" msgid "Path" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4665 +#: classes/amazon-s3-and-cloudfront.php:4671 msgctxt "Location of bucket" msgid "Region" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4666 +#: classes/amazon-s3-and-cloudfront.php:4672 msgctxt "Access control list of the file in bucket" msgid "Access" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4667 +#: classes/amazon-s3-and-cloudfront.php:4673 msgid "URL" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4891 +#: classes/amazon-s3-and-cloudfront.php:4897 msgid "Assets Pull" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4892 +#: classes/amazon-s3-and-cloudfront.php:4898 msgid "" "An addon for WP Offload Media to serve your site's JS, CSS, and other " "enqueued assets from Amazon CloudFront or another CDN." msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4896 +#: classes/amazon-s3-and-cloudfront.php:4902 msgid "Feature" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4942 +#: classes/amazon-s3-and-cloudfront.php:4948 #, php-format msgid "" "Amazon Web Services Plugin No Longer Required — As of " @@ -329,7 +329,7 @@ msgid "" "plugin, it should be safe to deactivate and delete it. %2$s" msgstr "" -#: classes/amazon-s3-and-cloudfront.php:4974 +#: classes/amazon-s3-and-cloudfront.php:4980 #, php-format msgid "" "WP Offload Media Settings Moved — You now define your " @@ -951,7 +951,7 @@ msgid "Next" msgstr "" #: view/provider-select.php:373 -#: view/settings/media.php:261 +#: view/settings/media.php:264 msgid "Save Changes" msgstr "" @@ -1067,7 +1067,14 @@ msgid "" "present on the local server and may not work when the file is removed. %s" msgstr "" -#: view/settings/media.php:273 +#: view/settings/media.php:248 +msgid "" +"If you have a backup system in place (as you should) that backs up your site " +"files, media, and database, your media will no longer be backed up as it " +"will no longer be present on the filesystem." +msgstr "" + +#: view/settings/media.php:276 #, php-format msgid "" "Need help getting your Access Keys? Check out the Quick Start " diff --git a/readme.txt b/readme.txt index 6d1b27bb..00076bf3 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google 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. @@ -78,6 +78,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 diff --git a/view/settings/media.php b/view/settings/media.php index b59e9f06..7330a536 100644 --- a/view/settings/media.php +++ b/view/settings/media.php @@ -243,7 +243,10 @@ $this->render_view( 'notice', $lost_files_args ); $remove_local_link = $this->more_info_link( '/wp-offload-media/doc/compatibility-with-other-plugins/', 'error-media+remove+files+from+server' ); - $remove_local_msg = apply_filters( 'as3cf_remove_local_notice', sprintf( __( 'Warning — Some plugins depend on the file being present on the local server and may not work when the file is removed. %s', 'amazon-s3-and-cloudfront' ), $remove_local_link ) ); + $remove_local_msg = sprintf( __( 'Warning — Some plugins depend on the file being present on the local server and may not work when the file is removed. %s', 'amazon-s3-and-cloudfront' ), $remove_local_link ); + $remove_local_msg .= "

"; + $remove_local_msg .= __( 'If you have a backup system in place (as you should) that backs up your site files, media, and database, your media will no longer be backed up as it will no longer be present on the filesystem.', 'amazon-s3-and-cloudfront' ); + $remove_local_msg = apply_filters( 'as3cf_remove_local_notice', $remove_local_msg ); $remove_local_args = array( 'message' => $remove_local_msg, 'id' => 'as3cf-remove-local-notice', diff --git a/wordpress-s3.php b/wordpress-s3.php index 13b616d8..12a73f5f 100644 --- a/wordpress-s3.php +++ b/wordpress-s3.php @@ -4,7 +4,7 @@ Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/ Description: Automatically copies media uploads to Amazon S3, DigitalOcean Spaces or Google Cloud Storage for storage and delivery. Optionally configure Amazon CloudFront or another CDN for even faster delivery. Author: Delicious Brains -Version: 2.2 +Version: 2.2.1 Author URI: https://deliciousbrains.com/ Network: True Text Domain: amazon-s3-and-cloudfront @@ -26,7 +26,7 @@ // Then completely rewritten. */ -$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '2.2'; +$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '2.2.1'; require_once dirname( __FILE__ ) . '/classes/as3cf-compatibility-check.php';