Skip to content

Commit 0d65ce1

Browse files
committed
Internal - Improve global.inc.php loading (disable debug) +fix error tpl
1 parent b827e9a commit 0d65ce1

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

public/main/inc/global.inc.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Patchwork\Utf8\Bootup;
77
use Symfony\Component\Dotenv\Dotenv;
88
use Symfony\Component\ErrorHandler\Debug;
9+
use Symfony\Component\HttpFoundation\Request;
910
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
1011

1112
/**
@@ -16,8 +17,6 @@
1617
require_once __DIR__.'/../../../vendor/autoload.php';
1718

1819
try {
19-
// Check the PHP version
20-
api_check_php_version();
2120

2221
// Get settings from .env.local file created.
2322
$envFile = __DIR__.'/../../../.env.local';
@@ -29,10 +28,14 @@
2928
}
3029

3130
$env = $_SERVER['APP_ENV'] ?? 'dev';
32-
//Debug::enable();
33-
$kernel = new Chamilo\Kernel($env, true);
31+
$debug = 'dev' === $env;
32+
if ($debug) {
33+
Debug::enable();
34+
}
35+
36+
$kernel = new Chamilo\Kernel($env, $debug);
3437
// Loading Request from Sonata. In order to use Sonata Pages Bundle.
35-
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
38+
$request = Request::createFromGlobals();
3639

3740
// This 'load_legacy' variable is needed to know that symfony is loaded using old style legacy mode,
3841
// and not called from a symfony controller from public/
@@ -65,6 +68,7 @@
6568

6669
$container = $kernel->getContainer();
6770

71+
// Load legacy configuration.php
6872
if ($kernel->isInstalled()) {
6973
require_once $kernel->getConfigurationFile();
7074
} else {
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
{% extends '@ChamiloCore/Layout/base-layout.html.twig' %}
22
{% block page_content %}
3-
<div class="error-page">
4-
<div class="error-content">
5-
{{ exception.message }}
6-
</div>
3+
<div
4+
id="app"
5+
>
76
</div>
7+
<section id="sectionMainContent" class="section-content">
8+
<div class="jumbotron jumbotron-fluid">
9+
<div class="container">
10+
<h1 class="display-4">Error</h1>
11+
<p class="lead"> {{ exception.message }}</p>
12+
</div>
13+
</div>
14+
</section>
815
{% endblock %}

0 commit comments

Comments
 (0)