Easy Digital Downloads - Version 2.6.15

Version Description

Download this release

Release Info

Developer mordauk
Plugin Icon 128x128 Easy Digital Downloads
Version 2.6.15
Comparing to
See all releases

Code changes from version 2.6.14 to 2.6.15

easy-digital-downloads.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: The easiest way to sell digital products with WordPress.
6
  * Author: Easy Digital Downloads
7
  * Author URI: https://easydigitaldownloads.com
8
- * Version: 2.6.14
9
  * Text Domain: easy-digital-downloads
10
  * Domain Path: languages
11
  *
@@ -25,7 +25,7 @@
25
  * @package EDD
26
  * @category Core
27
  * @author Pippin Williamson
28
- * @version 2.6.14
29
  */
30
 
31
  // Exit if accessed directly.
@@ -196,7 +196,7 @@ final class Easy_Digital_Downloads {
196
 
197
  // Plugin version.
198
  if ( ! defined( 'EDD_VERSION' ) ) {
199
- define( 'EDD_VERSION', '2.6.14' );
200
  }
201
 
202
  // Plugin Folder Path.
5
  * Description: The easiest way to sell digital products with WordPress.
6
  * Author: Easy Digital Downloads
7
  * Author URI: https://easydigitaldownloads.com
8
+ * Version: 2.6.15
9
  * Text Domain: easy-digital-downloads
10
  * Domain Path: languages
11
  *
25
  * @package EDD
26
  * @category Core
27
  * @author Pippin Williamson
28
+ * @version 2.6.15
29
  */
30
 
31
  // Exit if accessed directly.
196
 
197
  // Plugin version.
198
  if ( ! defined( 'EDD_VERSION' ) ) {
199
+ define( 'EDD_VERSION', '2.6.15' );
200
  }
201
 
202
  // Plugin Folder Path.
includes/EDD_SL_Plugin_Updater.php CHANGED
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
10
  * Allows plugins to use their own update API.
11
  *
12
  * @author Pippin Williamson
13
- * @version 1.6.6
14
  */
15
  class EDD_SL_Plugin_Updater {
16
 
@@ -98,12 +98,13 @@ class EDD_SL_Plugin_Updater {
98
  return $_transient_data;
99
  }
100
 
101
- $version_info = get_transient( $this->cache_key );
102
 
103
  if ( false === $version_info ) {
104
  $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
105
 
106
- set_transient( $this->cache_key, $version_info, 3600 );
 
107
  }
108
 
109
  if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
@@ -155,12 +156,12 @@ class EDD_SL_Plugin_Updater {
155
 
156
  if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
157
 
158
- $version_info = get_transient( $this->cache_key );
159
 
160
  if ( false === $version_info ) {
161
  $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
162
 
163
- set_transient( $this->cache_key, $version_info, 3600 );
164
  }
165
 
166
  if ( ! is_object( $version_info ) ) {
@@ -236,7 +237,6 @@ class EDD_SL_Plugin_Updater {
236
  */
237
  public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
238
 
239
-
240
  if ( $_action != 'plugin_information' ) {
241
 
242
  return $_data;
@@ -260,16 +260,16 @@ class EDD_SL_Plugin_Updater {
260
 
261
  $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] ) );
262
 
263
- //Get the transient where we store the api request for this plugin for 24 hours
264
- $edd_api_request_transient = get_site_transient( $cache_key );
265
 
266
  //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
267
  if ( empty( $edd_api_request_transient ) ){
268
 
269
  $api_response = $this->api_request( 'plugin_information', $to_send );
270
 
271
- //Expires in 1 day
272
- set_site_transient( $cache_key, $api_response, DAY_IN_SECONDS );
273
 
274
  if ( false !== $api_response ) {
275
  $_data = $api_response;
@@ -368,7 +368,7 @@ class EDD_SL_Plugin_Updater {
368
 
369
  $data = $edd_plugin_data[ $_REQUEST['slug'] ];
370
  $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
371
- $version_info = get_transient( $cache_key );
372
 
373
  if( false === $version_info ) {
374
 
@@ -393,7 +393,7 @@ class EDD_SL_Plugin_Updater {
393
  $version_info = false;
394
  }
395
 
396
- set_transient( $cache_key, $version_info, 3600 );
397
 
398
  }
399
 
@@ -404,4 +404,35 @@ class EDD_SL_Plugin_Updater {
404
  exit;
405
  }
406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  }
10
  * Allows plugins to use their own update API.
11
  *
12
  * @author Pippin Williamson
13
+ * @version 1.6.7
14
  */
15
  class EDD_SL_Plugin_Updater {
16
 
98
  return $_transient_data;
99
  }
100
 
101
+ $version_info = $this->get_cached_version_info();
102
 
103
  if ( false === $version_info ) {
104
  $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
105
 
106
+ $this->set_version_info_cache( $version_info );
107
+
108
  }
109
 
110
  if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
156
 
157
  if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
158
 
159
+ $version_info = $this->get_cached_version_info();
160
 
161
  if ( false === $version_info ) {
162
  $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
163
 
164
+ $this->set_version_info_cache( $version_info );
165
  }
166
 
167
  if ( ! is_object( $version_info ) ) {
237
  */
238
  public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
239
 
 
240
  if ( $_action != 'plugin_information' ) {
241
 
242
  return $_data;
260
 
261
  $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] ) );
262
 
263
+ // Get the transient where we store the api request for this plugin for 24 hours
264
+ $edd_api_request_transient = $this->get_cached_version_info( $cache_key );
265
 
266
  //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
267
  if ( empty( $edd_api_request_transient ) ){
268
 
269
  $api_response = $this->api_request( 'plugin_information', $to_send );
270
 
271
+ // Expires in 3 hours
272
+ $this->set_version_info_cache( $api_response, $cache_key );
273
 
274
  if ( false !== $api_response ) {
275
  $_data = $api_response;
368
 
369
  $data = $edd_plugin_data[ $_REQUEST['slug'] ];
370
  $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
371
+ $version_info = $this->get_cached_version_info( $cache_key );
372
 
373
  if( false === $version_info ) {
374
 
393
  $version_info = false;
394
  }
395
 
396
+ $this->set_version_info_cache( $version_info, $cache_key );
397
 
398
  }
399
 
404
  exit;
405
  }
406
 
407
+ public function get_cached_version_info( $cache_key = '' ) {
408
+
409
+ if( empty( $cache_key ) ) {
410
+ $cache_key = $this->cache_key;
411
+ }
412
+
413
+ $cache = get_option( $cache_key );
414
+
415
+ if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) {
416
+ return false; // Cache is expired
417
+ }
418
+
419
+ return json_decode( $cache['value'] );
420
+
421
+ }
422
+
423
+ public function set_version_info_cache( $value = '', $cache_key = '' ) {
424
+
425
+ if( empty( $cache_key ) ) {
426
+ $cache_key = $this->cache_key;
427
+ }
428
+
429
+ $data = array(
430
+ 'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
431
+ 'value' => json_encode( $value )
432
+ );
433
+
434
+ update_option( $cache_key, $data );
435
+
436
+ }
437
+
438
  }
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://easydigitaldownloads.com/donate/
6
  Tags: download, downloads, e-store, eshop, digital downloads, e-commerce, wp-ecommerce, wp ecommerce
7
  Requires at least: 4.0
8
  Tested up to: 4.8
9
- Stable Tag: 2.6.14
10
 
11
  License: GNU Version 2 or Any Later Version
12
 
@@ -187,6 +187,9 @@ Yes, through the addition of one or more of the add-on payment gateways, you can
187
 
188
  == Changelog ==
189
 
 
 
 
190
  = 2.6.14, December 15, 2016 =
191
  * New: Added hooks before and after cart on checkout screen
192
  * New: Added support for user-specific locales
6
  Tags: download, downloads, e-store, eshop, digital downloads, e-commerce, wp-ecommerce, wp ecommerce
7
  Requires at least: 4.0
8
  Tested up to: 4.8
9
+ Stable Tag: 2.6.15
10
 
11
  License: GNU Version 2 or Any Later Version
12
 
187
 
188
  == Changelog ==
189
 
190
+ = 2.6.15, December 19, 2016 =
191
+ * Fix: Conflict with some object caching configurations and the extension update checks that resulted in poor performance.
192
+
193
  = 2.6.14, December 15, 2016 =
194
  * New: Added hooks before and after cart on checkout screen
195
  * New: Added support for user-specific locales