Skip to content

Commit

Permalink
Merge pull request #34 from smalltowndev/release-v0.11.0
Browse files Browse the repository at this point in the history
Release v0.11.0
  • Loading branch information
lushkant committed May 24, 2024
2 parents 59fe3a6 + 711b59f commit 3e53ba8
Show file tree
Hide file tree
Showing 15 changed files with 174 additions and 138 deletions.
20 changes: 18 additions & 2 deletions freemius/includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -20815,7 +20815,7 @@ private function _fetch_newer_version( $plugin_id = false, $flush = true, $expir
*
* @return bool|FS_Plugin_Tag
*/
function get_update( $plugin_id = false, $flush = true, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $newer_than = false ) {
function get_update( $plugin_id = false, $flush = true, $expiration = FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION, $newer_than = false ) {
$this->_logger->entrance();

if ( ! is_numeric( $plugin_id ) ) {
Expand Down Expand Up @@ -21347,7 +21347,9 @@ private function _sync_plugin_license(
/**
* Sync licenses. Pass the site's license ID so that the foreign licenses will be fetched if the license
* associated with that ID is not included in the user's licenses collection.
* Save previous value to manage remote license renewals.
*/
$was_license_expired_before_sync = is_object( $this->_license ) && $this->_license->is_expired();
$this->_sync_licenses(
$site->license_id,
( $is_context_single_site ?
Expand Down Expand Up @@ -21481,6 +21483,14 @@ private function _sync_plugin_license(
$plan_change = 'expired';
}
}
} else if ( $was_license_expired_before_sync ) {
/**
* If license was expired but it is not anymore.
*
*
* @author Daniele Alessandra (@danielealessandra)
*/
$plan_change = 'extended';
}
}

Expand Down Expand Up @@ -21558,6 +21568,12 @@ private function _sync_plugin_license(
'license_expired',
) );
break;
case 'extended':
$this->_admin_notices->remove_sticky( array(
'trial_expired',
'license_expired',
) );
break;
case 'changed':
$this->_admin_notices->add_sticky(
sprintf(
Expand Down Expand Up @@ -22468,7 +22484,7 @@ private function check_updates(
$background = false,
$plugin_id = false,
$flush = true,
$expiration = WP_FS__TIME_24_HOURS_IN_SEC,
$expiration = FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
$newer_than = false
) {
$this->_logger->entrance();
Expand Down
7 changes: 5 additions & 2 deletions freemius/includes/class-fs-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,12 @@ function get( $path = '/', $flush = false, $expiration = WP_FS__TIME_24_HOURS_IN
$flush = true;
}

$cached_result = self::$_cache->get( $cache_key );
$has_valid_cache = self::$_cache->has_valid( $cache_key, $expiration );
$cached_result = $has_valid_cache ?
self::$_cache->get( $cache_key ) :
null;

if ( $flush || ! self::$_cache->has_valid( $cache_key, $expiration ) ) {
if ( $flush || is_null( $cached_result ) ) {
$result = $this->call( $path );

if ( ! is_object( $result ) || isset( $result->error ) ) {
Expand Down
6 changes: 4 additions & 2 deletions freemius/includes/class-fs-plugin-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class FS_Plugin_Updater {

private static $_upgrade_basename = null;

const UPDATES_CHECK_CACHE_EXPIRATION = ( WP_FS__TIME_24_HOURS_IN_SEC / 24 );

#--------------------------------------------------------------------------------
#region Singleton
#--------------------------------------------------------------------------------
Expand Down Expand Up @@ -530,7 +532,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
$new_version = $this->_fs->get_update(
false,
fs_request_get_bool( 'force-check' ),
WP_FS__TIME_24_HOURS_IN_SEC / 24,
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
$current_plugin_version
);

Expand Down Expand Up @@ -1188,7 +1190,7 @@ private static function get_tested_wp_version( $tested_up_to ) {
* @return object
*/
private function get_latest_download_details( $addon_id = false, $newer_than = false, $fetch_readme = true ) {
return $this->_fs->_fetch_latest_version( $addon_id, true, WP_FS__TIME_24_HOURS_IN_SEC, $newer_than, $fetch_readme );
return $this->_fs->_fetch_latest_version( $addon_id, true, FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION, $newer_than, $fetch_readme );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion freemius/includes/fs-plugin-info-dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function _get_addon_info_filter( $data, $action = '', $args = null ) {
$latest = $this->_fs->_fetch_latest_version(
$selected_addon->id,
true,
WP_FS__TIME_24_HOURS_IN_SEC,
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
$current_addon_version
);

Expand Down
Binary file modified freemius/languages/freemius-it_IT.mo
Binary file not shown.
Loading

0 comments on commit 3e53ba8

Please sign in to comment.