WP Offload S3 Lite - Version 2.2

Version Description

= 2.0 = This is a major upgrade that introduces support for DigitalOcean Spaces, renames the plugin to WP Offload Media Lite, and coincidentally upgrades some of its database settings. You may not be able to downgrade to WP Offload S3 Lite 1.x after upgrading to WP Offload Media Lite 2.0+.

= 1.1 = This is a major change, which ensures S3 URLs are no longer saved in post content. Instead, local URLs are filtered on page generation and replaced with the S3 version. If you depend on the S3 URLs being stored in post content you will need to make modifications to support this version.

= 0.6 = This version requires PHP 5.3.3+ and the Amazon Web Services plugin

Download this release

Release Info

Developer deliciousbrains
Plugin Icon 128x128 WP Offload S3 Lite
Version 2.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.2

README.md CHANGED
@@ -1,10 +1,10 @@
1
  # WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage #
2
  **Contributors:** bradt, deliciousbrains, ianmjones
3
  **Tags:** uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
- **Requires at least:** 4.7
5
  **Tested up to:** 5.2
6
  **Requires PHP:** 5.5
7
- **Stable tag:** 2.2-dev
8
  **License:** GPLv3
9
 
10
  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,13 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
86
 
87
  ## Changelog ##
88
 
 
 
 
 
 
 
 
89
  ### WP Offload Media Lite 2.1.1 - 2019-04-29 ###
90
  * New: Multisite domain mapping via WordPress MU Domain Mapping plugin is now supported
91
  * Improvement: Local to Provider content filtering performance improvements
1
  # WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage #
2
  **Contributors:** bradt, deliciousbrains, ianmjones
3
  **Tags:** uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
+ **Requires at least:** 4.9
5
  **Tested up to:** 5.2
6
  **Requires PHP:** 5.5
7
+ **Stable tag:** 2.2
8
  **License:** GPLv3
9
 
10
  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
 
87
  ## Changelog ##
88
 
89
+ ### WP Offload Media Lite 2.2 - 2019-06-10 ###
90
+ * [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)
91
+ * New: Use IAM Roles without having to update wp-config.php
92
+ * New: Frankfurt (FRA1) region now supported on DigitalOcean Spaces
93
+ * Improvement: WP dashboard performance
94
+ * Bug fix: Uploaded media files with uppercase extensions get second extension added
95
+
96
  ### WP Offload Media Lite 2.1.1 - 2019-04-29 ###
97
  * New: Multisite domain mapping via WordPress MU Domain Mapping plugin is now supported
98
  * Improvement: Local to Provider content filtering performance improvements
classes/amazon-s3-and-cloudfront.php CHANGED
@@ -1526,6 +1526,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
1526
 
1527
  // sanitize the file name before we begin processing
1528
  $filename = sanitize_file_name( $filename );
 
1529
  $name = wp_basename( $filename, $ext );
1530
 
1531
  // Edge case: if file is named '.ext', treat as an empty name.
@@ -1534,7 +1535,6 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
1534
  }
1535
 
1536
  // Rebuild filename with lowercase extension as provider will have converted extension on upload.
1537
- $ext = strtolower( $ext );
1538
  $filename = $name . $ext;
1539
  $time = current_time( 'mysql' );
1540
 
@@ -2925,6 +2925,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2925
  'secret-access-key',
2926
  'key-file-path',
2927
  'key-file',
 
2928
  'bucket',
2929
  'region',
2930
  'domain',
@@ -3011,7 +3012,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3011
  // If anything about the Provider has changed then we need to verify the bucket selection.
3012
  // Otherwise we can let the filter decide whether there is an action to take.
3013
  // Last implementer will win, but the above handlers take care of grouping things appropriately.
3014
- if ( in_array( $key, array( 'provider', 'access-key-id', 'secret-access-key', 'key-file' ) ) && ! $this->get_defined_setting( 'bucket', false ) ) {
3015
  $action = 'change-bucket';
3016
  break;
3017
  } else {
@@ -3189,6 +3190,10 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3189
  }
3190
  }
3191
 
 
 
 
 
3192
  $this->set_setting( $var, $value );
3193
 
3194
  // Some setting changes might have knock-on effects that require confirmation of secondary settings.
@@ -3713,14 +3718,14 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3713
  * Media
3714
  */
3715
 
3716
- $media_counts = $this->diagnostic_media_counts();
3717
 
3718
  $output .= 'Media Files: ';
3719
- $output .= number_format_i18n( $media_counts['all'] );
3720
  $output .= "\r\n";
3721
 
3722
  $output .= 'Offloaded Media Files: ';
3723
- $output .= number_format_i18n( $media_counts['s3'] );
3724
  $output .= "\r\n";
3725
 
3726
  $output .= 'Number of Image Sizes: ';
@@ -3815,9 +3820,9 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3815
  $output .= "\r\n";
3816
 
3817
  if ( $provider::use_server_roles_allowed() ) {
3818
- $output .= 'Use Server Role: ' . $this->on_off( $provider::use_server_roles() );
3819
  } else {
3820
- $output .= 'Use Server Role: N/A';
3821
  }
3822
  $output .= "\r\n";
3823
 
@@ -4273,70 +4278,80 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
4273
  }
4274
 
4275
  /**
4276
- * Count attachments on a site
4277
  *
4278
- * @param string $prefix
4279
- * @param null|bool $uploaded_to_provider
4280
- * null - All attachments
4281
- * true - Attachments only uploaded to provider
4282
- * false - Attachments not uploaded to provider
4283
- * @param bool $skip_transient Whether to force database query and skip transient, default false
4284
  *
4285
- * @return int
 
 
 
4286
  */
4287
- public function count_attachments( $prefix, $uploaded_to_provider = null, $skip_transient = false ) {
4288
  global $wpdb;
4289
 
4290
- $transient_key = 'as3cf_' . $prefix . '_media_count';
 
4291
 
4292
- $sql = "SELECT COUNT(DISTINCT p.ID)
4293
- FROM `{$prefix}posts` p";
4294
 
4295
- $where = "WHERE p.post_type = 'attachment'";
4296
-
4297
- if ( ! is_null( $uploaded_to_provider ) && is_bool( $uploaded_to_provider ) ) {
4298
- $sql .= " LEFT OUTER JOIN `{$prefix}postmeta` pm
4299
- ON p.`ID` = pm.`post_id`
4300
- AND pm.`meta_key` = 'amazonS3_info'";
4301
 
4302
- $operator = $uploaded_to_provider ? 'not ' : '';
4303
- $where .= " AND pm.`post_id` is {$operator}null";
 
 
 
 
 
4304
 
4305
- $transient_key .= ( $uploaded_to_provider ) ? '_offloaded' : 'not_offloaded';
4306
- }
4307
 
4308
- $sql .= ' ' . $where;
4309
 
4310
- if ( true === $skip_transient || false === ( $count = get_site_transient( $transient_key ) ) ) {
4311
- $count = (int) $wpdb->get_var( $sql );
4312
 
4313
- set_site_transient( $transient_key, $count, 2 * MINUTE_IN_SECONDS );
 
4314
  }
4315
 
4316
- return $count;
 
 
4317
  }
4318
 
4319
  /**
4320
- * Get the total attachment and total S3 attachment counts for the diagnostic log
 
 
 
4321
  *
4322
  * @return array
4323
  */
