Skip to content

Commit

Permalink
Deploying version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
A5hleyRich committed Mar 8, 2016
1 parent 8983e77 commit deae952
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 10 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
**Requires at least:** 3.7
**Tested up to:** 4.4
**Stable tag:** 1.0
**Stable tag:** 1.0.1
**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 @@ -73,6 +73,10 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### WP Offload S3 Lite 1.0.1 - 2016-03-08 ###
* Bug fix: Fatal error on plugin activation
* Bug fix: Unable to activate Pro upgrade

### WP Offload S3 Lite 1.0 - 2016-03-07 ###
* New: Plugin renamed to "WP Offload S3 Lite"
* New: Define any and all settings with a constant in wp-config.php
Expand Down
40 changes: 36 additions & 4 deletions classes/as3cf-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,21 @@ public static function deactivate_other_instances( $plugin ) {
return false;
}

$plugin_to_deactivate = 'wordpress-s3.php';
$deactivated_notice_id = '1';
$plugin_to_deactivate = 'wordpress-s3.php';
$deactivated_notice_id = '1';
$activated_plugin_min_version = '1.1';
$plugin_to_deactivate_min_version = '1.0';
if ( basename( $plugin ) === $plugin_to_deactivate ) {
$plugin_to_deactivate = 'amazon-s3-and-cloudfront-pro.php';
$deactivated_notice_id = '2';
$plugin_to_deactivate = 'amazon-s3-and-cloudfront-pro.php';
$deactivated_notice_id = '2';
$activated_plugin_min_version = '1.0';
$plugin_to_deactivate_min_version = '1.1';
}

$version = self::get_plugin_version_from_basename( $plugin );

if ( version_compare( $version, $activated_plugin_min_version, '<' ) ) {
return false;
}

if ( is_multisite() ) {
Expand All @@ -53,6 +63,12 @@ public static function deactivate_other_instances( $plugin ) {

foreach ( $active_plugins as $basename ) {
if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
$version = self::get_plugin_version_from_basename( $basename );

if ( version_compare( $version, $plugin_to_deactivate_min_version, '<' ) ) {
return false;
}

set_transient( 'as3cf_deactivated_notice_id', $deactivated_notice_id, HOUR_IN_SECONDS );
deactivate_plugins( $basename );

Expand All @@ -62,5 +78,21 @@ public static function deactivate_other_instances( $plugin ) {

return false;
}

/**
* Get plugin data from basename
*
* @param string $basename
*
* @return string
*/
public static function get_plugin_version_from_basename( $basename ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';

$plugin_path = WP_PLUGIN_DIR . '/' . $basename;
$plugin_data = get_plugin_data( $plugin_path );

return $plugin_data['Version'];
}
}
}
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: 2016-03-07 16:48+0000\n"
"POT-Creation-Date: 2016-03-08 14:32+0000\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
9 changes: 8 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: bradt, deliciousbrains
Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
Requires at least: 3.7
Tested up to: 4.4
Stable tag: 1.0
Stable tag: 1.0.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 @@ -69,6 +69,13 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

== Changelog ==

= WP Offload S3 Lite 1.0.2 - 2016-03-08 =
* Bug fix: Uninstall would run even if pro plugin installed

= WP Offload S3 Lite 1.0.1 - 2016-03-08 =
* Bug fix: Fatal error on plugin activation
* Bug fix: Unable to activate Pro upgrade

= WP Offload S3 Lite 1.0 - 2016-03-07 =
* New: Plugin renamed to "WP Offload S3 Lite"
* New: Define any and all settings with a constant in wp-config.php
Expand Down
5 changes: 5 additions & 0 deletions uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
exit;
}

if ( 'amazon-s3-and-cloudfront/wordpress-s3.php' === WP_UNINSTALL_PLUGIN && file_exists( WP_PLUGIN_DIR . '/amazon-s3-and-cloudfront-pro/amazon-s3-and-cloudfront-pro.php' ) ) {
// Don't uninstall if the pro plugin is installed
return;
}

require dirname( __FILE__ ) . '/classes/wp-aws-uninstall.php';

$options = array(
Expand Down
7 changes: 4 additions & 3 deletions wordpress-s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
Description: Automatically copies media uploads to Amazon S3 for storage and delivery. Optionally configure Amazon CloudFront for even faster delivery.
Author: Delicious Brains
Version: 1.0
Version: 1.0.2
Author URI: http://deliciousbrains.com/
Network: True
Text Domain: amazon-s3-and-cloudfront
Expand All @@ -26,7 +26,7 @@
// Then completely rewritten.
*/

$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '1.0';
$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '1.0.2';

$aws_plugin_version_required = '0.3.5';

Expand All @@ -47,7 +47,8 @@

function as3cf_init( $aws ) {
global $as3cf_compat_check;
if ( $as3cf_compat_check->is_plugin_active( 'amazon-s3-and-cloudfront-pro/amazon-s3-and-cloudfront-pro.php' ) ) {

if ( method_exists( 'WP_AWS_Compatibility_Check', 'is_plugin_active' ) && $as3cf_compat_check->is_plugin_active( 'amazon-s3-and-cloudfront-pro/amazon-s3-and-cloudfront-pro.php' ) ) {
// Don't load if pro plugin installed
return;
}
Expand Down

0 comments on commit deae952

Please sign in to comment.