get_col( $wpdb->prepare( "SELECT meta_key FROM {$wpdb->sitemeta} WHERE meta_key LIKE %s OR meta_key LIKE %s", $wpdb->esc_like( $stored_prefix ) . '%', $wpdb->esc_like( $timeout_prefix ) . '%' ) ); } else { $stored_prefix = '_transient_' . $prefix; $timeout_prefix = '_transient_timeout_' . $prefix; $delete_callback = 'delete_transient'; $timeout_prefix_length = strlen( '_transient_timeout_' ); $stored_prefix_length = strlen( '_transient_' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $matches = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", $wpdb->esc_like( $stored_prefix ) . '%', $wpdb->esc_like( $timeout_prefix ) . '%' ) ); } if ( empty( $matches ) ) { return; } foreach ( $matches as $option_name ) { if ( ! is_string( $option_name ) ) { continue; } if ( str_starts_with( $option_name, $is_network ? '_site_transient_timeout_' : '_transient_timeout_' ) ) { $transient_key = substr( $option_name, $timeout_prefix_length ); } else { $transient_key = substr( $option_name, $stored_prefix_length ); } if ( '' === $transient_key ) { continue; } call_user_func( $delete_callback, $transient_key ); } } } if ( ! function_exists( 'robotstxt_smtp_uninstall_delete_logs' ) ) { /** * Deletes all stored SMTP logs for the current site. * * @since 1.1.1 * * @return void */ function robotstxt_smtp_uninstall_delete_logs(): void { do { $logs = get_posts( array( 'post_type' => 'robotstxt_smtp_log', 'post_status' => 'any', 'fields' => 'ids', 'posts_per_page' => 100, 'orderby' => 'ID', 'order' => 'ASC', ) ); foreach ( $logs as $log_id ) { wp_delete_post( (int) $log_id, true ); } } while ( ! empty( $logs ) ); } } robotstxt_smtp_uninstall_cleanup_network(); if ( function_exists( 'is_multisite' ) && is_multisite() ) { $sites = get_sites( array( 'fields' => 'ids' ) ); foreach ( $sites as $site_id ) { switch_to_blog( (int) $site_id ); robotstxt_smtp_uninstall_cleanup_site(); restore_current_blog(); } } else { robotstxt_smtp_uninstall_cleanup_site(); }