Bail early for favicon.ico requests so we don't load WP twice. Props azaozz, sivel. Fixes #3426

git-svn-id: http://svn.automattic.com/wordpress/trunk@13205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-02-18 23:41:50 +00:00
parent 54c4ac3c8f
commit a60b801d5d
2 changed files with 17 additions and 0 deletions

View File

@ -104,6 +104,20 @@ function wp_check_php_mysql_versions() {
die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
}
/**
* Don't load all of WordPress when handling a favicon.ico request.
* Instead, send the headers for a zero-length favicon and bail.
*
* @since 3.0.0
*/
function wp_favicon_request() {
if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
header('Content-Type: image/vnd.microsoft.icon');
header('Content-Length: 0');
exit;
}
}
/**
* Dies with a maintenance message when conditions are met.
*

View File

@ -43,6 +43,9 @@ wp_fix_server_vars();
// Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions();
// Check if we have recieved a request due to missing favicon.ico
wp_favicon_request();
// Check if we're in maintenance mode.
wp_maintenance();