Make WordPress Core

Changeset 7441


Ignore:
Timestamp:
03/21/2008 04:10:01 AM (17 years ago)
Author:
markjaquith
Message:

better Apache mod detection from andy. fixes #6278

Location:
trunk
Files:
3 edited

Legend:

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

    r7407 r7441  
    780780
    781781    // If Mac and mod_security, no Flash. :(
    782     if ( function_exists('apache_getenv') && false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && 'on' == strtolower(apache_getenv('MODSEC_ENABLE')) )
     782    $flash = true;
     783    if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
    783784        $flash = false;
    784     else
    785         $flash = true;
    786785
    787786    $post_id = intval($_REQUEST['post_id']);
  • trunk/wp-admin/includes/misc.php

    r6551 r7441  
    22
    33function got_mod_rewrite() {
    4     global $is_apache;
    5 
    6     // take 3 educated guesses as to whether or not mod_rewrite is available
    7     if ( !$is_apache )
    8         return false;
    9 
    10     if ( function_exists( 'apache_get_modules' ) ) {
    11         if ( !in_array( 'mod_rewrite', apache_get_modules() ) )
    12             return false;
    13     }
    14 
    15     return true;
     4    return apache_mod_loaded('mod_rewrite');
    165}
    176
  • trunk/wp-includes/functions.php

    r7440 r7441  
    17181718    return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
    17191719}
     1720
     1721/**
     1722 * apache_mod_loaded() - Does the specified module exist in the apache config?
     1723 *
     1724 * @param string $mod e.g. mod_rewrite
     1725 * @return bool
     1726 */
     1727function apache_mod_loaded($mod) {
     1728    global $is_apache;
     1729
     1730    if ( !$is_apache )
     1731        return false;
     1732
     1733    if ( function_exists('apache_get_modules') ) {
     1734        $mods = apache_get_modules();
     1735        if ( in_array($mod, $mods) )
     1736            return true;
     1737    } else {
     1738            ob_start();
     1739            phpinfo(8);
     1740            $phpinfo = ob_get_clean();
     1741            if ( false !== strpos($phpinfo, $mod) )
     1742                return true;
     1743    }
     1744    return false;
     1745}
     1746
    17201747?>
Note: See TracChangeset for help on using the changeset viewer.