Skip to content

Commit 8be2505

Browse files
authored
[updater] Prevent handling updates right after post-upgrade processing. (#777)
1 parent c10b056 commit 8be2505

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

includes/class-fs-plugin-updater.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -542,24 +542,8 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
542542

543543
global $wp_current_filter;
544544

545-
$current_plugin_version = $this->_fs->get_plugin_version();
546-
547545
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-
) {
552-
/**
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
559-
*/
560-
$this->_update_details = null;
561-
$current_plugin_version = $this->_fs->get_plugin_version( true );
562-
}
546+
return $transient_data;
563547
}
564548

565549
if ( ! isset( $this->_update_details ) ) {
@@ -568,7 +552,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
568552
false,
569553
fs_request_get_bool( 'force-check' ),
570554
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
571-
$current_plugin_version
555+
$this->_fs->get_plugin_version()
572556
);
573557

574558
$this->_update_details = false;

includes/managers/class-fs-admin-notice-manager.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,14 @@ function dismiss_notice_ajax_callback() {
194194
* @since 1.0.7
195195
*/
196196
static function _add_sticky_dismiss_javascript() {
197+
$sticky_admin_notice_js_template_name = 'sticky-admin-notice-js.php';
198+
199+
if ( ! file_exists( fs_get_template_path( $sticky_admin_notice_js_template_name ) ) ) {
200+
return;
201+
}
202+
197203
$params = array();
198-
fs_require_once_template( 'sticky-admin-notice-js.php', $params );
204+
fs_require_once_template( $sticky_admin_notice_js_template_name, $params );
199205
}
200206

201207
private static $_added_sticky_javascript = false;

0 commit comments

Comments
 (0)