Skip to content

Commit

Permalink
[plugin-information-dialog] Try to fetch data from WP only when the p…
Browse files Browse the repository at this point in the history
…lugin is actually WP.org-compliant.
  • Loading branch information
fajardoleo authored and swashata committed Jul 22, 2024
1 parent 59cf95d commit 729f854
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions includes/class-fs-plugin-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {

$slug = $this->_fs->get_slug();

if ( $this->_fs->is_org_repo_compliant() && $this->_fs->is_freemium() ) {
if ( $this->can_fetch_data_from_wp_org() ) {
if ( ! isset( $this->_translation_updates ) ) {
$this->_translation_updates = array();

Expand Down Expand Up @@ -908,6 +908,16 @@ static function _fetch_plugin_info_from_repository( $action, $args ) {
return $res;
}

/**
* Returns true if the product can fetch data from WordPress.org.
*
* @author Leo Fajardo (@leorw)
* @since 2.7.4
*/
private function can_fetch_data_from_wp_org() {
return ( $this->_fs->is_org_repo_compliant() && $this->_fs->is_freemium() );
}

/**
* Fetches module translation updates from wordpress.org.
*
Expand Down Expand Up @@ -1092,7 +1102,7 @@ function plugins_api_filter( $data, $action = '', $args = null ) {
}

$plugin_in_repo = false;
if ( ! $is_addon ) {
if ( ! $is_addon && $this->can_fetch_data_from_wp_org() ) {
// Try to fetch info from .org repository.
$data = self::_fetch_plugin_info_from_repository( $action, $args );

Expand Down
2 changes: 1 addition & 1 deletion start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.7.3.2';
$this_sdk_version = '2.7.3.3';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down

0 comments on commit 729f854

Please sign in to comment.