示例#1
0
        $headers = [];
        foreach (headers_list() as $header) {
            list($name, $value) = explode(':', $header, 2);
            $headers[strtolower(trim($name))][] = trim($value);
        }
        if (isset($headers['set-cookie'])) {
            $cacheControl = isset($headers['cache-control']) ? implode(', ', $headers['cache-control']) : '';
            if (!preg_match('/(?:^|,)\\s*(?:private|no-cache|no-store)\\s*(?:$|,)/i', $cacheControl)) {
                header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
                header('Cache-Control: private, max-age=0, s-maxage=0');
                MediaWiki\Logger\LoggerFactory::getInstance('cache-cookies')->warning('Cookies set on {url} with Cache-Control "{cache-control}"', ['url' => WebRequest::getGlobalRequestURL(), 'cookies' => $headers['set-cookie'], 'cache-control' => $cacheControl ?: '<not set>']);
            }
        }
    });
}
MWExceptionHandler::installHandler();
require_once "{$IP}/includes/compat/normal/UtfNormalUtil.php";
$ps_validation = Profiler::instance()->scopedProfileIn($fname . '-validation');
// T48998: Bail out early if $wgArticlePath is non-absolute
foreach (['wgArticlePath', 'wgVariantArticlePath'] as $varName) {
    if (${$varName} && !preg_match('/^(https?:\\/\\/|\\/)/', ${$varName})) {
        throw new FatalError("If you use a relative URL for \${$varName}, it must start " . 'with a slash (<code>/</code>).<br><br>See ' . "<a href=\"https://www.mediawiki.org/wiki/Manual:\${$varName}\">" . "https://www.mediawiki.org/wiki/Manual:\${$varName}</a>.");
    }
}
Profiler::instance()->scopedProfileOut($ps_validation);
$ps_default2 = Profiler::instance()->scopedProfileIn($fname . '-defaults2');
if ($wgCanonicalServer === false) {
    $wgCanonicalServer = wfExpandUrl($wgServer, PROTO_HTTP);
}
// Set server name
$serverParts = wfParseUrl($wgCanonicalServer);