Make WordPress Core


Ignore:
Timestamp:
07/07/2025 06:04:00 PM (11 months ago)
Author:
jorbin
Message:

Pings/Trackbacks: Use HTTPS for services that now support it.

This updates the default on new installations for rpc.pingomatic.com to use https while also upgrading existing sites that use rpc.pingomatic.com or rpc.twingly.com to use https for those two domains.

Props sabernhardt, peterwilsoncc, jorbin, bhubbard, matt.
Fixes #42007.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r60235 r60421  
    882882        upgrade_670();
    883883    }
     884
     885    if ( $wp_current_db_version < 60421 ) {
     886        upgrade_682();
     887    }
     888
    884889    maybe_disable_link_manager();
    885890
     
    24402445    }
    24412446}
     2447
     2448/**
     2449 * Executes changes made in WordPress 6.8.2.
     2450 *
     2451 * @ignore
     2452 * @since 6.8.2
     2453 *
     2454 * @global int $wp_current_db_version The old (current) database version.
     2455 */
     2456function upgrade_682() {
     2457    global $wp_current_db_version;
     2458
     2459    if ( $wp_current_db_version < 60421 ) {
     2460        // Upgrade Ping-O-Matic and Twingly to use HTTPS.
     2461        $ping_sites_value = get_option( 'ping_sites' );
     2462        $ping_sites_value = explode( "\n", $ping_sites_value );
     2463        $ping_sites_value = array_map(
     2464            function ( $url ) {
     2465                $url = trim( $url );
     2466                $url = sanitize_url( $url );
     2467                if (
     2468                    str_ends_with( trailingslashit( $url ), '://rpc.pingomatic.com/' )
     2469                    || str_ends_with( trailingslashit( $url ), '://rpc.twingly.com/' )
     2470                ) {
     2471                    $url = set_url_scheme( $url, 'https' );
     2472                }
     2473                return $url;
     2474            },
     2475            $ping_sites_value
     2476        );
     2477        $ping_sites_value = array_filter( $ping_sites_value );
     2478        $ping_sites_value = implode( "\n", $ping_sites_value );
     2479        update_option( 'ping_sites', $ping_sites_value );
     2480    }
     2481}
     2482
    24422483/**
    24432484 * Executes network-level upgrade routines.
Note: See TracChangeset for help on using the changeset viewer.