if ($batcache->do !== false && isset($batcache->cache['version']) && $batcache->cache['version'] < $batcache->url_version) { $batcache->genlock = wp_cache_add("{$batcache->url_key}_genlock", 1, $batcache->group, 10); } // Temporary: remove after 2010-11-12. I added max_age to the cache. This upgrades older caches on the fly. if (!isset($batcache->cache['max_age'])) { $batcache->cache['max_age'] = $batcache->max_age; } // Did we find a batcached page that hasn't expired? if (isset($batcache->cache['time']) && !$batcache->genlock && time() < $batcache->cache['time'] + $batcache->cache['max_age']) { // Issue redirect if cached and enabled if ($batcache->cache['redirect_status'] && $batcache->cache['redirect_location'] && $batcache->cache_redirects) { $status = $batcache->cache['redirect_status']; $location = $batcache->cache['redirect_location']; // From vars.php $is_IIS = strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false; $batcache->do_headers($batcache->headers); if ($is_IIS) { header("Refresh: 0;url={$location}"); } else { if (php_sapi_name() != 'cgi-fcgi') { $texts = array(300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Reserved', 307 => 'Temporary Redirect'); $protocol = $_SERVER["SERVER_PROTOCOL"]; if ('HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol) { $protocol = 'HTTP/1.0'; } if (isset($texts[$status])) { header("{$protocol} {$status} " . $texts[$status]); } else { header("{$protocol} 302 Found"); } }