Skip to content

Commit

Permalink
Comments: Update counts when (de)activating the plugin (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
obenland authored Jan 10, 2025
1 parent 370d8c8 commit bca6fd7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

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

### Changed
Expand Down
9 changes: 9 additions & 0 deletions includes/class-activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public static function init() {
public static function activate() {
self::flush_rewrite_rules();
Scheduler::register_schedules();

\add_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ), 10, 3 );
Migration::update_comment_counts();
}

/**
Expand All @@ -70,13 +73,19 @@ public static function activate() {
public static function deactivate() {
self::flush_rewrite_rules();
Scheduler::deregister_schedules();

\remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ) );
Migration::update_comment_counts( 2000 );
}

/**
* Uninstall Hook.
*/
public static function uninstall() {
Scheduler::deregister_schedules();

\remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ) );
Migration::update_comment_counts( 2000 );
}

/**
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ For reasons of data protection, it is not possible to see the followers of other

= Unreleased =

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

0 comments on commit bca6fd7

Please sign in to comment.