Replaced timings in the footer with a visual for the Server-Timing header.

This commit is contained in:
flash 2025-04-03 19:40:10 +00:00
parent ceb6bece09
commit 83068a4183
Signed by: flash
GPG key ID: 2C9C2C574D47FE3E
17 changed files with 246 additions and 65 deletions

View file

@ -1,31 +1,41 @@
<?php
namespace Misuzu;
define('MSZ_STARTUP', microtime(true));
define('MSZ_STARTUP', hrtime(true));
define('MSZ_ROOT', __DIR__);
require_once __DIR__ . '/vendor/autoload.php';
\Dotenv\Dotenv::createImmutable(Misuzu::PATH_ROOT)->load();
$msz = (function() {
$timings = new \Index\Performance\Timings(
new \Index\Performance\Stopwatch(MSZ_STARTUP),
);
if(!empty($_ENV['SENTRY_DSN']))
\Sentry\init(['dsn' => $_ENV['SENTRY_DSN']]);
try {
\Dotenv\Dotenv::createImmutable(Misuzu::PATH_ROOT)->load();
(function(\Whoops\RunInterface $whoops) {
if(Misuzu::cli())
$whoops->pushHandler(new Whoops\SentryPlainTextHandler);
elseif(Misuzu::debug())
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
else
$whoops->pushHandler(new Whoops\SentryPageHandler);
if(!empty($_ENV['SENTRY_DSN']))
\Sentry\init(['dsn' => $_ENV['SENTRY_DSN']]);
$whoops->register();
})(new \Whoops\Run);
$whoops = new \Whoops\Run;
if(Misuzu::cli())
$whoops->pushHandler(new Whoops\SentryPlainTextHandler);
elseif(Misuzu::debug())
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
else
$whoops->pushHandler(new Whoops\SentryPageHandler);
$msz = new MisuzuContext(
$_ENV['DATABASE_DSN'] ?? 'null:',
$_ENV['DOMAIN_ROLES'] ?? 'localhost=main,redirect,storage',
$_ENV['STORAGE_PATH_LOCAL'] ?? Misuzu::PATH_STORAGE,
$_ENV['STORAGE_PATH_REMOTE'] ?? '/_storage',
$_ENV['TEMPLATE_CACHE'] ?? '',
);
$whoops->register();
return new MisuzuContext(
$timings,
$_ENV['DATABASE_DSN'] ?? 'null:',
$_ENV['DOMAIN_ROLES'] ?? 'localhost=main,redirect,storage',
$_ENV['STORAGE_PATH_LOCAL'] ?? Misuzu::PATH_STORAGE,
$_ENV['STORAGE_PATH_REMOTE'] ?? '/_storage',
$_ENV['TEMPLATE_CACHE'] ?? '',
);
} finally {
$timings->lap('startup');
}
})();