-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
59 lines (52 loc) · 1.46 KB
/
index.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require('./vendor/autoload.php');
mb_internal_encoding('UTF-8');
try {
Wcms\Logger::init('w_error.log', 2);
} catch (RuntimeException $e) {
die('Unable to init logs: ' . $e->getMessage());
}
$app = new Wcms\Application();
$app->wakeup();
session_set_cookie_params([
'path' => '/' . Wcms\Config::basepath(),
'samesite' => 'Strict',
'secure' => Wcms\Config::issecure()
]);
session_start();
if (class_exists('Whoops\Run') && !empty(Wcms\Config::debug())) {
$whoops = new \Whoops\Run();
$handler = new \Whoops\Handler\PrettyPageHandler();
$handler->setEditor(\Wcms\Config::debug());
$whoops->pushHandler($handler);
$whoops->register();
}
if (isreportingerrors()) {
Sentry\init([
'dsn' => Wcms\Config::sentrydsn(),
'release' => getversion(),
]);
Sentry\configureScope(function ($scope) {
$scope->setUser([
'id' => Wcms\Config::url(),
'username' => Wcms\Config::basepath(),
]);
});
}
try {
$matchoper = new Wcms\Routes();
$matchoper->match();
} catch (Throwable $e) {
if (isreportingerrors()) {
Sentry\captureException($e);
}
Wcms\Logger::errorex($e, true);
http_response_code(500);
if (isset($whoops)) {
$whoops->handleException($e);
}
echo '<h1>⚠ Whoops ! There is a little problem : </h1>';
echo `<p>` . $e->getMessage() . '</p>';
echo '<p>Please contact yout Wiki admin to solve this.</p>';
}
Wcms\Logger::close();