4324
- protected function diagnostic_media_counts() {
4325
- if ( false === ( $attachment_counts = get_site_transient( 'as3cf_attachment_counts' ) ) ) {
4326
- $table_prefixes = $this->get_all_blog_table_prefixes();
4327
- $all_media = 0;
4328
- $all_media_provider = 0;
 
4329
 
4330
  foreach ( $table_prefixes as $blog_id => $table_prefix ) {
4331
- $count = $this->count_attachments( $table_prefix );
4332
- $all_media += $count;
4333
- $provider_count = $this->count_attachments( $table_prefix, true );
4334
- $all_media_provider += $provider_count;
4335
  }
4336
 
4337
  $attachment_counts = array(
4338
- 'all' => $all_media,
4339
- 's3' => $all_media_provider,
 
4340
  );
4341
 
4342
  set_site_transient( 'as3cf_attachment_counts', $attachment_counts, 2 * MINUTE_IN_SECONDS );
1526
 
1527
  // sanitize the file name before we begin processing
1528
  $filename = sanitize_file_name( $filename );
1529
+ $ext = strtolower( $ext );
1530
  $name = wp_basename( $filename, $ext );
1531
 
1532
  // Edge case: if file is named '.ext', treat as an empty name.
1535
  }
1536
 
1537
  // Rebuild filename with lowercase extension as provider will have converted extension on upload.
 
1538
  $filename = $name . $ext;
1539
  $time = current_time( 'mysql' );
1540
 
2925
  'secret-access-key',
2926
  'key-file-path',
2927
  'key-file',
2928
+ 'use-server-roles',
2929
  'bucket',
2930
  'region',
2931
  'domain',
3012
  // If anything about the Provider has changed then we need to verify the bucket selection.
3013
  // Otherwise we can let the filter decide whether there is an action to take.
3014
  // Last implementer will win, but the above handlers take care of grouping things appropriately.
3015
+ if ( in_array( $key, array( 'provider', 'access-key-id', 'secret-access-key', 'key-file', 'use-server-roles' ) ) && ! $this->get_defined_setting( 'bucket', false ) ) {
3016
  $action = 'change-bucket';
3017
  break;
3018
  } else {
3190
  }
3191
  }
3192
 
3193
+ if ( 'use-server-roles' === $var && 'server-role' !== $_POST['authmethod'] ) {
3194
+ continue;
3195
+ }
3196
+
3197
  $this->set_setting( $var, $value );
3198
 
3199
  // Some setting changes might have knock-on effects that require confirmation of secondary settings.
3718
  * Media
3719
  */
3720
 
3721
+ $media_counts = $this->media_counts();
3722
 
3723
  $output .= 'Media Files: ';
3724
+ $output .= number_format_i18n( $media_counts['total'] );
3725
  $output .= "\r\n";
3726
 
3727
  $output .= 'Offloaded Media Files: ';
3728
+ $output .= number_format_i18n( $media_counts['offloaded'] );
3729
  $output .= "\r\n";
3730
 
3731
  $output .= 'Number of Image Sizes: ';
3820
  $output .= "\r\n";
3821
 
3822
  if ( $provider::use_server_roles_allowed() ) {
3823
+ $output .= 'Use Server Roles: ' . $this->on_off( $provider->use_server_roles() );
3824
  } else {
3825
+ $output .= 'Use Server Roles: N/A';
3826
  }
3827
  $output .= "\r\n";
3828
 
4278
  }
4279
 
4280
  /**
4281
+ * Count attachments on a site.
4282
  *
4283
+ * @param string $prefix
4284
+ * @param bool $skip_transient Whether to force database query and skip transient, default false
4285
+ * @param bool $force Whether to force database query and skip static cache, implies $skip_transient, default false
 
 
 
4286
  *
4287
+ * @return array Keys:
4288
+ * total: Total media count for site (prefix)
4289
+ * offloaded: Count of offloaded media for site (prefix)
4290
+ * not_offloaded: Difference between total and offloaded
4291
  */
4292
+ public function count_attachments( $prefix, $skip_transient = false, $force = false ) {
4293
  global $wpdb;
4294
 
4295
+ static $counts;
4296
+ static $skips;
4297
 
4298
+ $transient_key = 'as3cf_' . $prefix . '_attachment_counts';
 
4299
 
4300
+ // Been here, done it, won't do it again!
4301
+ // Well, unless this is the first transient skip for the prefix, then we need to do it.
4302
+ if ( ! $force && ! empty( $counts[ $transient_key ] ) && ( false === $skip_transient || ! empty( $skips[ $transient_key ] ) ) ) {
4303
+ return $counts[ $transient_key ];
4304
+ }
 
4305
 
4306
+ if ( $force || $skip_transient || false === ( $attachment_counts = get_site_transient( $transient_key ) ) ) {
4307
+ $sql = "
4308
+ SELECT COUNT(DISTINCT p.`ID`) total, COUNT(DISTINCT pm.`post_id`) offloaded
4309
+ FROM `{$prefix}posts` p
4310
+ LEFT OUTER JOIN `{$prefix}postmeta` pm ON p.`ID` = pm.`post_id` AND pm.`meta_key` = 'amazonS3_info'
4311
+ WHERE p.`post_type` = 'attachment'
4312
+ ";
4313
 
4314
+ $attachment_counts = $wpdb->get_row( $sql, ARRAY_A );
 
4315
 
4316
+ $attachment_counts['not_offloaded'] = $attachment_counts['total'] - $attachment_counts['offloaded'];
4317
 
4318
+ set_site_transient( $transient_key, $attachment_counts, 2 * MINUTE_IN_SECONDS );
 
4319
 
4320
+ // One way or another we've skipped the transient.
4321
+ $skips[ $transient_key ] = true;
4322
  }
4323
 
4324
+ $counts[ $transient_key ] = $attachment_counts;
4325
+
4326
+ return $attachment_counts;
4327
  }
4328
 
4329
  /**
4330
+ * Get the total attachment and total offloaded/not offloaded attachment counts
4331
+ *
4332
+ * @param bool $skip_transient Whether to force database query and skip transient, default false
4333
+ * @param bool $force Whether to force database query and skip static cache, implies $skip_transient, default false
4334
  *
4335
  * @return array
4336
  */
