Moved database methods into own context class.

This commit is contained in:
flash 2025-02-09 17:39:48 +00:00
parent 21a730d189
commit bac889787a
14 changed files with 94 additions and 62 deletions

View file

@ -1,8 +1,6 @@
<?php
namespace Misuzu;
use Index\Db\DbBackends;
use Index\Config\Db\DbConfig;
use Index\Config\Fs\FsConfig;
define('MSZ_STARTUP', microtime(true));
@ -37,14 +35,4 @@ if($env->hasValues('sentry:dsn'))
});
})($env->scopeTo('sentry'));
$db = DbBackends::create($env->getString('database:dsn', 'null:'));
$db->execute(<<<SQL
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';
SQL);
$cfg = new DbConfig($db, 'msz_config');
Mailer::init($cfg->scopeTo('mail'));
$msz = new MisuzuContext($db, $cfg, $env);
$msz = new MisuzuContext($env);