N°2060 [WIP] Initialisation of the portal application:

- Default env. is now production.
- Debug mode through url param. is now available like in Silex version
This commit is contained in:
Molkobain
2019-06-28 17:22:23 +02:00
parent 123e734046
commit ae8451e837
5 changed files with 13 additions and 7 deletions

View File

@@ -47,6 +47,12 @@ if(!defined('PORTAL_ID'))
define('PORTAL_ID', $sPortalId);
}
// Set debug mode only when necessary
if (utils::ReadParam('debug', 'false') === 'true')
{
$_SERVER['APP_DEBUG'] = true;
}
define('PORTAL_CACHE_PATH', utils::GetCachePath() . '/portals/' . PORTAL_ID . '/');
// Constants to be used in templates and others

View File

@@ -14,8 +14,8 @@
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=40ef8b29be00df19cec62edf08f73808
#APP_ENV=prod
#APP_SECRET=40ef8b29be00df19cec62edf08f73808
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS='^localhost|example\.com$'
###< symfony/framework-bundle ###

View File

@@ -27,7 +27,7 @@ if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
}
if (null === $env = (isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null))) {
$dotenv->populate(array('APP_ENV' => $env = 'dev'));
$dotenv->populate(array('APP_ENV' => $env = 'prod'));
}
if ('test' !== $env && file_exists($p = "$path.local")) {
@@ -46,6 +46,6 @@ if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = (isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) ?: 'dev';
$_SERVER['APP_DEBUG'] = (isset($_SERVER['APP_DEBUG']) ? $_SERVER['APP_DEBUG'] : (isset($_ENV['APP_DEBUG']) ? $_ENV['APP_DEBUG'] : 'prod')) !== $_SERVER['APP_ENV'];
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = (isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) ?: 'prod';
$_SERVER['APP_DEBUG'] = isset($_SERVER['APP_DEBUG']) ? $_SERVER['APP_DEBUG'] : (isset($_ENV['APP_DEBUG']) ? $_ENV['APP_DEBUG'] : ('prod' !== $_SERVER['APP_ENV']));
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

View File

@@ -48,7 +48,7 @@
</p>
</div>
{% if app['debug'] == true %}
{% if app['kernel'].debug == true %}
<div class="well">
<ol class="traces list_exception">
{% for aStep in debug_trace_steps %}

View File

@@ -296,7 +296,7 @@
<div class="logo">
{% block pNavigationSideMenuLogo %}
{# This is a debug helper to know in which screen size we are #}
{% if app['debug'] %}
{% if app['kernel'].debug == true %}
<div style="position: fixed; bottom: 0px; left: 0px; z-index: 9999;">Debug : Taille <span class="hidden-sm hidden-md hidden-lg">XS</span><span class="hidden-xs hidden-md hidden-lg">SM</span><span class="hidden-xs hidden-sm hidden-lg">MD</span><span class="hidden-xs hidden-sm hidden-md">LG</span></div>
{% endif %}
<a href="{{ get_config_parameter('app_icon_url') }}" title="{{ app['combodo.portal.instance.conf'].properties.name|dict_s }}">