Update symfony configuration

pull/3544/head
Julio Montoya 4 years ago
parent 5cacc8712f
commit 0228138dd6
  1. 4
      .env
  2. 17
      composer.json
  3. 23
      config/bootstrap.php
  4. 17
      config/packages/cache.yaml
  5. 25
      config/packages/framework.yaml
  6. 5
      config/preload.php
  7. 6
      config/services.yaml
  8. 7
      public/index.php
  9. 25
      src/Kernel.php

@ -12,8 +12,10 @@ DATABASE_PASSWORD='{{DATABASE_PASSWORD}}'
###> symfony/framework-bundle ###
APP_ENV='dev'
APP_DEBUG='1'
APP_SECRET='{{APP_SECRET}}'
APP_DEBUG='1'
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###
###> chamilo ###

@ -11,13 +11,6 @@
"docs": "https://github.com/chamilo/docs",
"issues": "https://github.com/chamilo/chamilo-lms/issues"
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*"
},
"autoload": {
"psr-4": {
"Chamilo\\": "src/"
@ -44,10 +37,12 @@
"php": "^7.2.9",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-ctype": "*",
"ext-dom": "*",
"ext-exif": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-libxml": "*",
@ -145,6 +140,7 @@
"vich/uploader-bundle": "^1.13"
},
"config": {
"optimize-autoloader": true,
"component-dir": "public/assets",
"sort-packages": true
},
@ -168,6 +164,13 @@
"vimeo/psalm": "^3.14",
"weirdan/doctrine-psalm-plugin": "^0.11.3"
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*"
},
"scripts": {
"analyse": [
"@php vendor/bin/ecs check src",

@ -1,23 +0,0 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['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';

@ -1,25 +1,24 @@
framework:
cache:
# directory: '%kernel.cache_dir%/pools'
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# default_doctrine_provider: 'app.doctrine_cache'
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu
# app: cache.adapter.filesystem
# system: cache.adapter.system
# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null

@ -1,18 +1,19 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
form: true
secret: '%env(APP_SECRET)%'
csrf_protection: true
#esi: ~
#fragments: ~
php_errors:
log: true
http_method_override: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
# # handler_id set to null will use default session handler from php.ini
# handler_id: session.handler.native_file
# save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
handler_id: null
cookie_secure: auto
cookie_samesite: lax
name: chamilo2
http_method_override: true
# annotations:
# cache: file
# file_cache_dir: "%kernel.cache_dir%/annotations"
serializer: {enable_annotations: true}
#esi: true
#fragments: true
php_errors:
log: true
serializer: {enable_annotations: true}

@ -0,0 +1,5 @@
<?php
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}

@ -12,8 +12,8 @@ parameters:
- 'GeneratorBundle::fields.html.twig'
course_info_is_not_editable: false
# router.request_context.base_url: '%env(APP_URL_APPEND)%'
# asset.request_context.base_path: '%env(APP_URL_APPEND)%'
# router.request_context.base_url: '%env(APP_URL_APPEND)%'
# asset.request_context.base_path: '%env(APP_URL_APPEND)%'
# See https://glide.thephpleague.com/1.0/api/quick-reference/
glide_media_filters:
@ -41,7 +41,7 @@ services:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: true # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
Chamilo\CoreBundle\Component\Utils\Glide:

@ -3,10 +3,13 @@
/* For licensing terms, see /license.txt */
use Chamilo\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
@ -15,7 +18,7 @@ if ($_SERVER['APP_DEBUG']) {
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {

@ -6,7 +6,6 @@ namespace Chamilo;
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
@ -15,18 +14,6 @@ class Kernel extends BaseKernel
{
use MicroKernelTrait;
//private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function registerBundles(): iterable
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
}
}
public function getProjectDir(): string
{
return \dirname(__DIR__);
@ -56,18 +43,8 @@ class Kernel extends BaseKernel
return !empty($this->getContainer()->getParameter('installed'));
}
protected function configureContainer(ContainerConfigurator $container, LoaderInterface $loader): void
protected function configureContainer(ContainerConfigurator $container): void
{
/*$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
$container->setParameter('container.dumper.inline_factories', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');*/
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/'.$this->environment.'/*.yaml');
$container->import('../config/{services}.yaml');

Loading…
Cancel
Save