4337
+ public function media_counts( $skip_transient = false, $force = false ) {
4338
+ if ( $skip_transient || false === ( $attachment_counts = get_site_transient( 'as3cf_attachment_counts' ) ) ) {
4339
+ $table_prefixes = $this->get_all_blog_table_prefixes();
4340
+ $total = 0;
4341
+ $offloaded = 0;
4342
+ $not_offloaded = 0;
4343
 
4344
  foreach ( $table_prefixes as $blog_id => $table_prefix ) {
4345
+ $counts = $this->count_attachments( $table_prefix, $skip_transient, $force );
4346
+ $total += $counts['total'];
4347
+ $offloaded += $counts['offloaded'];
4348
+ $not_offloaded += $counts['not_offloaded'];
4349
  }
4350
 
4351
  $attachment_counts = array(
4352
+ 'total' => $total,
4353
+ 'offloaded' => $offloaded,
4354
+ 'not_offloaded' => $not_offloaded,
4355
  );
4356
 
4357
  set_site_transient( 'as3cf_attachment_counts', $attachment_counts, 2 * MINUTE_IN_SECONDS );
classes/as3cf-notices.php CHANGED
@@ -61,7 +61,7 @@ class AS3CF_Notices {
61
  */
62
  public function add_notice( $message, $args = array() ) {
63
  $defaults = array(
64
- 'type' => 'info',
65
  'dismissible' => true,
66
  'inline' => false,
67
  'flash' => true,
@@ -250,7 +250,7 @@ class AS3CF_Notices {
250
 
251
  $users = get_users( $args );
252
 
253
- foreach( $users as $user ) {
254
  $this->undismiss_notice_for_user( $notice_id, $user->ID );
255
  }
256
  }
@@ -464,7 +464,7 @@ class AS3CF_Notices {
464
  */
465
  protected function update_user_meta( $user_id, $key, $value ) {
466
  if ( empty( $value ) ) {
467
- delete_user_meta( $user_id, $key);
468
  } else {
469
  update_user_meta( $user_id, $key, $value );
470
  }
61
  */
62
  public function add_notice( $message, $args = array() ) {
63
  $defaults = array(
64
+ 'type' => 'notice-info',
65
  'dismissible' => true,
66
  'inline' => false,
67
  'flash' => true,
250
 
251
  $users = get_users( $args );
252
 
253
+ foreach ( $users as $user ) {
254
  $this->undismiss_notice_for_user( $notice_id, $user->ID );
255
  }
256
  }
464
  */
465
  protected function update_user_meta( $user_id, $key, $value ) {
466
  if ( empty( $value ) ) {
467
+ delete_user_meta( $user_id, $key );
468
  } else {
469
  update_user_meta( $user_id, $key, $value );
470
  }
classes/providers/digitalocean-provider.php CHANGED
@@ -79,6 +79,7 @@ class DigitalOcean_Provider extends AWS_Provider {
79
  'ams3' => 'Amsterdam',
80
  'sgp1' => 'Singapore',
81
  'sfo2' => 'San Francisco',
 
82
  );
83
 
84
  /**
79
  'ams3' => 'Amsterdam',
80
  'sgp1' => 'Singapore',
81
  'sfo2' => 'San Francisco',
82
+ 'fra1' => 'Frankfurt',
83
  );
84
 
85
  /**
classes/providers/provider.php CHANGED
@@ -77,6 +77,11 @@ abstract class Provider {
77
  */
78
  protected static $secret_access_key_setting_name = 'secret-access-key';
79
 
 
 
 
 
 
80
  /**
81
  * @var string
82
  */
@@ -218,7 +223,7 @@ abstract class Provider {
218
  * @return bool
219
  */
220
  public function needs_access_keys() {
221
- if ( static::use_server_roles() ) {
222
  return false;
223
  }
224
 
@@ -313,7 +318,7 @@ abstract class Provider {
313
  *
314
  * @return string
315
  */
316
- public static function preferred_use_server_role_constant() {
317
  if ( static::use_server_roles_allowed() ) {
318
  return static::$use_server_roles_constants[0];
319
  } else {
@@ -328,22 +333,26 @@ abstract class Provider {
328
  *
329
  * @return bool
330
  */
331
- public static function use_server_roles() {
332
  if ( ! static::use_server_roles_allowed() ) {
333
  return false;
334
  }
335
 
336
- $constant = static::use_server_role_constant();
 
337
 
338
- return $constant && constant( $constant );
 
 
 
339
  }
340
 
341
  /**
342
- * Get the constant used to enable the use of EC2 IAM roles.
343
  *
344
  * @return string|false Constant name if defined, otherwise false
345
  */
346
- public static function use_server_role_constant() {
347
  return AS3CF_Utils::get_first_defined_constant( static::$use_server_roles_constants );
348
  }
349
 
@@ -572,7 +581,7 @@ abstract class Provider {
572
 
573
  if ( is_null( $this->client ) ) {
574
  // There's no extra client authentication config required when using server roles.
575
- if ( ! static::use_server_roles() ) {
576
  // Some providers can supply Key File contents or Key File Path.
577
  if ( static::use_key_file() ) {
578
  // Key File contents take precedence over Key File Path.
77
  */
78
  protected static $secret_access_key_setting_name = 'secret-access-key';
79
 
80
+ /**
81
+ * @var string
82
+ */
83
+ protected static $use_server_roles_setting_name = 'use-server-roles';
84
+
85
  /**
86
  * @var string
87
  */
223
  * @return bool
224
  */
225
  public function needs_access_keys() {
226
+ if ( $this->use_server_roles() ) {
227
  return false;
228
  }
229
 
318
  *
319
  * @return string
320
  */
321
+ public static function preferred_use_server_roles_constant() {
322
  if ( static::use_server_roles_allowed() ) {
323
  return static::$use_server_roles_constants[0];
324
  } else {
333
  *
334
  * @return bool
335
  */
336
+ public function use_server_roles() {
337
  if ( ! static::use_server_roles_allowed() ) {
338
  return false;
339
  }
340
 
341
+ if ( static::use_server_roles_constant() ) {
342
+ $constant = static::use_server_roles_constant();
343
 
344
+ return $constant ? constant( $constant ) : false;
345
+ }
346
+
347
+ return $this->as3cf->get_core_setting( static::$use_server_roles_setting_name, false );
348
  }
349
 
350
  /**
351
+ * Get the constant used to enable the use of IAM roles.
352
  *
353
  * @return string|false Constant name if defined, otherwise false
354
  */
355
+ public static function use_server_roles_constant() {
356
  return AS3CF_Utils::get_first_defined_constant( static::$use_server_roles_constants );
357
  }
358
 
581
 
582
  if ( is_null( $this->client ) ) {
583
  // There's no extra client authentication config required when using server roles.
584
+ if ( ! $this->use_server_roles() ) {
585
  // Some providers can supply Key File contents or Key File Path.
586
  if ( static::use_key_file() ) {
587
  // Key File contents take precedence over Key File Path.
classes/upgrades/upgrade.php CHANGED
@@ -298,7 +298,6 @@ abstract class Upgrade {
298
  break;
299
  }
300
  } while ( $blog_id = $this->next_blog_id() );
301
-
302
  } catch ( No_More_Blogs_Exception $e ) {
303
  /*
304
  * The upgrade is complete when there are no more blogs left to finish.
@@ -322,10 +321,10 @@ abstract class Upgrade {
322
  /**
323
  * Upgrade the current blog.
324
  *
325
- * @throws Too_Many_Errors_Exception
326
  * @throws Batch_Limits_Exceeded_Exception
327
  *
328
- * @return bool true if all items for the blog were upgraded, otherwise false.
329
  */
330
  protected function upgrade_blog() {
331
  $total = $this->count_items_to_process();
@@ -358,9 +357,9 @@ abstract class Upgrade {
358
  /**
359
  * Get the next sequential blog ID if there is one.
360
  *
 
361
  * @throws No_More_Blogs_Exception
362
  *
363
- * @return int
364
  */
365
  protected function next_blog_id() {
366
  $blog_id = $this->blog_id ?: $this->last_blog_id;
@@ -371,7 +370,6 @@ abstract class Upgrade {
371
  if ( $blog_id < 1 ) {
372
  throw new No_More_Blogs_Exception;
373
  }
374
-
375
  } while ( ! $this->is_blog_processable( $blog_id ) );
376
 
377
  return $blog_id;
@@ -505,16 +503,16 @@ abstract class Upgrade {
505
  } else {
506
  // Set up any per-site state
507
  $this->switch_to_blog( get_current_blog_id() );
508
- $total_items = $this->as3cf->count_attachments( $this->blog_prefix );
509
 
510
  // If there are no attachments, disable progress calculation
511
  // and protect against division by zero.
512
- if ( ! $total_items ) {
513
  return false;
514
  }
515
 
516
  $remaining = $this->count_items_to_process();
517
- $decimal = ( $total_items - $remaining ) / $total_items;
518
  }
519
 
520
  return round( $decimal * 100, 2 );
298
  break;
299
  }
300
  } while ( $blog_id = $this->next_blog_id() );
 
301
  } catch ( No_More_Blogs_Exception $e ) {
302
  /*
303
  * The upgrade is complete when there are no more blogs left to finish.
321
  /**
322
  * Upgrade the current blog.
323
  *
324
+ * @return bool true if all items for the blog were upgraded, otherwise false.
325
  * @throws Batch_Limits_Exceeded_Exception
326
  *
327
+ * @throws Too_Many_Errors_Exception
328
  */
329
  protected function upgrade_blog() {
330
  $total = $this->count_items_to_process();
357
  /**
358
  * Get the next sequential blog ID if there is one.
359
  *
360
+ * @return int
361
  * @throws No_More_Blogs_Exception
362
  *
 
363
  */
364
  protected function next_blog_id() {
365
  $blog_id = $this->blog_id ?: $this->last_blog_id;
370
  if ( $blog_id < 1 ) {
371
  throw new No_More_Blogs_Exception;
372
  }
 
373
  } while ( ! $this->is_blog_processable( $blog_id ) );
374
 
375
  return $blog_id;
503
  } else {
504
  // Set up any per-site state
505
  $this->switch_to_blog( get_current_blog_id() );
506
+ $counts = $this->as3cf->count_attachments( $this->blog_prefix );
507
 
508
  // If there are no attachments, disable progress calculation
509
  // and protect against division by zero.
510
+ if ( ! $counts['total'] ) {
511
  return false;
512
  }
513
 
514
  $remaining = $this->count_items_to_process();
515
+ $decimal = ( $counts['total'] - $remaining ) / $counts['total'];
516
  }
517
 
518
  return round( $decimal * 100, 2 );
languages/amazon-s3-and-cloudfront-en.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: amazon-s3-and-cloudfront\n"
10
  "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
- "POT-Creation-Date: 2019-04-29 10:28+0100\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -29,7 +29,7 @@ msgstr ""
29
 
30
  #: classes/amazon-s3-and-cloudfront.php:345
31
  #: view/bucket-setting.php:17
32
- #: view/provider-select.php:108
33
  msgid "defined in wp-config.php"
34
  msgstr ""
35
 
@@ -135,59 +135,59 @@ msgid "-- not shown --"
135
  msgstr ""
136
 
137
  #: classes/amazon-s3-and-cloudfront.php:2891
138
- #: classes/amazon-s3-and-cloudfront.php:4913
139
  msgid "Settings saved."
140
  msgstr ""
141
 
142
- #: classes/amazon-s3-and-cloudfront.php:2980
143
  msgid "Cheatin' eh?"
144
  msgstr ""
145
 
146
- #: classes/amazon-s3-and-cloudfront.php:3064
147
  msgid "No bucket name provided."
148
  msgstr ""
149
 
150
- #: classes/amazon-s3-and-cloudfront.php:3073
151
  msgid "Bucket name not valid."
152
  msgstr ""
153
 
154
- #: classes/amazon-s3-and-cloudfront.php:3086
155
  msgid "No region provided."
156
  msgstr ""
157
 
158
- #: classes/amazon-s3-and-cloudfront.php:3163
159
- #: view/provider-select.php:314
160
  msgctxt "placeholder for hidden secret access key, 39 char max"
161
  msgid "-- not shown --"
162
  msgstr ""
163
 
164
- #: classes/amazon-s3-and-cloudfront.php:3186
165
  msgid "Key File not valid JSON."
166
  msgstr ""
167
 
168
- #: classes/amazon-s3-and-cloudfront.php:3228
169
  msgctxt "Show the media library tab"
170
  msgid "Media Library"
171
  msgstr ""
172
 
173
- #: classes/amazon-s3-and-cloudfront.php:3229
174
  msgctxt "Show the addons tab"
175
  msgid "Addons"
176
  msgstr ""
177
 
178
- #: classes/amazon-s3-and-cloudfront.php:3230
179
  msgctxt "Show the support tab"
180
  msgid "Support"
181
  msgstr ""
182
 
183
- #: classes/amazon-s3-and-cloudfront.php:3450
184
  #, php-format
185
  msgid ""
186
  "<strong>WP Offload Media</strong> &mdash; The file %s has been given %s "
187
  "permissions in the bucket."
188
  msgstr ""
189
 
190
- #: classes/amazon-s3-and-cloudfront.php:3469
191
  msgid ""
192
  "<strong>WP Offload Media Requirement Missing</strong> &mdash; Looks like you "
193
  "don't have an image manipulation library installed on this server and "
@@ -195,18 +195,18 @@ msgid ""
195
  "Please setup GD or ImageMagick."
196
  msgstr ""
197
 
198
- #: classes/amazon-s3-and-cloudfront.php:4182
199
  #, php-format
200
  msgid ""
201
  "<a href=\"%s\">Define your access keys</a> to enable write access to the "
202
  "bucket"
203
  msgstr ""
204
 
205
- #: classes/amazon-s3-and-cloudfront.php:4189
206
  msgid "Quick Start Guide"
207
  msgstr ""
208
 
209
- #: classes/amazon-s3-and-cloudfront.php:4191
210
  #, php-format
211
  msgid ""
212
  "Looks like we don't have write access to this bucket. It's likely that the "
@@ -215,7 +215,7 @@ msgid ""
215
  "correctly."
216
  msgstr ""
217
 
218
- #: classes/amazon-s3-and-cloudfront.php:4193
219
  #, php-format
220
  msgid ""
221
  "Looks like we don't have access to the buckets. It's likely that the user "
@@ -223,39 +223,39 @@ msgid ""
223
  "Please see our %s for instructions on setting up permissions correctly."
224
  msgstr ""
225
 
226
- #: classes/amazon-s3-and-cloudfront.php:4354
227
  msgid "WP Offload Media Activation"
228
  msgstr ""
229
 
230
- #: classes/amazon-s3-and-cloudfront.php:4355
231
  msgid ""
232
  "WP Offload Media Lite and WP Offload Media cannot both be active. We've "
233
  "automatically deactivated WP Offload Media Lite."
234
  msgstr ""
235
 
236
- #: classes/amazon-s3-and-cloudfront.php:4357
237
  msgid "WP Offload Media Lite Activation"
238
  msgstr ""
239
 
240
- #: classes/amazon-s3-and-cloudfront.php:4358
241
  msgid ""
242
  "WP Offload Media Lite and WP Offload Media cannot both be active. We've "
243
  "automatically deactivated WP Offload Media."
244
  msgstr ""
245
 
246
- #: classes/amazon-s3-and-cloudfront.php:4410
247
  msgid "More&nbsp;info&nbsp;&raquo;"
248
  msgstr ""
249
 
250
- #: classes/amazon-s3-and-cloudfront.php:4505
251
  msgid "this doc"
252
  msgstr ""
253
 
254
- #: classes/amazon-s3-and-cloudfront.php:4507
255
  msgid "WP Offload Media Feature Removed"
256
  msgstr ""
257
 
258
- #: classes/amazon-s3-and-cloudfront.php:4508
259
  #, php-format
260
  msgid ""
261
  "You had the \"Always non-SSL\" option selected in your settings, but we've "
@@ -266,59 +266,59 @@ msgid ""
266
  "to the old behavior."
267
  msgstr ""
268
 
269
- #: classes/amazon-s3-and-cloudfront.php:4538
270
  msgid "Offload"
271
  msgstr ""
272
 
273
- #: classes/amazon-s3-and-cloudfront.php:4646
274
  msgctxt "Storage provider key name"
275
  msgid "Storage Provider"
276
  msgstr ""
277
 
278
- #: classes/amazon-s3-and-cloudfront.php:4647
279
  msgctxt "Storage provider name"
280
  msgid "Storage Provider"
281
  msgstr ""
282
 
283
- #: classes/amazon-s3-and-cloudfront.php:4648
284
  msgctxt "Bucket name"
285
  msgid "Bucket"
286
  msgstr ""
287
 
288
- #: classes/amazon-s3-and-cloudfront.php:4649
289
  msgctxt "Path to file in bucket"
290
  msgid "Path"
291
  msgstr ""
292
 
293
- #: classes/amazon-s3-and-cloudfront.php:4650
294
  msgctxt "Location of bucket"
295
  msgid "Region"
296
  msgstr ""
297
 
298
- #: classes/amazon-s3-and-cloudfront.php:4651
299
  msgctxt "Access control list of the file in bucket"
300
  msgid "Access"
301
  msgstr ""
302
 
303
- #: classes/amazon-s3-and-cloudfront.php:4652
304
  msgid "URL"
305
  msgstr ""
306
 
307
- #: classes/amazon-s3-and-cloudfront.php:4876
308
  msgid "Assets Pull"
309
  msgstr ""
310
 
311
- #: classes/amazon-s3-and-cloudfront.php:4877
312
  msgid ""
313
  "An addon for WP Offload Media to serve your site's JS, CSS, and other "
314
  "enqueued assets from Amazon CloudFront or another CDN."
315
  msgstr ""
316
 
317
- #: classes/amazon-s3-and-cloudfront.php:4881
318
  msgid "Feature"
319
  msgstr ""
320
 
321
- #: classes/amazon-s3-and-cloudfront.php:4927
322
  #, php-format
323
  msgid ""
324
  "<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of "
@@ -329,7 +329,7 @@ msgid ""
329
  "plugin, it should be safe to deactivate and delete it. %2$s"
330
  msgstr ""
331
 
332
- #: classes/amazon-s3-and-cloudfront.php:4959
333
  #, php-format
334
  msgid ""
335
  "<strong>WP Offload Media Settings Moved</strong> &mdash; You now define your "
@@ -482,20 +482,20 @@ msgid ""
482
  "Offload Media will require PHP %2$s or later. %3$s"
483
  msgstr ""
484
 
485
- #: classes/providers/provider.php:434
486
  msgid "Given Key File Path is invalid or could not be accessed."
487
  msgstr ""
488
 
489
- #: classes/providers/provider.php:444
490
- #: classes/providers/provider.php:449
491
  msgid "Could not read Key File Path's contents."
492
  msgstr ""
493
 
494
- #: classes/providers/provider.php:457
495
  msgid "Given Key File Path does not contain valid JSON."
496
  msgstr ""
497
 
498
- #: classes/providers/provider.php:570
499
  #, php-format
500
  msgid "You must first <a href=\"%s\">set your access keys</a>."
501
  msgstr ""
@@ -569,19 +569,19 @@ msgid ""
569
  "version."
570
  msgstr ""
571
 
572
- #: classes/upgrades/upgrade.php:405
573
  msgid "Pause Update"
574
  msgstr ""
575
 
576
- #: classes/upgrades/upgrade.php:413
577
  msgid "Restart Update"
578
  msgstr ""
579
 
580
- #: classes/upgrades/upgrade.php:417
581
  msgid "Try Run It Again"
582
  msgstr ""
583
 
584
- #: classes/upgrades/upgrade.php:440
585
  #, php-format
586
  msgid ""
587
  "<strong>Running %1$s Update%2$s</strong> &mdash; We&#8217;re going through "
@@ -591,14 +591,14 @@ msgid ""
591
  "performance."
592
  msgstr ""
593
 
594
- #: classes/upgrades/upgrade.php:454
595
  #, php-format
596
  msgid ""
597
  "<strong>%1$s Update Paused%2$s</strong> &mdash; Updating Media Library %3$s "
598
  "has been paused."
599
  msgstr ""
600
 
601
- #: classes/upgrades/upgrade.php:467
602
  #, php-format
603
  msgid ""
604
  "<strong>Error Updating %1$s</strong> &mdash; We ran into some errors "
@@ -606,12 +606,12 @@ msgid ""
606
  "been offloaded. Please check your error log for details. (#%3$d)"
607
  msgstr ""
608
 
609
- #: classes/upgrades/upgrade.php:491
610
  #, php-format
611
  msgid " (%s%% Complete)"
612
  msgstr ""
613
 
614
- #: classes/upgrades/upgrade.php:625
615
  #, php-format
616
  msgid "Every %d Minutes"
617
  msgstr ""
@@ -653,7 +653,7 @@ msgid "File exists on server"
653
  msgstr ""
654
 
655
  #: view/bucket-select.php:38
656
- #: view/provider-select.php:19
657
  msgid "&laquo;&nbsp;Back"
658
  msgstr ""
659
 
@@ -820,22 +820,22 @@ msgstr ""
820
  msgid "Show"
821
  msgstr ""
822
 
823
- #: view/provider-select.php:22
824
  msgid "Storage Provider"
825
  msgstr ""
826
 
827
- #: view/provider-select.php:125
828
  #, php-format
829
  msgid ""
830
  "<strong>Warning:</strong> You have %s offloaded Media Library items, you "
831
  "should remove them from the bucket before changing storage provider."
832
  msgstr ""
833
 
834
- #: view/provider-select.php:148
835
  msgid "Define access keys in wp-config.php"
836
  msgstr ""
837
 
838
- #: view/provider-select.php:157
839
  #, php-format
840
  msgctxt "Access Keys defined in multiple defines."
841
  msgid ""
@@ -844,7 +844,7 @@ msgid ""
844
  "config.php."
845
  msgstr ""
846
 
847
- #: view/provider-select.php:159
848
  #, php-format
849
  msgctxt "Access Keys defined in single define."
850
  msgid ""
@@ -853,29 +853,30 @@ msgid ""
853
  "config.php."
854
  msgstr ""
855
 
856
- #: view/provider-select.php:161
857
- #: view/provider-select.php:211
 
858
  msgctxt "joins multiple define keys in notice"
859
  msgid " & "
860
  msgstr ""
861
 
862
- #: view/provider-select.php:170
863
  msgid ""
864
  "Please check your wp-config.php file as it looks like one of your access key "
865
  "defines is missing or incorrect."
866
  msgstr ""
867
 
868
- #: view/provider-select.php:176
869
  msgid ""
870
  "Copy the following snippet <strong>near the top</strong> of your wp-config."
871
  "php and replace the stars with the keys."
872
  msgstr ""
873
 
874
- #: view/provider-select.php:202
875
  msgid "Define key file path in wp-config.php"
876
  msgstr ""
877
 
878
- #: view/provider-select.php:210
879
  #, php-format
880
  msgctxt "Key file path defined in single define."
881
  msgid ""
@@ -884,72 +885,72 @@ msgid ""
884
  "your wp-config.php."
885
  msgstr ""
886
 
887
- #: view/provider-select.php:216
888
  msgid ""
889
  "Copy the following snippet <strong>near the top</strong> of your wp-config."
890
  "php and replace \"<strong>/path/to/key/file.json</strong>\"."
891
  msgstr ""
892
 
893
- #: view/provider-select.php:245
894
  #, php-format
895
  msgid "My server is on %s and I'd like to use IAM Roles"
896
  msgstr ""
897
 
898
- #: view/provider-select.php:252
899
  #, php-format
 
900
  msgid ""
901
- "You've defined the '%1$s' constant in your wp-config.php. To select a "
902
- "different option here, simply comment out or remove the define in your wp-"
903
- "config.php."
904
  msgstr ""
905
 
906
- #: view/provider-select.php:255
907
  #, php-format
908
  msgid ""
909
- "If you host your WordPress site on %s you should make use of IAM Roles. To "
910
- "tell WP Offload Media you're using IAM Roles, copy the following snippet "
911
- "<strong>near the top</strong> of your wp-config.php."
912
  msgstr ""
913
 
914
- #: view/provider-select.php:281
915
  msgid ""
916
  "I understand the risks but I'd like to store access keys in the database "
917
  "anyway (not recommended)"
918
  msgstr ""
919
 
920
- #: view/provider-select.php:288
921
  msgid ""
922
  "Storing your access keys in the database is less secure than the options "
923
  "above, but if you're ok with that, go ahead and enter your keys in the form "
924
  "below."
925
  msgstr ""
926
 
927
- #: view/provider-select.php:293
928
  msgid "Access Key ID"
929
  msgstr ""
930
 
931
- #: view/provider-select.php:308
932
  msgid "Secret Access Key"
933
  msgstr ""
934
 
935
- #: view/provider-select.php:335
936
  msgid ""
937
  "I understand the risks but I'd like to store the key file's contents in the "
938
  "database anyway (not recommended)"
939
  msgstr ""
940
 
941
- #: view/provider-select.php:342
942
  msgid ""
943
  "Storing your key file's contents in the database is less secure than the "
944
  "options above, but if you're ok with that, go ahead and enter your key "
945
  "file's JSON data in the field below."
946
  msgstr ""
947
 
948
- #: view/provider-select.php:358
949
  msgid "Next"
950
  msgstr ""
951
 
952
- #: view/provider-select.php:358
953
  #: view/settings/media.php:261
954
  msgid "Save Changes"
955
  msgstr ""
8
  msgstr ""
9
  "Project-Id-Version: amazon-s3-and-cloudfront\n"
10
  "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
+ "POT-Creation-Date: 2019-06-11 14:00+0100\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
29
 
30
  #: classes/amazon-s3-and-cloudfront.php:345
31
  #: view/bucket-setting.php:17
32
+ #: view/provider-select.php:122
33
  msgid "defined in wp-config.php"
34
  msgstr ""
35
 
135
  msgstr ""
136
 
137
  #: classes/amazon-s3-and-cloudfront.php:2891
138
+ #: classes/amazon-s3-and-cloudfront.php:4928
139
  msgid "Settings saved."
140
  msgstr ""
141
 
142
+ #: classes/amazon-s3-and-cloudfront.php:2981
143
  msgid "Cheatin' eh?"
144
  msgstr ""
145
 
146
+ #: classes/amazon-s3-and-cloudfront.php:3065
147
  msgid "No bucket name provided."
148
  msgstr ""
149
 
150
+ #: classes/amazon-s3-and-cloudfront.php:3074
151
  msgid "Bucket name not valid."
152
  msgstr ""
153
 
154
+ #: classes/amazon-s3-and-cloudfront.php:3087
155
  msgid "No region provided."
156
  msgstr ""
157
 
158
+ #: classes/amazon-s3-and-cloudfront.php:3164
159
+ #: view/provider-select.php:329
160
  msgctxt "placeholder for hidden secret access key, 39 char max"
161
  msgid "-- not shown --"
162
  msgstr ""
163
 
164
+ #: classes/amazon-s3-and-cloudfront.php:3187
165
  msgid "Key File not valid JSON."
166
  msgstr ""
167
 
168
+ #: classes/amazon-s3-and-cloudfront.php:3233
169
  msgctxt "Show the media library tab"
170
  msgid "Media Library"
171
  msgstr ""
172
 
173
+ #: classes/amazon-s3-and-cloudfront.php:3234
174
  msgctxt "Show the addons tab"
175
  msgid "Addons"
176
  msgstr ""
177
 
178
+ #: classes/amazon-s3-and-cloudfront.php:3235
179
  msgctxt "Show the support tab"
180
  msgid "Support"
181
  msgstr ""
182
 
183
+ #: classes/amazon-s3-and-cloudfront.php:3455
184
  #, php-format
185
  msgid ""
186
  "<strong>WP Offload Media</strong> &mdash; The file %s has been given %s "
187
  "permissions in the bucket."
188
  msgstr ""
189
 
190
+ #: classes/amazon-s3-and-cloudfront.php:3474
191
  msgid ""
192
  "<strong>WP Offload Media Requirement Missing</strong> &mdash; Looks like you "
193
  "don't have an image manipulation library installed on this server and "
195
  "Please setup GD or ImageMagick."
196
  msgstr ""
197
 
198
+ #: classes/amazon-s3-and-cloudfront.php:4187
199
  #, php-format
200
  msgid ""
201
  "<a href=\"%s\">Define your access keys</a> to enable write access to the "
202
  "bucket"
203
  msgstr ""
204
 
205
+ #: classes/amazon-s3-and-cloudfront.php:4194
206
  msgid "Quick Start Guide"
207
  msgstr ""
208
 
209
+ #: classes/amazon-s3-and-cloudfront.php:4196
210
  #, php-format
211
  msgid ""
212
  "Looks like we don't have write access to this bucket. It's likely that the "
215
  "correctly."
216
  msgstr ""
217
 
218
+ #: classes/amazon-s3-and-cloudfront.php:4198
219
  #, php-format
220
  msgid ""
221
  "Looks like we don't have access to the buckets. It's likely that the user "
223
  "Please see our %s for instructions on setting up permissions correctly."
224
  msgstr ""
225
 
226
+ #: classes/amazon-s3-and-cloudfront.php:4369
227
  msgid "WP Offload Media Activation"
228
  msgstr ""
229
 
230
+ #: classes/amazon-s3-and-cloudfront.php:4370
231
  msgid ""
232
  "WP Offload Media Lite and WP Offload Media cannot both be active. We've "
233
  "automatically deactivated WP Offload Media Lite."
234
  msgstr ""
235
 
236
+ #: classes/amazon-s3-and-cloudfront.php:4372
237
  msgid "WP Offload Media Lite Activation"
238
  msgstr ""
239
 
240
+ #: classes/amazon-s3-and-cloudfront.php:4373
241
  msgid ""
242
  "WP Offload Media Lite and WP Offload Media cannot both be active. We've "
243
  "automatically deactivated WP Offload Media."
244
  msgstr ""
245
 
246
+ #: classes/amazon-s3-and-cloudfront.php:4425
247
  msgid "More&nbsp;info&nbsp;&raquo;"
248
  msgstr ""
249
 
250
+ #: classes/amazon-s3-and-cloudfront.php:4520
251
  msgid "this doc"
252
  msgstr ""
253
 
254
+ #: classes/amazon-s3-and-cloudfront.php:4522
255
  msgid "WP Offload Media Feature Removed"
256
  msgstr ""
257
 
258
+ #: classes/amazon-s3-and-cloudfront.php:4523
259
  #, php-format
260
  msgid ""
261
  "You had the \"Always non-SSL\" option selected in your settings, but we've "
266
  "to the old behavior."
267
  msgstr ""
268
 
269
+ #: classes/amazon-s3-and-cloudfront.php:4553
270
  msgid "Offload"
271
  msgstr ""
272
 
273
+ #: classes/amazon-s3-and-cloudfront.php:4661
274
  msgctxt "Storage provider key name"
275
  msgid "Storage Provider"
276
  msgstr ""
277
 
278
+ #: classes/amazon-s3-and-cloudfront.php:4662
279
  msgctxt "Storage provider name"
280
  msgid "Storage Provider"
281
  msgstr ""
282
 
283
+ #: classes/amazon-s3-and-cloudfront.php:4663
284
  msgctxt "Bucket name"
285
  msgid "Bucket"
286
  msgstr ""
287
 
288
+ #: classes/amazon-s3-and-cloudfront.php:4664
289
  msgctxt "Path to file in bucket"
290
  msgid "Path"
291
  msgstr ""
292
 
293
+ #: classes/amazon-s3-and-cloudfront.php:4665
294
  msgctxt "Location of bucket"
295
  msgid "Region"
296
  msgstr ""
297
 
298
+ #: classes/amazon-s3-and-cloudfront.php:4666
299
  msgctxt "Access control list of the file in bucket"
300
  msgid "Access"
301
  msgstr ""
302
 
303
+ #: classes/amazon-s3-and-cloudfront.php:4667
304
  msgid "URL"
305
  msgstr ""
306
 
307
+ #: classes/amazon-s3-and-cloudfront.php:4891
308
  msgid "Assets Pull"
309
  msgstr ""
310
 
311
+ #: classes/amazon-s3-and-cloudfront.php:4892
312
  msgid ""
313
  "An addon for WP Offload Media to serve your site's JS, CSS, and other "
314
  "enqueued assets from Amazon CloudFront or another CDN."
315
  msgstr ""
316
 
317
+ #: classes/amazon-s3-and-cloudfront.php:4896
318
  msgid "Feature"
319
  msgstr ""
320
 
321
+ #: classes/amazon-s3-and-cloudfront.php:4942
322
  #, php-format
323
  msgid ""
324
  "<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of "
329
  "plugin, it should be safe to deactivate and delete it. %2$s"
330
  msgstr ""
331
 
332
+ #: classes/amazon-s3-and-cloudfront.php:4974
333
  #, php-format
334
  msgid ""
335
  "<strong>WP Offload Media Settings Moved</strong> &mdash; You now define your "
482
  "Offload Media will require PHP %2$s or later. %3$s"
483
  msgstr ""
484
 
485
+ #: classes/providers/provider.php:443
486
  msgid "Given Key File Path is invalid or could not be accessed."
487
  msgstr ""
488
 
489
+ #: classes/providers/provider.php:453
490
+ #: classes/providers/provider.php:458
491
  msgid "Could not read Key File Path's contents."
492
  msgstr ""
493
 
494
+ #: classes/providers/provider.php:466
495
  msgid "Given Key File Path does not contain valid JSON."
496
  msgstr ""
497
 
498
+ #: classes/providers/provider.php:579
499
  #, php-format
500
  msgid "You must first <a href=\"%s\">set your access keys</a>."
501
  msgstr ""
569
  "version."
570
  msgstr ""
571
 
572
+ #: classes/upgrades/upgrade.php:403
573
  msgid "Pause Update"
574
  msgstr ""
575
 
576
+ #: classes/upgrades/upgrade.php:411
577
  msgid "Restart Update"
578
  msgstr ""
579
 
580
+ #: classes/upgrades/upgrade.php:415
581
  msgid "Try Run It Again"
582
  msgstr ""
583
 
584
+ #: classes/upgrades/upgrade.php:438
585
  #, php-format
586
  msgid ""
587
  "<strong>Running %1$s Update%2$s</strong> &mdash; We&#8217;re going through "
591
  "performance."
592
  msgstr ""
593
 
594
+ #: classes/upgrades/upgrade.php:452
595
  #, php-format
596
  msgid ""
597
  "<strong>%1$s Update Paused%2$s</strong> &mdash; Updating Media Library %3$s "
598
  "has been paused."
599
  msgstr ""
600
 
601
+ #: classes/upgrades/upgrade.php:465
602
  #, php-format
603
  msgid ""
604
  "<strong>Error Updating %1$s</strong> &mdash; We ran into some errors "
606
  "been offloaded. Please check your error log for details. (#%3$d)"
607
  msgstr ""
608
 
609
+ #: classes/upgrades/upgrade.php:489
610
  #, php-format
611
  msgid " (%s%% Complete)"
612
  msgstr ""
613
 
614
+ #: classes/upgrades/upgrade.php:623
615
  #, php-format
616
  msgid "Every %d Minutes"
617
  msgstr ""
653
  msgstr ""
654
 
655
  #: view/bucket-select.php:38
656
+ #: view/provider-select.php:21
657
  msgid "&laquo;&nbsp;Back"
658
  msgstr ""
659
 
820
  msgid "Show"
821
  msgstr ""
822
 
823
+ #: view/provider-select.php:24
824
  msgid "Storage Provider"
825
  msgstr ""
826
 
827
+ #: view/provider-select.php:139
828
  #, php-format
829
  msgid ""
830
  "<strong>Warning:</strong> You have %s offloaded Media Library items, you "
831
  "should remove them from the bucket before changing storage provider."
832
  msgstr ""
833
 
834
+ #: view/provider-select.php:162
835
  msgid "Define access keys in wp-config.php"
836
  msgstr ""
837
 
838
+ #: view/provider-select.php:171
839
  #, php-format
840
  msgctxt "Access Keys defined in multiple defines."
841
  msgid ""
844
  "config.php."
845
  msgstr ""
846
 
847
+ #: view/provider-select.php:173
848
  #, php-format
849
  msgctxt "Access Keys defined in single define."
850
  msgid ""
853
  "config.php."
854
  msgstr ""
855
 
856
+ #: view/provider-select.php:175
857
+ #: view/provider-select.php:225
858
+ #: view/provider-select.php:267
859
  msgctxt "joins multiple define keys in notice"
860
  msgid " & "
861
  msgstr ""
862
 
863
+ #: view/provider-select.php:184
864
  msgid ""
865
  "Please check your wp-config.php file as it looks like one of your access key "
866
  "defines is missing or incorrect."
867
  msgstr ""
868
 
869
+ #: view/provider-select.php:190
870
  msgid ""
871
  "Copy the following snippet <strong>near the top</strong> of your wp-config."
872
  "php and replace the stars with the keys."
873
  msgstr ""
874
 
875
+ #: view/provider-select.php:216
876
  msgid "Define key file path in wp-config.php"
877
  msgstr ""
878
 
879
+ #: view/provider-select.php:224
880
  #, php-format
881
  msgctxt "Key file path defined in single define."
882
  msgid ""
885
  "your wp-config.php."
886
  msgstr ""
887
 
888
+ #: view/provider-select.php:230
889
  msgid ""
890
  "Copy the following snippet <strong>near the top</strong> of your wp-config."
891
  "php and replace \"<strong>/path/to/key/file.json</strong>\"."
892
  msgstr ""
893
 
894
+ #: view/provider-select.php:259
895
  #, php-format
896
  msgid "My server is on %s and I'd like to use IAM Roles"
897
  msgstr ""
898
 
899
+ #: view/provider-select.php:266
900
  #, php-format
901
+ msgctxt "Use Server Roles defined in single define."
902
  msgid ""
903
+ "You've defined use of server roles in your wp-config.php. To select a "
904
+ "different option here, simply comment out or remove the '%1$s' define in "
905
+ "your wp-config.php."
906
  msgstr ""
907
 
908
+ #: view/provider-select.php:272
909
  #, php-format
910
  msgid ""
911
+ "If you host your WordPress site on %s, choose this option and make use of "
912
+ "IAM Roles."
 
913
  msgstr ""
914
 
915
+ #: view/provider-select.php:296
916
  msgid ""
917
  "I understand the risks but I'd like to store access keys in the database "
918
  "anyway (not recommended)"
919
  msgstr ""
920
 
921
+ #: view/provider-select.php:303
922
  msgid ""
923
  "Storing your access keys in the database is less secure than the options "
924
  "above, but if you're ok with that, go ahead and enter your keys in the form "
925
  "below."
926
  msgstr ""
927
 
928
+ #: view/provider-select.php:308
929
  msgid "Access Key ID"
930
  msgstr ""
931
 
932
+ #: view/provider-select.php:323
933
  msgid "Secret Access Key"
934
  msgstr ""
935
 
936
+ #: view/provider-select.php:350
937
  msgid ""
938
  "I understand the risks but I'd like to store the key file's contents in the "
939
  "database anyway (not recommended)"
940
  msgstr ""
941
 
942
+ #: view/provider-select.php:357
943
  msgid ""
944
  "Storing your key file's contents in the database is less secure than the "
945
  "options above, but if you're ok with that, go ahead and enter your key "
946
  "file's JSON data in the field below."
947
  msgstr ""
948
 
949
+ #: view/provider-select.php:373
950
  msgid "Next"
951
  msgstr ""
952
 
953
+ #: view/provider-select.php:373
954
  #: view/settings/media.php:261
955
  msgid "Save Changes"
956
  msgstr ""
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage ===
2
  Contributors: bradt, deliciousbrains, ianmjones
3
  Tags: uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
- Requires at least: 4.7
5
  Tested up to: 5.2
6
  Requires PHP: 5.5
7
- Stable tag: 2.1.1
8
  License: GPLv3
9
 
10
  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,13 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
81
  = WP Offload Media Lite 2.1.1 - 2019-04-29 =
82
  * New: Multisite domain mapping via WordPress MU Domain Mapping plugin is now supported
83
  * Improvement: Local to Provider content filtering performance improvements
1
  === WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage ===
2
  Contributors: bradt, deliciousbrains, ianmjones
3
  Tags: uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
+ Requires at least: 4.9
5
  Tested up to: 5.2
6
  Requires PHP: 5.5
7
+ Stable tag: 2.2
8
  License: GPLv3
9
 
10
  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
 
79
  == Changelog ==
80
 
81
+ = WP Offload Media Lite 2.2 - 2019-06-10 =
82
+ * [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)
83
+ * New: Use IAM Roles without having to update wp-config.php
84
+ * New: Frankfurt (FRA1) region now supported on DigitalOcean Spaces
85
+ * Improvement: WP dashboard performance
86
+ * Bug fix: Uploaded media files with uppercase extensions get second extension added
87
+
88
  = WP Offload Media Lite 2.1.1 - 2019-04-29 =
89
  * New: Multisite domain mapping via WordPress MU Domain Mapping plugin is now supported
90
  * Improvement: Local to Provider content filtering performance improvements
view/provider-select.php CHANGED
@@ -1,16 +1,18 @@
1
  <?php
2
  /* @var \Amazon_S3_And_CloudFront|\Amazon_S3_And_CloudFront_Pro $this */
3
- $current_provider = $this->get_provider();
4
- $provider_defined = (bool) defined( 'AS3CF_PROVIDER' ) || $this->get_defined_setting( 'provider', false );
5
- $key_defined = $this->get_defined_setting( 'access-key-id', false );
6
- $secret_defined = $this->get_defined_setting( 'secret-access-key', false );
7
- $keys_settings_constant = ( $key_defined || $secret_defined ) ? $this->settings_constant() : false;
8
- $key_file_path_defined = $this->get_defined_setting( 'key-file-path', false );
9
- $key_file_defined = $this->get_defined_setting( 'key-file', false );
10
- $key_file_path_settings_constant = ( $key_file_path_defined || $key_file_defined ) ? $this->settings_constant() : false;
11
- $providers = $this->get_provider_classes();
12
- $media_counts = $this->diagnostic_media_counts();
13
- $media_offloaded_string = empty( $media_counts['s3'] ) ? '' : number_format( $media_counts['s3'] );
 
 
14
  ?>
15
 
16
  <div class="as3cf-content as3cf-provider-select">
@@ -50,6 +52,7 @@ $media_offloaded_string = empty( $media_counts['s3'] ) ? '' : number_fo
50
  foreach ( array( $key_file_path_constant, $key_file_path_settings_constant ) as $defined_constant ) {
51
  if ( $defined_constant ) {
52
  $defined_constants[] = $defined_constant;
 
53
  }
54
  }
55
  } else {
@@ -57,11 +60,22 @@ $media_offloaded_string = empty( $media_counts['s3'] ) ? '' : number_fo
57
  continue;
58
  }
59
 
60
- $use_server_role_constant = $provider_class::use_server_role_constant();
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  $selected_authmethod = 'define';
63
 
64
- if ( ! $any_access_key_constant_defined && $provider_class::use_server_roles() ) {
65
  $selected_authmethod = 'server-role';
66
  } elseif ( ! $any_access_key_constant_defined && $provider_selected && ( $current_provider->are_access_keys_set() || $current_provider->get_key_file() ) ) {
67
  $selected_authmethod = 'db';
@@ -79,8 +93,8 @@ $media_offloaded_string = empty( $media_counts['s3'] ) ? '' : number_fo
79
  break;
80
  case 'server-role':
81
  $server_role_authmethod_attr = $provider_selected ? ' checked="checked"' : '';
82
- $define_authmethod_attr = ' data-as3cf-disabled="true" disabled="disabled"';
83
- $db_authmethod_attr = ' data-as3cf-disabled="true" disabled="disabled"';
84
  break;
85
  case 'db':
86
  $db_authmethod_attr = $provider_selected ? ' checked="checked"' : '';
@@ -248,16 +262,17 @@ define( '<?php echo $this::preferred_settings_constant(); ?>', serialize( array(
248
  <tr class="asc3f-provider-authmethod-content" data-provider-authmethod="server-role"<?php echo 'server-role' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
249
  <td></td>
250
  <td>
251
- <?php if ( $provider_class::use_server_roles() ) {
252
- printf( __( 'You\'ve defined the \'%1$s\' constant in your wp-config.php. To select a different option here, simply comment out or remove the define in your wp-config.php.' ), $use_server_role_constant );
 
 
 
253
  echo '&nbsp;' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
254
  } else {
255
- printf( __( 'If you host your WordPress site on %s you should make use of IAM Roles. To tell WP Offload Media you\'re using IAM Roles, copy the following snippet <strong>near the top</strong> of your wp-config.php.', 'amazon-s3-and-cloudfront' ), $provider_class::get_provider_name() );
256
- echo '&nbsp;' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
257
  ?>
258
- <textarea rows="1" class="as3cf-define-snippet code clear" readonly>
259
- define( '<?php echo $provider_class::preferred_use_server_role_constant(); ?>', true );
260
- </textarea>
261
  <?php
262
  }
263
  ?>
1
  <?php
2
  /* @var \Amazon_S3_And_CloudFront|\Amazon_S3_And_CloudFront_Pro $this */
3
+ $current_provider = $this->get_provider();
4
+ $provider_defined = (bool) defined( 'AS3CF_PROVIDER' ) || $this->get_defined_setting( 'provider', false );
5
+ $key_defined = $this->get_defined_setting( 'access-key-id', false );
6
+ $secret_defined = $this->get_defined_setting( 'secret-access-key', false );
7
+ $keys_settings_constant = ( $key_defined || $secret_defined ) ? $this->settings_constant() : false;
8
+ $key_file_path_defined = $this->get_defined_setting( 'key-file-path', false );
9
+ $key_file_defined = $this->get_defined_setting( 'key-file', false );
10
+ $key_file_path_settings_constant = ( $key_file_path_defined || $key_file_defined ) ? $this->settings_constant() : false;
11
+ $use_server_roles_defined = $this->get_defined_setting( 'use-server-roles', false );
12
+ $use_server_roles_settings_constant = $use_server_roles_defined ? $this->settings_constant() : false;
13
+ $providers = $this->get_provider_classes();
14
+ $media_counts = $this->media_counts();
15
+ $media_offloaded_string = empty( $media_counts['offloaded'] ) ? '' : number_format( $media_counts['offloaded'] );
16
  ?>
17
 
18
  <div class="as3cf-content as3cf-provider-select">
52
  foreach ( array( $key_file_path_constant, $key_file_path_settings_constant ) as $defined_constant ) {
53
  if ( $defined_constant ) {
54
  $defined_constants[] = $defined_constant;
55
+ break;
56
  }
57
  }
58
  } else {
60
  continue;
61
  }
62
 
63
+ if ( $provider_class::use_server_roles_allowed() ) {
64
+ $use_server_roles_constant = $provider_class::use_server_roles_constant();
65
+ $any_use_server_roles_constant_defined = (bool) $use_server_roles_constant || $use_server_roles_settings_constant;
66
+
67
+ $defined_use_server_roles_constants = array();
68
+ foreach ( array( $use_server_roles_constant, $use_server_roles_settings_constant ) as $defined_constant ) {
69
+ if ( $defined_constant ) {
70
+ $defined_use_server_roles_constants[] = $defined_constant;
71
+ break;
72
+ }
73
+ }
74
+ }
75
 
76
  $selected_authmethod = 'define';
77
 
78
+ if ( ! $any_access_key_constant_defined && $provider_selected && $current_provider->use_server_roles() ) {
79
  $selected_authmethod = 'server-role';
80
  } elseif ( ! $any_access_key_constant_defined && $provider_selected && ( $current_provider->are_access_keys_set() || $current_provider->get_key_file() ) ) {
81
  $selected_authmethod = 'db';
93
  break;
94
  case 'server-role':
95
  $server_role_authmethod_attr = $provider_selected ? ' checked="checked"' : '';
96
+ $define_authmethod_attr = $any_use_server_roles_constant_defined ? ' data-as3cf-disabled="true" disabled="disabled"' : '';
97
+ $db_authmethod_attr = $any_use_server_roles_constant_defined ? ' data-as3cf-disabled="true" disabled="disabled"' : '';
98
  break;
99
  case 'db':
100
  $db_authmethod_attr = $provider_selected ? ' checked="checked"' : '';
262
  <tr class="asc3f-provider-authmethod-content" data-provider-authmethod="server-role"<?php echo 'server-role' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
263
  <td></td>
264
  <td>
265
+ <?php if ( $any_use_server_roles_constant_defined ) {
266
+ $remove_defines_msg = _x( 'You\'ve defined use of server roles in your wp-config.php. To select a different option here, simply comment out or remove the \'%1$s\' define in your wp-config.php.', 'Use Server Roles defined in single define.', 'amazon-s3-and-cloudfront' );
267
+ $multiple_defined_keys_glue = _x( ' & ', 'joins multiple define keys in notice', 'amazon-s3-and-cloudfront' );
268
+ $defined_constants_str = join( $multiple_defined_keys_glue, $defined_use_server_roles_constants );
269
+ printf( $remove_defines_msg, $defined_constants_str );
270
  echo '&nbsp;' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
271
  } else {
272
+ printf( __( 'If you host your WordPress site on %s, choose this option and make use of IAM Roles.', 'amazon-s3-and-cloudfront' ), $provider_class::get_provider_name() );
273
+ echo '&nbsp;' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#iam-roles' );
274
  ?>
275
+ <input type="hidden" name="use-server-roles" value="1"<?php echo $provider_selected ? '' : ' disabled="disabled"'; ?>/>
 
 
276
  <?php
277
  }
278
  ?>
wordpress-s3.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Offload Media Lite
4
  Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
5
  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.
6
  Author: Delicious Brains
7
- Version: 2.1.1
8
  Author URI: https://deliciousbrains.com/
9
  Network: True
10
  Text Domain: amazon-s3-and-cloudfront
@@ -26,7 +26,7 @@ Domain Path: /languages/
26
  // Then completely rewritten.
27
  */
28
 
29
- $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '2.1.1';
30
 
31
  require_once dirname( __FILE__ ) . '/classes/as3cf-compatibility-check.php';
32
 
4
  Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
5
  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.
6
  Author: Delicious Brains
7
+ Version: 2.2
8
  Author URI: https://deliciousbrains.com/
9
  Network: True
10
  Text Domain: amazon-s3-and-cloudfront
26
  // Then completely rewritten.
27
  */
28
 
29
+ $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '2.2';
30
 
31
  require_once dirname( __FILE__ ) . '/classes/as3cf-compatibility-check.php';
32