WordPress.org

Make WordPress Core

Ticket #41877: 41877.patch

File 41877.patch, 2.6 KB (added by viliamkopecky, 3 years ago)

adding and using of $is_caddy global variable

  • wp-admin/includes/misc.php

    diff --git wp-admin/includes/misc.php wp-admin/includes/misc.php
    index 21baace..3a4333f 100644
    function got_mod_rewrite() { 
    3939 * @since 3.7.0
    4040 *
    4141 * @global bool $is_nginx
     42 * @global bool $is_caddy
    4243 *
    4344 * @return bool Whether the server supports URL rewriting.
    4445 */
    4546function got_url_rewrite() {
    46         $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
     47        $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || $GLOBALS['is_caddy'] || iis7_supports_permalinks() );
    4748
    4849        /**
    4950         * Filters whether URL rewriting is available.
  • wp-admin/options-permalink.php

    diff --git wp-admin/options-permalink.php wp-admin/options-permalink.php
    index c7193f9..2fb1bd6 100644
    if ( $iis7_permalinks ) { 
    7575                $writable = true;
    7676        else
    7777                $writable = false;
    78 } elseif ( $is_nginx ) {
     78} elseif ( $is_nginx || $is_caddy ) {
    7979        $writable = false;
    8080} else {
    8181        if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
    if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { 
    134134                } elseif ( $permalink_structure && ! $using_index_permalinks && $writable ) {
    135135                        $message = __( 'Permalink structure updated. Remove write access on web.config file now!' );
    136136                }
    137         } elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) {
     137        } elseif ( ! $is_nginx  && ! $is_caddy && $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) {
    138138                $message = __( 'You should update your .htaccess now.' );
    139139        }
    140140
  • wp-includes/vars.php

    diff --git wp-includes/vars.php wp-includes/vars.php
    index 89b3532..fa402a0 100644
     
    1717
    1818global $pagenow,
    1919        $is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE, $is_edge,
    20         $is_apache, $is_IIS, $is_iis7, $is_nginx;
     20        $is_apache, $is_IIS, $is_iis7, $is_nginx, $is_caddy;
    2121
    2222// On which page are we ?
    2323if ( is_admin() ) {
    $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos( 
    106106$is_nginx = (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false);
    107107
    108108/**
     109 * Whether the server software is Caddy or something else
     110 * @global bool $is_caddy
     111 */
     112$is_caddy = (strpos($_SERVER['SERVER_SOFTWARE'], 'Caddy') !== false);
     113
     114/**
    109115 * Whether the server software is IIS or something else
    110116 * @global bool $is_IIS
    111117 */