Internal - Improve global.inc.php loading (disable debug) +fix error tpl

pull/3464/head
Julio Montoya 5 years ago
parent b827e9a996
commit 0d65ce1e8b
  1. 14
      public/main/inc/global.inc.php
  2. 15
      src/CoreBundle/Resources/views/Exception/error.html.twig

@ -6,6 +6,7 @@ use Chamilo\CoreBundle\Framework\Container;
use Patchwork\Utf8\Bootup;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
/**
@ -16,8 +17,6 @@ define('USERNAME_MAX_LENGTH', 100);
require_once __DIR__.'/../../../vendor/autoload.php';
try {
// Check the PHP version
api_check_php_version();
// Get settings from .env.local file created.
$envFile = __DIR__.'/../../../.env.local';
@ -29,10 +28,14 @@ try {
}
$env = $_SERVER['APP_ENV'] ?? 'dev';
//Debug::enable();
$kernel = new Chamilo\Kernel($env, true);
$debug = 'dev' === $env;
if ($debug) {
Debug::enable();
}
$kernel = new Chamilo\Kernel($env, $debug);
// Loading Request from Sonata. In order to use Sonata Pages Bundle.
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$request = Request::createFromGlobals();
// This 'load_legacy' variable is needed to know that symfony is loaded using old style legacy mode,
// and not called from a symfony controller from public/
@ -65,6 +68,7 @@ try {
$container = $kernel->getContainer();
// Load legacy configuration.php
if ($kernel->isInstalled()) {
require_once $kernel->getConfigurationFile();
} else {

@ -1,8 +1,15 @@
{% extends '@ChamiloCore/Layout/base-layout.html.twig' %}
{% block page_content %}
<div class="error-page">
<div class="error-content">
{{ exception.message }}
</div>
<div
id="app"
>
</div>
<section id="sectionMainContent" class="section-content">
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-4">Error</h1>
<p class="lead"> {{ exception.message }}</p>
</div>
</div>
</section>
{% endblock %}

Loading…
Cancel
Save