PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
← All changes | libraries/freemius/includes/class-fs-plugin-updater.php +26 -35 2.4.3 → 3.4 View file →
@@ -539,38 +539,40 @@
539 539 ) {
540 540 return $transient_data;
541 541 }
542 542
543 + // Alias.
544 + $basename = $this->_fs->premium_plugin_basename();
545 +
543 546 global $wp_current_filter;
544 547
545 - $current_plugin_version = $this->_fs->get_plugin_version();
546 -
547 - if ( ! empty( $wp_current_filter ) && 'upgrader_process_complete' === $wp_current_filter[0] ) {
548 - if (
549 - is_null( $this->_update_details ) ||
550 - ( is_object( $this->_update_details ) && $this->_update_details->new_version !== $current_plugin_version )
551 - ) {
548 + /**
549 + * During bulk updates, avoid re-injecting update data for the plugin itself once it has already been updated.
550 + *
551 + * If the custom package is re-added to the transient after the plugin update, WordPress may detect the package again and incorrectly report "The plugin is at the latest version" for a pending update, since the custom package version matches the currently installed version.
552 + *
553 + * Behavior differs depending on how the bulk update is triggered. Please refer to the inline comments for each flow below for details.
554 + */
555 + if (
556 + ! empty( $wp_current_filter ) && (
552 557 /**
553 - * After an update, clear the stored update details and reparse the plugin's main file in order to get
554 - * the updated version's information and prevent the previous update information from showing up on the
555 - * updates page.
556 - *
557 - * @author Leo Fajardo (@leorw)
558 - * @since 2.3.1
558 + * update-core.php and other upgrader pages:
559 + * The `upgrader_process_complete` action fires only once after all updates have finished. In this case, it is the current action (`$wp_current_filter[0]`), while `self::$_upgrade_basename` may contain any plugin basename.
559 560 */
560 - $this->_update_details = null;
561 - $current_plugin_version = $this->_fs->get_plugin_version( true );
562 - }
561 + 'upgrader_process_complete' === $wp_current_filter[0] ||
562 + /**
563 + * AJAX bulk updates (e.g., from the Plugins page):
564 + * The `upgrader_process_complete` action fires multiple times — once for each plugin after it finishes updating. In this flow, it is not the current action (`$wp_current_filter[0]`) because it is triggered from another action. Instead, we compare `self::$_upgrade_basename` with the basename of the plugin currently being updated, since the `upgrader_process_complete` action runs separately for each plugin.
565 + */
566 + ( in_array( 'upgrader_process_complete', $wp_current_filter ) && self::$_upgrade_basename === $basename )
567 + )
568 + ) {
569 + return $transient_data;
563 570 }
564 571
565 572 if ( ! isset( $this->_update_details ) ) {
566 573 // Get plugin's newest update.
567 - $new_version = $this->_fs->get_update(
568 - false,
569 - fs_request_get_bool( 'force-check' ),
570 - FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
571 - $current_plugin_version
572 - );
574 + $new_version = $this->_fs->get_update( false, fs_request_get_bool( 'force-check' ) );
573 575
574 576 $this->_update_details = false;
575 577
576 578 if ( is_object( $new_version ) && $this->is_new_version_premium( $new_version ) ) {
@@ -586,11 +588,8 @@
586 588 $this->_update_details = $this->get_update_details( $new_version );
587 589 }
588 590 }
589 591
590 - // Alias.
591 - $basename = $this->_fs->premium_plugin_basename();
592 -
593 592 if ( is_object( $this->_update_details ) ) {
594 593 if ( isset( $transient_data->no_update ) ) {
595 594 unset( $transient_data->no_update[ $basename ] );
596 595 }
@@ -719,18 +718,10 @@
719 718 'default' => $icon,
720 719 );
721 720 }
722 721
723 - if ( $this->_fs->is_premium() ) {
724 - $latest_tag = $this->_fs->_fetch_latest_version( $this->_fs->get_id(), false );
725 -
726 - if (
727 - isset( $latest_tag->readme ) &&
728 - isset( $latest_tag->readme->upgrade_notice ) &&
729 - ! empty( $latest_tag->readme->upgrade_notice )
730 - ) {
731 - $update->upgrade_notice = $latest_tag->readme->upgrade_notice;
732 - }
722 + if ( $this->_fs->is_premium() && ! empty( $new_version->upgrade_notice ) ) {
723 + $update->upgrade_notice = $new_version->upgrade_notice;
733 724 }
734 725
735 726 $update->{$this->_fs->get_module_type()} = $this->_fs->get_plugin_basename();
736 727