Skip to content

Commit bca6fd7

Browse files
authored
Comments: Update counts when (de)activating the plugin (#1128)
1 parent 370d8c8 commit bca6fd7

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
* Comment counts get updated when the plugin is activated/deactivated/deleted
1213
* Added a filter to make custom comment types manageable in WP.com Calypso
1314

1415
### Changed

includes/class-activitypub.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public static function init() {
6262
public static function activate() {
6363
self::flush_rewrite_rules();
6464
Scheduler::register_schedules();
65+
66+
\add_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ), 10, 3 );
67+
Migration::update_comment_counts();
6568
}
6669

6770
/**
@@ -70,13 +73,19 @@ public static function activate() {
7073
public static function deactivate() {
7174
self::flush_rewrite_rules();
7275
Scheduler::deregister_schedules();
76+
77+
\remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ) );
78+
Migration::update_comment_counts( 2000 );
7379
}
7480

7581
/**
7682
* Uninstall Hook.
7783
*/
7884
public static function uninstall() {
7985
Scheduler::deregister_schedules();
86+
87+
\remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ) );
88+
Migration::update_comment_counts( 2000 );
8089
}
8190

8291
/**

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ For reasons of data protection, it is not possible to see the followers of other
134134

135135
= Unreleased =
136136

137+
* Added: Comment counts get updated when the plugin is activated/deactivated/deleted
137138
* Added: A filter to make custom comment types manageable in WP.com Calypso
138139
* Changed: Hide ActivityPub post meta keys from the custom Fields UI
139140
* Changed: Bumped minimum required PHP version to 7.2

0 commit comments

Comments
 (0)