New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flex structure #7115
base: master
Are you sure you want to change the base?
Flex structure #7115
Conversation
app/config/config.yaml
Outdated
@@ -25,3 +24,4 @@ imports: | |||
- { resource: ../../config/packages/twig.yaml } | |||
- { resource: ../../config/packages/validator.yaml } | |||
- { resource: ../../config/packages/wallabag.yaml } | |||
- { resource: ../../config/services.yaml } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Load services after packages: this move is done because it's the way the new Kernel will load them
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Wallabag\Kernel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decided to use Wallabag as root namespace instead of the default App one.
config/routes/dev/routes.yaml
Outdated
_profiler: | ||
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" | ||
prefix: /_profiler | ||
WebProfilerBundle: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the bundle name here as done in the recipe, I applied this pattern for other routes move, as there is no chances that the bundle name is used as a route name, so no conflicts
@@ -27,7 +27,7 @@ | |||
<name>{{ user }}</name> | |||
</author> | |||
<icon>{{ asset('favicon.ico') }}</icon> | |||
<logo>{{ asset('bundles/wallabagcore/themes/_global/img/logo-square.png') }}</logo> | |||
<logo>{{ asset('img/logo-square.png') }}</logo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really sure about this one to be honest, but it looks it was broken before as there is no themes/_global/img/logo-square.png
in CoreBundle
@@ -4,6 +4,7 @@ imports: | |||
- { resource: parameters_addons.yaml } | |||
|
|||
parameters: | |||
env(APP_SECRET): '%secret%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the trick to preserve BC! if the APP_SECRET env var is not set, it will use the value from the %secret%
parameter!
config/packages/test/monolog.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a pure copy of the one from dev config, as the test config was extending from dev one, but there one this monolog config and a single setting that needed to be added, so no more extending from dev
@@ -1,5 +1,6 @@ | |||
framework: | |||
profiler: | |||
only_exceptions: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comes from the dev config
@@ -1,3 +1,6 @@ | |||
imports: | |||
- { resource: parameters_test.yaml } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed so tests get parameters test values to override defaults ones from normal parameters.yml, as we're not using env vars (yet)
@@ -0,0 +1,6 @@ | |||
###> symfony/framework-bundle ### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even not installed with Flex, used this syntax so Flex is ready to identify those places when we will install it and update recipes
@@ -0,0 +1,6 @@ | |||
###> symfony/framework-bundle ### | |||
APP_ENV=dev | |||
APP_SECRET=CHANGE_ME_TO_SOMETHING_SECRET_AND_RANDOM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
being here it means dev setup will use the env var, so this needs to be updated.
maybe I should remove it? kept it because it impacts only dev setup, not prod ones
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%" | ||
cookie_secure: auto | ||
fragments: ~ | ||
http_method_override: true | ||
cookie_samesite: lax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one I decide to keep it as it's security related
config/routes/dev/framework.yaml
Outdated
@@ -0,0 +1,3 @@ | |||
_errors: | |||
resource: '@FrameworkBundle/Resources/config/routing/errors.xml' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should remove some deprecation :)
# App\: | ||
# resource: '../src/' | ||
# exclude: | ||
# - '../src/DependencyInjection/' | ||
# - '../src/Entity/' | ||
# - '../src/Kernel.php' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kept this as a model for later
#php_errors: | ||
# log: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented as was not in our config
web/app.php
Outdated
$response = $kernel->handle($request); | ||
$response->send(); | ||
$kernel->terminate($request, $response); | ||
require __DIR__ . '/../public/index.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the trick that keeps BC, keeping the app.php file but internally using the new index one.
small BC break here is for users who have altered their app.php file to use the AppCache, now they'll need to alter the index.php to use CacheKernel.
see https://symfony.com/doc/4.4/http_cache.html#symfony-reverse-proxy
I think it's acceptable as I don't think users do that, maybe I'm wrong
0e9ff13
to
9aead7c
Compare
9aead7c
to
cd8ff08
Compare
cd8ff08
to
9da333a
Compare
23082dc
to
70c02e8
Compare
when@ENV
notationThis PR is initiated from the work on #6850 as it needed the some files to be updated from their updated version from Flex recipes, namely the framework-bundle, console and phpunit-bridge recipes.
So I decided to extract that update in a separate PR, but instead of updating just the files the other PR needed, partially taking the content from the recipe, I decided that it could be the opportunity to embrasse the new Flex structure, and update completely the files from above listed recipes, and all this without yet using Flex itself!
As I want this to be accepted in a minor version of wallabag, so that we can advance on upgrading to Symfony 5, I did my best to make the changes in a backward compatible way!
What I mean by "BC way"?
I covered by this (draft) BC policy the case of users using wallabag "as is", not customizing its code or something else, just configure the parameters requested during the setup and that's it.
And I want them to be able to upgrade their wallabag instance to the new minor, is it setup by the Docker, a git clone, or via ZIP file.
So I identified those critical pieces that must stay so that an upgrade setup continues to work:
Leaving those elements should keep a setup working, even if wallabag internals change!
It may look like a very big PR, 62 commits, 188 files changed, +989 lines −786 lines... but I don't think it is!
I did my best to tell a story, showing the path I went through to achieve the goal, with baby steps.
This means that even if they are lot of commits, each should be a very easy to review!
So you guessed it, the recommended way to review this is commit by commit, open each in a new tab.
One important thing: I did my best to keep tests green at each commit!
Hope those efforts will really help reviewing this PR :)
I'm opening this PR as draft but it's not, it's just that there are some fixup commits that don't make sense on their own that I'd like to squash before merge, but are there to highlight some minor changes that are needed by the commit they fix to make it work.
Those changes would have been hard to catch if done directly along other changes of the commit they fix.
I will go through the commits and add some commit related comments to add more details.
Next steps:
env(MY_VAR): '%my_var%'
fallback syntax