-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathInit.php
42 lines (37 loc) · 1.18 KB
/
Init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php declare(strict_types = 1);
/* Idea (c) 2023 Nikita Zhavoronkov, [email protected]
* Copyright (c) 2023 3xpl developers, [email protected], see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */
/* This is the initialization script */
require_once __DIR__ . '/Engine/Env.php';
require_once __DIR__ . '/Engine/Enums.php';
require_once __DIR__ . '/Engine/Exceptions.php';
require_once __DIR__ . '/Engine/Helpers.php';
require_once __DIR__ . '/Engine/Requester.php';
require_once __DIR__ . '/Engine/Database.php';
require_once __DIR__ . '/Engine/ModuleInterface.php';
spl_autoload_register(function($class)
{
if (file_exists(__DIR__ . "/Modules/{$class}.php"))
{
include __DIR__ . "/Modules/{$class}.php";
}
elseif (file_exists(__DIR__ . "/Modules/Common/{$class}.php"))
{
include __DIR__ . "/Modules/Common/{$class}.php";
}
else
{
throw new DeveloperError("Class {$class} not found");
}
});
try
{
parse_env_file();
}
catch (Throwable $e)
{
$error_class = get_class($e);
echo cli_format_error("CRITICAL: couldn't read the config file. Caught {$error_class}: " . print_e($e, true)) . "\n";
die();
}