Updated Uiharu to latest Index + use CacheProvider for caching results.

This commit is contained in:
flash 2024-10-23 19:40:47 +00:00
parent c581646f23
commit 26431aeb79
13 changed files with 827 additions and 151 deletions

View file

@ -1,8 +1,8 @@
<?php
namespace Uiharu;
use Index\Data\DbTools;
use Syokuhou\SharpConfig;
use Index\Cache\CacheBackends;
use Index\Config\Fs\FsConfig;
define('UIH_STARTUP', microtime(true));
define('UIH_ROOT', __DIR__);
@ -10,7 +10,7 @@ define('UIH_DEBUG', is_file(UIH_ROOT . '/.debug'));
define('UIH_PUBLIC', UIH_ROOT . '/public');
define('UIH_SOURCE', UIH_ROOT . '/src');
define('UIH_LIBRARY', UIH_ROOT . '/lib');
define('UIH_VERSION', '20240330');
define('UIH_VERSION', '20241023');
require_once UIH_ROOT . '/vendor/autoload.php';
@ -18,7 +18,7 @@ error_reporting(UIH_DEBUG ? -1 : 0);
mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT');
$cfg = SharpConfig::fromFile(UIH_ROOT . '/uiharu.cfg');
$cfg = FsConfig::fromFile(UIH_ROOT . '/uiharu.cfg');
if($cfg->hasValues('sentry:dsn'))
(function($cfg) {
@ -33,7 +33,5 @@ if($cfg->hasValues('sentry:dsn'))
});
})($cfg->scopeTo('sentry'));
$db = DbTools::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\';');
$ctx = new UihContext($db, $cfg);
$cache = CacheBackends::create($cfg->getString('cache:dsn', 'array:'));
$ctx = new UihContext($cache, $cfg);