30 lines
827 B
PHP
30 lines
827 B
PHP
<?php
|
|
namespace Awaki;
|
|
|
|
use Index\Environment;
|
|
use Index\Data\ConnectionFailedException;
|
|
use Index\Data\DbTools;
|
|
use Syokuhou\SharpConfig;
|
|
|
|
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_PUB', AWK_ROOT . '/public');
|
|
define('AWK_DIR_CFG', AWK_ROOT . '/config');
|
|
define('AWK_DIR_DBM', AWK_ROOT . '/database');
|
|
|
|
require_once AWK_ROOT . '/vendor/autoload.php';
|
|
|
|
Environment::setDebug(AWK_DEBUG);
|
|
|
|
$config = SharpConfig::fromFile(AWK_DIR_CFG . '/config.cfg');
|
|
|
|
try {
|
|
$db = DbTools::create($config->getString('dsn'));
|
|
} catch(ConnectionFailedException $ex) {
|
|
echo '<h3>Unable to connect to database</h3>';
|
|
die($ex->getMessage());
|
|
}
|
|
|
|
$awk = new AwakiContext($db, $config->scopeTo('urls'));
|