diff --git a/README.md b/README.md index ac5cf8e..e3614e2 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ **Contributors:** bradt, deliciousbrains **Tags:** amazon, amazon web services **Requires at least:** 4.4 -**Tested up to:** 4.5.2 -**Stable tag:** trunk +**Tested up to:** 4.6 +**Stable tag:** 0.3.6 **License:** GPLv3 Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins. @@ -35,6 +35,9 @@ This plugin is required by other plugins, which use its libraries and its settin ## Changelog ## +### 0.3.7 - 2016-09-01 ### +* Improvement: No longer delete plugin data on uninstall. Manual removal possible, as per this [doc](https://deliciousbrains.com/wp-offload-s3/doc/uninstall/). + ### 0.3.6 - 2016-05-30 ### * Improvement: Now checks that the `curl_multi_exec` function is available. diff --git a/amazon-web-services.php b/amazon-web-services.php index 47c160f..d4ac04e 100644 --- a/amazon-web-services.php +++ b/amazon-web-services.php @@ -4,7 +4,7 @@ Plugin URI: http://wordpress.org/extend/plugins/amazon-web-services/ Description: Includes the Amazon Web Services PHP libraries, stores access keys, and allows other plugins to hook into it. Author: Delicious Brains -Version: 0.3.6 +Version: 0.3.7 Author URI: http://deliciousbrains.com/ Network: True Text Domain: amazon-web-services @@ -22,7 +22,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // ********************************************************************** -$GLOBALS['aws_meta']['amazon-web-services']['version'] = '0.3.6'; +$GLOBALS['aws_meta']['amazon-web-services']['version'] = '0.3.7'; $GLOBALS['aws_meta']['amazon-web-services']['supported_addon_versions'] = array( 'amazon-s3-and-cloudfront' => '0.9', diff --git a/classes/wp-aws-uninstall.php b/classes/wp-aws-uninstall.php deleted file mode 100644 index e9414a3..0000000 --- a/classes/wp-aws-uninstall.php +++ /dev/null @@ -1,263 +0,0 @@ - array(...), - * 'subsite' => array(...), - * ) - * - * By default, an array of transients will be treated as site wide. - * - */ - protected $transients; - - /** - * @var array|string User meta to be deleted - */ - protected $usermeta; - - /** - * @var array Blog(s) in site - */ - protected $blog_ids; - - /** - * WP_AWS_Uninstall constructor. - * - * @param array|string $options - * @param array|string $postmeta - * @param array|string $crons - * @param array|string $transients - * @param array|string $usermeta - */ - public function __construct( - $options = array(), - $postmeta = array(), - $crons = array(), - $transients = array(), - $usermeta = array() - ) { - $this->options = $this->maybe_convert_to_array( $options ); - $this->postmeta = $this->maybe_convert_to_array( $postmeta ); - $this->crons = $this->maybe_convert_to_array( $crons ); - $this->transients = $this->maybe_convert_to_array( $transients ); - $this->usermeta = $this->maybe_convert_to_array( $usermeta ); - - $this->set_blog_ids(); - - $this->delete_options(); - $this->delete_postmeta(); - $this->clear_crons(); - $this->delete_transients(); - $this->delete_usermeta(); - } - - /** - * Set the blog id(s) for a site - */ - private function set_blog_ids() { - $blog_ids = array( 1 ); - if ( function_exists( 'is_multisite' ) && is_multisite() ) { - $args = array( - 'limit' => false, - 'spam' => 0, - 'deleted' => 0, - 'archived' => 0, - ); - $blogs = wp_get_sites( $args ); - $blog_ids = wp_list_pluck( $blogs, 'blog_id' ); - } - - $this->blog_ids = $blog_ids; - } - - /** - * Is the current blog ID that specified in wp-config.php - * - * @param int $blog_id - * - * @return bool - */ - private function is_current_blog( $blog_id ) { - $default = defined( 'BLOG_ID_CURRENT_SITE' ) ? BLOG_ID_CURRENT_SITE : 1; - - if ( $default === $blog_id ) { - return true; - } - - return false; - } - - /** - * Helper to ensure a value is an array - * - * @param array|string $data - * - * @return array - */ - private function maybe_convert_to_array( $data ) { - if ( ! is_array( $data ) ) { - // Convert a string to an array - $data = array( $data ); - } - - return $data; - } - - /** - * Delete site wide options - */ - public function delete_options() { - foreach ( $this->options as $option ) { - delete_site_option( $option ); - } - } - - /** - * Delete post meta data for all blogs - */ - public function delete_postmeta() { - global $wpdb; - - foreach ( $this->blog_ids as $blog_id ) { - $prefix = $wpdb->get_blog_prefix( $blog_id ); - - foreach ( $this->postmeta as $postmeta ) { - $sql = $wpdb->prepare( "DELETE FROM {$prefix}postmeta WHERE meta_key = %s", $postmeta ); - $wpdb->query( $sql ); - } - } - } - - /** - * Clear any scheduled cron jobs - */ - public function clear_crons() { - foreach ( $this->crons as $cron ) { - $timestamp = wp_next_scheduled( $cron ); - if ( $timestamp ) { - wp_unschedule_event( $timestamp, $cron ); - } - } - } - - /** - * Delete transients - */ - public function delete_transients() { - if ( ! isset( $this->transients['site'] ) && ! isset( $this->transients['subsite'] ) ) { - // Single array of site wide transients - foreach ( $this->transients as $transient ) { - delete_site_transient( $transient ); - } - - return; - } - - // Deal with site wide transients - if ( isset( $this->transients['site'] ) ) { - $site_transients = $this->maybe_convert_to_array( $this->transients['site'] ); - - foreach ( $site_transients as $transient ) { - delete_site_transient( $transient ); - } - } - - // Deal with subsite specific transients - if ( isset( $this->transients['subsite'] ) ) { - $subsite_transients = $this->maybe_convert_to_array( $this->transients['subsite'] ); - - foreach ( $this->blog_ids as $blog_id ) { - if ( is_multisite() && $blog_id !== get_current_blog_id() ) { - switch_to_blog( $blog_id ); - } - - foreach ( $subsite_transients as $transient ) { - delete_transient( $transient ); - } - - if ( is_multisite() ) { - restore_current_blog(); - } - } - } - } - - /** - * Delete user meta. - */ - public function delete_usermeta() { - global $wpdb; - - if ( empty( $this->usermeta ) ) { - return; - } - - // Loop through our user meta keys to create our WHERE clauses. - $where_array = array(); - foreach ( $this->usermeta as $usermeta ) { - $where_array[] = $wpdb->prepare( "meta_key = '%s'", $usermeta ); - } - - // Merge all WHERE clauses into an OR comparison. - $where_sql = implode( ' OR ', $where_array ); - - // Get any user ids that have keys to be deleted. - $user_ids = $wpdb->get_col( "SELECT DISTINCT user_id FROM {$wpdb->usermeta} WHERE {$where_sql}" ); - - // Bail if no user has keys to be deleted. - if ( empty( $user_ids ) ) { - return; - } - - // Loop through the list of users and delete our user meta. - foreach ( $user_ids as $user_id ) { - foreach ( $this->usermeta as $usermeta ) { - delete_user_meta( $user_id, $usermeta ); - } - } - } - } -} \ No newline at end of file diff --git a/languages/amazon-web-services-en.pot b/languages/amazon-web-services-en.pot index 3fef0a1..162d755 100644 --- a/languages/amazon-web-services-en.pot +++ b/languages/amazon-web-services-en.pot @@ -1,6 +1,6 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the amazon-web-services package. +# This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: amazon-web-services\n" "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n" -"POT-Creation-Date: 2016-05-30 12:44+0100\n" +"POT-Creation-Date: 2016-09-01 14:41+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,271 +17,271 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: builds/amazon-web-services/classes/amazon-web-services.php:51 -#: builds/amazon-web-services/classes/amazon-web-services.php:195 +#: classes/amazon-web-services.php:51 +#: classes/amazon-web-services.php:195 msgid "Amazon Web Services" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:52 +#: classes/amazon-web-services.php:52 msgid "AWS" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:75 +#: classes/amazon-web-services.php:75 msgid "Addons" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:83 -#: builds/amazon-web-services/classes/amazon-web-services.php:349 -#: builds/amazon-web-services/view/settings.php:14 +#: classes/amazon-web-services.php:83 +#: classes/amazon-web-services.php:349 +#: view/settings.php:14 msgid "Access Keys" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:153 +#: classes/amazon-web-services.php:153 msgid "Cheatin' eh?" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:204 +#: classes/amazon-web-services.php:204 msgid "Amazon Web Services: Addons" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:297 +#: classes/amazon-web-services.php:297 #, php-format msgid "" "You must first set your AWS access keys to use this addon." msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:362 +#: classes/amazon-web-services.php:362 msgid "WP Offload S3 Lite" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:367 +#: classes/amazon-web-services.php:367 msgid "WP Offload S3" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:371 +#: classes/amazon-web-services.php:371 msgid "Assets" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:373 +#: classes/amazon-web-services.php:373 msgid "Feature" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:377 +#: classes/amazon-web-services.php:377 msgid "WooCommerce" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:379 -#: builds/amazon-web-services/classes/amazon-web-services.php:386 -#: builds/amazon-web-services/classes/amazon-web-services.php:393 -#: builds/amazon-web-services/classes/amazon-web-services.php:400 -#: builds/amazon-web-services/classes/amazon-web-services.php:407 -#: builds/amazon-web-services/classes/amazon-web-services.php:414 +#: classes/amazon-web-services.php:379 +#: classes/amazon-web-services.php:386 +#: classes/amazon-web-services.php:393 +#: classes/amazon-web-services.php:400 +#: classes/amazon-web-services.php:407 +#: classes/amazon-web-services.php:414 msgid "Integration" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:384 +#: classes/amazon-web-services.php:384 msgid "Easy Digital Downloads" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:391 +#: classes/amazon-web-services.php:391 msgid "WPML" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:398 +#: classes/amazon-web-services.php:398 msgid "Meta Slider" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:405 +#: classes/amazon-web-services.php:405 msgid "Enable Media Replace" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:412 +#: classes/amazon-web-services.php:412 msgid "ACF Image Crop" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:461 +#: classes/amazon-web-services.php:461 msgctxt "Plugin already installed and activated" msgid "Installed & Activated" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:463 +#: classes/amazon-web-services.php:463 msgctxt "Plugin already installed" msgid "Installed" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:464 +#: classes/amazon-web-services.php:464 msgctxt "Activate plugin now" msgid "Activate Now" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:467 +#: classes/amazon-web-services.php:467 msgctxt "Install plugin now" msgid "Install Now" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:503 +#: classes/amazon-web-services.php:503 msgid "Visit Site" msgstr "" -#: builds/amazon-web-services/classes/amazon-web-services.php:506 +#: classes/amazon-web-services.php:506 msgctxt "View plugin details" msgid "View Details" msgstr "" -#: builds/amazon-web-services/classes/aws-compatibility-check.php:25 +#: classes/aws-compatibility-check.php:25 msgid "a PHP version less than 5.3.3" msgstr "" -#: builds/amazon-web-services/classes/aws-compatibility-check.php:29 +#: classes/aws-compatibility-check.php:29 msgid "no PHP cURL library activated" msgstr "" -#: builds/amazon-web-services/classes/aws-compatibility-check.php:35 +#: classes/aws-compatibility-check.php:35 msgid "a cURL version less than 7.16.2" msgstr "" -#: builds/amazon-web-services/classes/aws-compatibility-check.php:50 +#: classes/aws-compatibility-check.php:50 msgid "cURL compiled without" msgstr "" -#: builds/amazon-web-services/classes/aws-compatibility-check.php:55 +#: classes/aws-compatibility-check.php:55 msgid "the function curl_multi_exec disabled" msgstr "" -#: builds/amazon-web-services/classes/aws-compatibility-check.php:73 +#: classes/aws-compatibility-check.php:73 msgid "" "The official Amazon Web Services SDK requires PHP 5.3.3+ and cURL " "7.16.2+ compiled with OpenSSL and zlib. Your server currently has" msgstr "" -#: builds/amazon-web-services/classes/aws-plugin-base.php:279 +#: classes/aws-plugin-base.php:279 msgid "Settings" msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:323 +#: classes/wp-aws-compatibility-check.php:323 msgid "deactivate" msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:324 +#: classes/wp-aws-compatibility-check.php:324 #, php-format msgid "You can %s the %s plugin to get rid of this notice." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:327 +#: classes/wp-aws-compatibility-check.php:327 #, php-format msgid "%s has been disabled as it requires the %s plugin." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:331 +#: classes/wp-aws-compatibility-check.php:331 msgid "which is currently disabled." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:333 +#: classes/wp-aws-compatibility-check.php:333 msgid "It appears to be installed already." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:335 +#: classes/wp-aws-compatibility-check.php:335 msgctxt "Activate plugin" msgid "Activate it now." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:342 +#: classes/wp-aws-compatibility-check.php:342 #, php-format msgid "Install and activate it." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:353 +#: classes/wp-aws-compatibility-check.php:353 #, php-format msgid "" "%s has been disabled as it requires version %s or later of the %s plugin." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:356 +#: classes/wp-aws-compatibility-check.php:356 #, php-format msgid "You currently have version %s installed." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:363 -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:401 +#: classes/wp-aws-compatibility-check.php:363 +#: classes/wp-aws-compatibility-check.php:401 #, php-format msgid "A valid license for %s is required to update." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:371 +#: classes/wp-aws-compatibility-check.php:371 msgid "Update to the latest version" msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:383 +#: classes/wp-aws-compatibility-check.php:383 #, php-format msgid "" "%1$s has been disabled because it is not a supported addon of the %2$s " "plugin." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:392 +#: classes/wp-aws-compatibility-check.php:392 #, php-format msgid "" "%1$s has been disabled because it will not work with the version of the %2$s " "plugin installed. %1$s %3$s or later is required." msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:395 +#: classes/wp-aws-compatibility-check.php:395 #, php-format msgid "Update %s to the latest version" msgstr "" -#: builds/amazon-web-services/classes/wp-aws-compatibility-check.php:464 +#: classes/wp-aws-compatibility-check.php:464 #, php-format msgid "The %s plugin has been deactivated." msgstr "" -#: builds/amazon-web-services/view/activation-error.php:5 +#: view/activation-error.php:5 msgid "Activation Error" msgstr "" -#: builds/amazon-web-services/view/settings.php:9 +#: view/settings.php:9 #, php-format msgid "" "Need help getting your Access Keys? Check out the Quick Start " "Guide →" msgstr "" -#: builds/amazon-web-services/view/settings.php:19 +#: view/settings.php:19 msgid "You have enabled the use of IAM roles for Amazon EC2 instances." msgstr "" -#: builds/amazon-web-services/view/settings.php:25 +#: view/settings.php:25 msgid "" "You’ve already defined your AWS access keys in your wp-config.php. If " "you’d prefer to manage them here and store them in the database (not " "recommended), simply remove the lines from your wp-config." msgstr "" -#: builds/amazon-web-services/view/settings.php:31 +#: view/settings.php:31 msgid "" "We recommend defining your Access Keys in wp-config.php so long as you " "don’t commit it to source control (you shouldn’t be). Simply " "copy the following snippet and replace the stars with the keys." msgstr "" -#: builds/amazon-web-services/view/settings.php:38 +#: view/settings.php:38 msgid "" "If you’d rather store your Access Keys in the database, click here to reveal a form." msgstr "" -#: builds/amazon-web-services/view/settings.php:54 +#: view/settings.php:54 msgid "Access Key ID:" msgstr "" -#: builds/amazon-web-services/view/settings.php:60 +#: view/settings.php:60 msgid "Secret Access Key:" msgstr "" -#: builds/amazon-web-services/view/settings.php:67 +#: view/settings.php:67 msgid "Save Changes" msgstr "" -#: builds/amazon-web-services/view/settings.php:70 +#: view/settings.php:70 msgid "Remove Keys" msgstr "" diff --git a/readme.txt b/readme.txt index 7716e3d..0bd996a 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: bradt, deliciousbrains Tags: amazon, amazon web services Requires at least: 4.4 -Tested up to: 4.5.2 -Stable tag: trunk +Tested up to: 4.6 +Stable tag: 0.3.7 License: GPLv3 Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins. @@ -33,6 +33,9 @@ This plugin is required by other plugins, which use its libraries and its settin == Changelog == += 0.3.7 - 2016-09-01 = +* Improvement: No longer delete plugin data on uninstall. Manual removal possible, as per this [doc](https://deliciousbrains.com/wp-offload-s3/doc/uninstall/). + = 0.3.6 - 2016-05-30 = * Improvement: Now checks that the `curl_multi_exec` function is available. diff --git a/uninstall.php b/uninstall.php deleted file mode 100644 index 8aafcd4..0000000 --- a/uninstall.php +++ /dev/null @@ -1,19 +0,0 @@ -