mince/mince.php

39 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2022-07-03 22:07:00 +00:00
<?php
namespace Mince;
2024-10-05 14:48:18 +00:00
use Index\Config\Fs\FsConfig;
use Index\Db\DbBackends;
2022-07-03 22:07:00 +00:00
define('MCR_STARTUP', microtime(true));
define('MCR_ROOT', __DIR__);
define('MCR_DEBUG', is_file(MCR_ROOT . '/.debug'));
define('MCR_DIR_SRC', MCR_ROOT . '/src');
define('MCR_DIR_PUB', MCR_ROOT . '/public');
define('MCR_DIR_PRV', MCR_ROOT . '/private');
2023-08-16 21:18:12 +00:00
define('MCR_DIR_MIG', MCR_ROOT . '/database');
2023-08-16 22:39:35 +00:00
define('MCR_DIR_TPL', MCR_ROOT . '/templates');
2022-07-03 22:07:00 +00:00
2023-08-16 21:18:12 +00:00
require_once MCR_ROOT . '/vendor/autoload.php';
2022-07-03 22:07:00 +00:00
2024-08-04 23:01:33 +00:00
error_reporting(MCR_DEBUG ? -1 : 0);
mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT');
2022-07-03 22:07:00 +00:00
2024-10-05 14:48:18 +00:00
$cfg = FsConfig::fromFile(MCR_ROOT . '/mince.cfg');
2022-07-03 22:07:00 +00:00
2023-12-15 02:15:40 +00:00
if($cfg->hasValues('sentry:dsn'))
(function($cfg) {
\Sentry\init([
'dsn' => $cfg->getString('dsn'),
'traces_sample_rate' => $cfg->getFloat('tracesRate', 0.2),
'profiles_sample_rate' => $cfg->getFloat('profilesRate', 0.2),
]);
set_exception_handler(function(\Throwable $ex) {
\Sentry\captureException($ex);
});
})($cfg->scopeTo('sentry'));
$db = DbBackends::create($cfg->getString('database:dsn', 'null:'));
$db->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\';');