Skip to content

Commit

Permalink
Delete old posts after processing items
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Feb 21, 2025
1 parent b09921d commit 583e0fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion friends.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
add_action( 'plugins_loaded', array( __NAMESPACE__ . '\Friends', 'init' ) );
add_action( 'admin_init', array( __NAMESPACE__ . '\Plugin_Installer', 'register_hooks' ) );

if ( is_admin() && FRIENDS_VERSION > get_option( 'friends_plugin_version' ) ) {
if ( is_admin() && version_compare( get_option( 'friends_plugin_version' ), FRIENDS_VERSION, '<' ) ) {
add_action( 'admin_init', array( __NAMESPACE__ . '\Friends', 'upgrade_plugin' ) );
}

Expand Down
11 changes: 2 additions & 9 deletions includes/class-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ public function cron_friends_refresh_feeds() {
$feed->set_polling_now();
$this->retrieve_feed( $feed );
$feed->was_polled();
$friend_user = $feed->get_friend_user();
if ( $friend_user ) {
$friend_user->delete_outdated_posts();
}
}
}

Expand All @@ -144,7 +140,6 @@ public function friends_retrieve_user_feeds( $user_id ) {
$feed->set_polling_now();
$this->retrieve_feed( $feed );
$feed->was_polled();
$friend_user->delete_outdated_posts();
}
}
}
Expand Down Expand Up @@ -299,10 +294,6 @@ public function retrieve_friend_posts( $ignore_due_date = false ) {
$feed->set_polling_now();
$this->retrieve_feed( $feed );
$feed->was_polled();
$friend_user = $feed->get_friend_user();
if ( $friend_user ) {
$friend_user->delete_outdated_posts();
}
}
}

Expand Down Expand Up @@ -728,6 +719,8 @@ public function process_incoming_feed_items( array $items, User_Feed $user_feed

do_action( 'friends_retrieved_new_posts', $user_feed, $new_posts, $modified_posts, $friend_user );

$friend_user->delete_outdated_posts();

return $new_posts;
}

Expand Down

0 comments on commit 583e0fa

Please sign in to comment.