some small fixes

This commit is contained in:
Matthias Pfefferle 2023-07-28 10:28:55 +02:00
parent d2af87c259
commit 835af08848
2 changed files with 8 additions and 2 deletions

View file

@ -133,7 +133,7 @@ class Scheduler {
if ( is_tombstone( $meta ) ) { if ( is_tombstone( $meta ) ) {
$follower->delete(); $follower->delete();
} elseif ( empty( $meta ) || ! is_array( $meta ) || is_wp_error( $meta ) ) { } elseif ( empty( $meta ) || ! is_array( $meta ) || is_wp_error( $meta ) ) {
if ( 5 <= $follower->count_errors() ) { if ( $follower->count_errors() >= 5 ) {
$follower->delete(); $follower->delete();
} else { } else {
Followers::add_error( $follower->get__id(), $meta ); Followers::add_error( $follower->get__id(), $meta );

View file

@ -286,7 +286,7 @@ class Followers {
$activity = $activity->to_json(); $activity = $activity->to_json();
$response = Http::post( $inbox, $activity, $user_id ); Http::post( $inbox, $activity, $user_id );
} }
/** /**
@ -322,6 +322,7 @@ class Followers {
'paged' => $page, 'paged' => $page,
'orderby' => 'ID', 'orderby' => 'ID',
'order' => 'DESC', 'order' => 'DESC',
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
'meta_query' => array( 'meta_query' => array(
array( array(
'key' => 'activitypub_user_id', 'key' => 'activitypub_user_id',
@ -351,6 +352,7 @@ class Followers {
*/ */
public static function get_all_followers() { public static function get_all_followers() {
$args = array( $args = array(
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
'meta_query' => array(), 'meta_query' => array(),
); );
return self::get_followers( null, null, null, $args ); return self::get_followers( null, null, null, $args );
@ -368,6 +370,7 @@ class Followers {
array( array(
'post_type' => self::POST_TYPE, 'post_type' => self::POST_TYPE,
'fields' => 'ids', 'fields' => 'ids',
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
'meta_query' => array( 'meta_query' => array(
array( array(
'key' => 'activitypub_user_id', 'key' => 'activitypub_user_id',
@ -400,6 +403,7 @@ class Followers {
array( array(
'post_type' => self::POST_TYPE, 'post_type' => self::POST_TYPE,
'fields' => 'ids', 'fields' => 'ids',
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
'meta_query' => array( 'meta_query' => array(
array( array(
'key' => 'activitypub_inbox', 'key' => 'activitypub_inbox',
@ -420,6 +424,7 @@ class Followers {
} }
global $wpdb; global $wpdb;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
$results = $wpdb->get_col( $results = $wpdb->get_col(
$wpdb->prepare( $wpdb->prepare(
"SELECT DISTINCT meta_value FROM {$wpdb->postmeta} "SELECT DISTINCT meta_value FROM {$wpdb->postmeta}
@ -482,6 +487,7 @@ class Followers {
$args = array( $args = array(
'post_type' => self::POST_TYPE, 'post_type' => self::POST_TYPE,
'posts_per_page' => $number, 'posts_per_page' => $number,
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
'meta_query' => array( 'meta_query' => array(
array( array(
'key' => 'activitypub_errors', 'key' => 'activitypub_errors',