eesyphp/includes/core.php
Benjamin Renard f2edf4910a Switch to YAML configuration file, add Config & App classes in EesyPHP namespace
App initialization is now handle by App::init() method and all 
configuration information is now retreive using Config::get() method.
2023-02-08 02:27:15 +01:00

62 lines
1.5 KiB
PHP

<?php
use EesyPHP\App;
use EesyPHP\Config;
use EesyPHP\I18n;
use EesyPHP\SentrySpan;
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
// Root directory path
$script = null;
if (defined('__FILE__') && constant('__FILE__')) {
$script = __FILE__;
}
else {
// Fallback method : detect path from core.php path
foreach(get_included_files() as $script)
if (basename($script) == 'core.php')
break;
}
if (!$script) die('Fail to detect root directory path');
$root_dir_path = realpath(dirname($script).'/../');
// Include App's includes and vendor directories to PHP include paths
set_include_path($root_dir_path.'/includes' . PATH_SEPARATOR . get_include_path());
// Load composer autoload.php
require("$root_dir_path/vendor/autoload.php");
// Initialize EesyPHP application
App::init(
"$root_dir_path/includes/config.yml",
array(
'overwrite_config_files' => array(
"$root_dir_path/includes/config.local.yml",
),
),
$root_dir_path
);
$sentry_span = new SentrySpan('core.init', 'Core initialization');
require_once('functions.php');
// Nomenclatures
$status_list = array (
'pending' => I18n :: ___('Pending'),
'validated' => I18n :: ___('Validated'),
'refused' => I18n :: ___('Refused'),
'archived' => I18n :: ___('Archived'),
);
foreach($status_list as $key => $value)
$status_list[$key] = _($value);
require_once('cli.php');
require_once('templates.php');
require_once('url-helpers.php');
require_once('db.php');
$sentry_span->finish();
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab