array( 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'minItems' => 1, 'description' => __( 'Log entry ids. Find them with rank-math/list-404-logs.', 'acrossai-abilities-manager' ), ), ); } protected function output_properties(): array { return array( 'ids' => array( 'type' => 'array' ), 'deleted' => array( 'type' => 'integer' ), 'remaining' => array( 'type' => 'integer' ), ); } /** * 'confirm' is intentionally absent — see Base_Rank_Math_Ability::ability(). */ protected function required_input(): array { return array( 'ids' ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => true, 'idempotent' => true ); } /** * @param array $input * @return array|WP_Error */ protected function run( array $input ) { if ( ! isset( $input['ids'] ) || ! is_array( $input['ids'] ) ) { return new WP_Error( 'invalid_input', __( 'ids must be a list of log entry ids.', 'acrossai-abilities-manager' ) ); } $result = Log_Repository::delete( $input['ids'] ); if ( is_wp_error( $result ) ) { return $result; } $result['message'] = sprintf( /* translators: 1: number deleted, 2: number remaining */ __( 'Deleted %1$d 404 log entries; %2$d remain.', 'acrossai-abilities-manager' ), $result['deleted'], $result['remaining'] ); return $result; } }