Added Index library to Uiharu.
This commit is contained in:
parent
1ae7ec9f19
commit
0a668992d9
12 changed files with 217 additions and 548 deletions
40
uiharu.php
Normal file
40
uiharu.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
namespace Uiharu;
|
||||
|
||||
use Index\Autoloader;
|
||||
use Index\Environment;
|
||||
use Index\Data\ConnectionFailedException;
|
||||
use Index\Data\DbTools;
|
||||
|
||||
define('UIH_STARTUP', microtime(true));
|
||||
define('UIH_ROOT', __DIR__);
|
||||
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', '20220714');
|
||||
define('UIH_SEM_NAME', 'U');
|
||||
define('UIH_SEM_PATH', sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'uiharu');
|
||||
|
||||
require_once UIH_LIBRARY . '/index/index.php';
|
||||
|
||||
Autoloader::addNamespace(__NAMESPACE__, UIH_SOURCE);
|
||||
Environment::setDebug(UIH_DEBUG);
|
||||
|
||||
mb_internal_encoding('utf-8');
|
||||
date_default_timezone_set('utc');
|
||||
|
||||
$configPath = UIH_ROOT . '/config.ini';
|
||||
if(!is_file($configPath))
|
||||
die('Uiharu configuration is missing.');
|
||||
|
||||
Config::load($configPath);
|
||||
if(!Config::has('Database', 'dsn'))
|
||||
die('Uiharu database is not configured.');
|
||||
|
||||
try {
|
||||
$db = DbTools::create(Config::get('Database', 'dsn'));
|
||||
} catch(ConnectionFailedException $ex) {
|
||||
echo '<h3>Unable to connect to database</h3>';
|
||||
die($ex->getMessage());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue