Updated recipes of console + Validator

This commit is contained in:
Jan Böhmer 2020-01-07 19:00:11 +01:00
parent 64cf8097bc
commit 36f2420cf5
6 changed files with 35 additions and 42 deletions

View file

@ -4,7 +4,11 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\ErrorHandler\Debug;
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
}
set_time_limit(0);

View file

@ -1,24 +1,4 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
use Symfony\Component\Dotenv\Dotenv;
@ -26,9 +6,10 @@ require dirname(__DIR__).'/vendor/autoload.php';
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
$_SERVER += $env;
$_ENV += $env;
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV']) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
@ -36,6 +17,7 @@ if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
(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';

View file

@ -0,0 +1,3 @@
framework:
validation:
not_compromised_password: false

View file

@ -1,3 +1,8 @@
framework:
validation:
email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []

View file

@ -27,12 +27,12 @@ DirectoryIndex index.php
# work in environments without path prefix as well, providing a safe, one-size
# fits all solution. But as you do not need it in this case, you can comment
# the following 2 lines to eliminate the overhead.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
# Redirect to URI without front controller to prevent duplicate content
# (with and without `/index.php`). Only do this redirect on the initial
@ -45,15 +45,13 @@ DirectoryIndex index.php
# - disable this feature by commenting the following 2 lines or
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
# following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# Rewrite all other queries to the front controller.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>

View file

@ -235,7 +235,7 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "0cd4d2d0e7f646fda75f9944f747a56e6ed13d4c"
"ref": "7c0a9352a57376f04f5444e74565102c3a23d0c7"
},
"files": [
"./config/packages/nyholm_psr7.yaml"
@ -419,7 +419,7 @@
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "1.0",
"ref": "c82bead70f9a4f656354a193df7bf0ca2114efa0"
"ref": "410b9325a37ef86f1e47262c61738f6202202bca"
},
"files": [
"./public/.htaccess"
@ -441,12 +441,12 @@
"version": "v4.2.3"
},
"symfony/console": {
"version": "3.3",
"version": "4.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "0fa049c19069a65f52c1c181d64be3de672c1504"
"version": "4.4",
"ref": "fead3ab2e80622c61d13dac0d21a3430a45efae8"
},
"files": [
"./bin/console",
@ -510,7 +510,7 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "dc3fc2e0334a4137c47cfd5a3ececc601fa61a0b"
"ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e"
},
"files": [
"./.env"
@ -709,7 +709,7 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "1fb02a6e1c8f3d4232cce485c9afa868d63b115a"
"ref": "2ad9d2545bce8ca1a863e50e92141f0b9d87ffcd"
},
"files": [
"./config/packages/translation.yaml",
@ -737,14 +737,15 @@
]
},
"symfony/validator": {
"version": "4.1",
"version": "4.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.1",
"ref": "0cdc982334f45d554957a6167e030482795bf9d7"
"version": "4.3",
"ref": "d902da3e4952f18d3bf05aab29512eb61cabd869"
},
"files": [
"./config/packages/test/validator.yaml",
"./config/packages/validator.yaml"
]
},