Variable DRUPAL_REQUEST_PHPConst
DRUPAL_REQUEST_PHP: "\nuse Drupal\\Core\\Database\\Database;\nuse Drupal\\Core\\DrupalKernel;\nuse Drupal\\Core\\Site\\Settings;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\n// __CFW_FIBER_SHIM__\n// __CFW_HOST_HELPERS__\n// __CFW_PW_SERVE_INLINE__\nchdir('/drupal');\n\n$path = json_decode(__CFW_PATH__);\n$repeat = __CFW_REPEAT__;\n$bins = json_decode(__CFW_BINS__, true);\n$resetCid = __CFW_RESET_CID__;\n\n$_SERVER['HTTP_HOST'] = 'localhost';\n$_SERVER['SERVER_NAME'] = 'localhost';\n$_SERVER['SERVER_PORT'] = '80';\n$_SERVER['REQUEST_URI'] = $path;\n$_SERVER['REQUEST_METHOD'] = 'GET';\n$_SERVER['SCRIPT_NAME'] = '/index.php';\n$_SERVER['SCRIPT_FILENAME'] = '/drupal/index.php';\n$_SERVER['PHP_SELF'] = '/index.php';\n$_SERVER['DOCUMENT_ROOT'] = '/drupal';\n$_SERVER['REMOTE_ADDR'] = '127.0.0.1';\n$_SERVER['SERVER_SOFTWARE'] = 'workerd';\n$_SERVER['HTTP_USER_AGENT'] = 'workerd-site';\n$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';\n\n$mark = [];\n$clock = function () {\n\treturn microtime(true) * 1000;\n};\n$statements = function () {\n\treturn json_decode(cfw_host('cfwStats')(), true)['queryCount'] ?? 0;\n};\n\n$t0 = $clock();\ntry {\n\t// require_once returns true rather than the autoloader once the interpreter\n\t// has already loaded the file, and the interpreter persists between requests\n\tif (!isset($GLOBALS['__pw_autoloader']) || !is_object($GLOBALS['__pw_autoloader'])) {\n\t\t$GLOBALS['__pw_autoloader'] = require '/drupal/autoload.php';\n\t}\n\t$autoloader = $GLOBALS['__pw_autoloader'];\n\t$mark['autoloadMs'] = round($clock() - $t0, 2);\n\t$mark['warmInterpreter'] = isset($GLOBALS['__pw_site_booted']) ? 1 : 0;\n\n\tif (!isset($GLOBALS['__pw_kernel'])) {\n\t\t$a = $clock();\n\t\t$request = Request::create($path, 'GET');\n\t\t$kernel = new DrupalKernel('prod', $autoloader);\n\t\tDrupalKernel::bootEnvironment();\n\t\t$sitePath = DrupalKernel::findSitePath($request);\n\t\t$kernel->setSitePath($sitePath);\n\t\tSettings::initialize('/drupal', $sitePath, $autoloader);\n\t\t$mark['settingsMs'] = round($clock() - $a, 2);\n\n\t\t// prove the driver Drupal actually connected with, before anything renders\n\t\t$info = Database::getConnectionInfo('default');\n\t\t$mark['configuredDriver'] = $info['default']['driver'] ?? null;\n\n\t\t$a = $clock();\n\t\t$kernel->boot();\n\t\t$mark['kernelBootMs'] = round($clock() - $a, 2);\n\t\t$GLOBALS['__pw_kernel'] = $kernel;\n\t\t$GLOBALS['__pw_site_booted'] = true;\n\t}\n\t$kernel = $GLOBALS['__pw_kernel'];\n\n\t$connection = Database::getConnection();\n\t$mark['connectionClass'] = get_class($connection);\n\t$mark['driver'] = $connection->driver();\n\t$mark['engineVersion'] = $connection->version();\n\t$mark['engineVersionIsFloor'] = method_exists($connection, 'engineVersionIsFloor')\n\t\t? $connection->engineVersionIsFloor()\n\t\t: null;\n\n\t$runs = [];\n\tfor ($i = 0; $i < $repeat; $i++) {\n\t\t// Rule 3, and a query string is NOT enough to get past it. PageCache\n\t\t// memoizes $this->cid on the middleware instance, so on a persistent kernel\n\t\t// every URL maps to the first request's cid and re-serves its page -- the\n\t\t// measured shape was MISS then five HITs at 1 ms with byte-identical output\n\t\t// for six different URLs. Emptying the bin is what forces a real render.\n\t\t// $bust=0 leaves the cached path measurable.\n\t\t$target = $path;\n\t\tforeach ($bins as $bin) {\n\t\t\ttry {\n\t\t\t\tDrupal::cache($bin)->deleteAll();\n\t\t\t} catch (Throwable $e) {\n\t\t\t}\n\t\t}\n\t\t// PageCache memoizes $this->cid on the middleware instance, so a persistent\n\t\t// kernel maps every later URL onto the first request's cid and re-serves its\n\t\t// page. Measured: six different URLs returned byte-identical output. Nulling\n\t\t// it is what makes a distinct path actually route.\n\t\tif ($resetCid) {\n\t\t\ttry {\n\t\t\t\t$middleware = Drupal::service('http_middleware.page_cache');\n\t\t\t\t$rp = new ReflectionProperty($middleware, 'cid');\n\t\t\t\t$rp->setValue($middleware, null);\n\t\t\t} catch (Throwable $e) {\n\t\t\t}\n\t\t}\n\t\t$before = $statements();\n\t\t$a = $clock();\n\t\t$response = cfw_serve($target);\n\t\t$ms = round($clock() - $a, 2);\n\t\t$body = (string) $response->getContent();\n\t\t$runs[] = [\n\t\t\t'ms' => $ms,\n\t\t\t'status' => $response->getStatusCode(),\n\t\t\t'bytes' => strlen($body),\n\t\t\t'pageCache' => $response->headers->get('x-drupal-cache'),\n\t\t\t'dynamicCache' => $response->headers->get('x-drupal-dynamic-cache'),\n\t\t\t'hostStatements' => $statements() - $before,\n\t\t\t'titleFound' => str_contains($body, '<title>') ? 1 : 0,\n\t\t\t'sha1' => substr(sha1($body), 0, 12),\n\t\t];\n\t}\n\t$mark['runs'] = $runs;\n} catch (Throwable $e) {\n\t$mark['error'] = get_class($e) . ': ' . $e->getMessage();\n\t$mark['trace'] = substr($e->getTraceAsString(), 0, 1400);\n}\n\n$mark['totalMs'] = round($clock() - $t0, 2);\n$mark['includedFiles'] = count(get_included_files());\necho json_encode($mark);\n"