Skip to content

Commit ebe9a52

Browse files
Miraeldremyperonawordpressfan
authored
FIX: Add upgrade callback to reset credit on version update (#7781)
Co-authored-by: Rémy Perona <[email protected]> Co-authored-by: WordPressFan <[email protected]>
1 parent 5fc6e04 commit ebe9a52

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

inc/Engine/Admin/PerformanceMonitoring/Subscriber.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public static function get_subscribed_events(): array {
166166
],
167167
'rocket_options_changed' => 'maybe_cancel_automatic_retest_job',
168168
'rocket_insights_retest' => 'retest_all_pages',
169+
'wp_rocket_upgrade' => [ 'on_update_reset_credit', 10, 2 ],
169170
];
170171
}
171172

@@ -509,4 +510,17 @@ public function retest_all_pages() {
509510
public function maybe_cancel_automatic_retest_job() {
510511
$this->queue->cancel_retest_job();
511512
}
513+
514+
/**
515+
* Callback for the wp_rocket_upgrade action to reset credit on version update.
516+
*
517+
* @param string $new_version New plugin version.
518+
* @param string $old_version Previous plugin version.
519+
* @return void
520+
*/
521+
public function on_update_reset_credit( $new_version, $old_version ) {
522+
if ( version_compare( $old_version, '3.20.0', '<' ) ) {
523+
$this->controller->reset_credit();
524+
}
525+
}
512526
}

wp-rocket.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WP Rocket
44
* Plugin URI: https://wp-rocket.me
55
* Description: The best WordPress performance plugin.
6-
* Version: 3.20
6+
* Version: 3.20.0.1
77
* Requires at least: 5.8
88
* Requires PHP: 7.3
99
* Code Name: Iego
@@ -20,7 +20,7 @@
2020
defined( 'ABSPATH' ) || exit;
2121

2222
// Rocket defines.
23-
define( 'WP_ROCKET_VERSION', '3.20' );
23+
define( 'WP_ROCKET_VERSION', '3.20.0.1' );
2424
define( 'WP_ROCKET_WP_VERSION', '5.8' );
2525
define( 'WP_ROCKET_WP_VERSION_TESTED', '6.3.1' );
2626
define( 'WP_ROCKET_PHP_VERSION', '7.3' );

0 commit comments

Comments
 (0)