WordPress.org

Make WordPress Core

Ticket #31405: 31405.diff

File 31405.diff, 2.5 KB (added by flixos90, 5 years ago)

fix using set_url_scheme()

  • src/wp-admin/network/upgrade.php

     
    6363                echo "<ul>";
    6464                foreach ( (array) $blogs as $details ) {
    6565                        switch_to_blog( $details['blog_id'] );
    66                         $siteurl = site_url();
    67                         $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
     66                        $siteurl = site_url( '', 'original' );
     67                        $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db', 'original' );
    6868                        restore_current_blog();
    6969
    7070                        echo "<li>$siteurl</li>";
  • src/wp-includes/link-template.php

     
    34133413 *
    34143414 * @since 3.4.0
    34153415 * @since 4.4.0 The 'rest' scheme was added.
     3416 * @since 4.6.0 The 'original' scheme was added.
    34163417 *
    34173418 * @param string      $url    Absolute URL that includes a scheme
    34183419 * @param string|null $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login',
    3419  *                            'login_post', 'admin', 'relative', 'rest', 'rpc', or null. Default null.
     3420 *                            'login_post', 'admin', 'relative', 'rest', 'rpc', 'original', or null. Default null.
    34203421 * @return string $url URL with chosen scheme.
    34213422 */
    34223423function set_url_scheme( $url, $scheme = null ) {
     
    34263427                $scheme = is_ssl() ? 'https' : 'http';
    34273428        } elseif ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc' ) {
    34283429                $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
     3430        } elseif ( $scheme === 'original' ) {
     3431                $scheme = 'https://' === substr( $url, 0, 8 ) ? 'https' : 'http';
    34293432        } elseif ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative' ) {
    34303433                $scheme = is_ssl() ? 'https' : 'http';
    34313434        }
     
    34503453         * @param string      $url         The complete URL including scheme and path.
    34513454         * @param string      $scheme      Scheme applied to the URL. One of 'http', 'https', or 'relative'.
    34523455         * @param string|null $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
    3453          *                                 'login_post', 'admin', 'relative', 'rest', 'rpc', or null.
     3456         *                                 'login_post', 'admin', 'relative', 'rest', 'rpc', 'original', or null.
    34543457         */
    34553458        return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
    34563459}