awaki/awaki.php

35 lines
920 B
PHP
Raw Normal View History

2022-07-03 23:14:15 +00:00
<?php
namespace Awaki;
use Index\Autoloader;
use Index\Environment;
use Index\Data\ConnectionFailedException;
use Index\Data\DbTools;
define('AWK_STARTUP', microtime(true));
define('AWK_ROOT', __DIR__);
define('AWK_DEBUG', is_file(AWK_ROOT . '/.debug'));
define('AWK_DIR_SRC', AWK_ROOT . '/src');
define('AWK_DIR_LIB', AWK_ROOT . '/lib');
define('AWK_DIR_PUB', AWK_ROOT . '/public');
define('AWK_DIR_CFG', AWK_ROOT . '/config');
2023-01-07 21:16:49 +00:00
define('AWK_DIR_DBM', AWK_ROOT . '/database');
2022-07-03 23:14:15 +00:00
require_once AWK_DIR_LIB . '/index/index.php';
2023-01-07 19:13:09 +00:00
Autoloader::addNamespace(__NAMESPACE__, AWK_DIR_SRC);
2022-07-03 23:14:15 +00:00
Environment::setDebug(AWK_DEBUG);
$config = parse_ini_file(AWK_DIR_CFG . '/config.ini');
if($config === false)
die('Config sux.');
try {
$db = DbTools::create($config['dsn']);
} catch(ConnectionFailedException $ex) {
echo '<h3>Unable to connect to database</h3>';
die($ex->getMessage());
}
2023-01-07 19:13:09 +00:00
$awk = new AwakiContext($db);