Skip to content
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

Draft
wants to merge 82 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
2a118a4
Regenerate PHPStan baseline
yguedidi Jan 2, 2024
b95882c
Upgrade to Symfony 5.4
yguedidi Jan 8, 2024
d67f965
Use error routing from FrameworkBundle
yguedidi Dec 24, 2023
3a54681
Fix JPEG images extension
yguedidi Dec 24, 2023
2c59a78
Update PHP dependencies
yguedidi Jan 8, 2024
72a5941
Explicitly add Symfony polyfills for PHP 8.0 and 8.1
yguedidi Jan 1, 2024
937ae28
Apply PHP-CS-Fixer fixes
yguedidi Jan 1, 2024
1cc5a09
Fix PHPStan configuration
yguedidi Jan 1, 2024
272a069
Fix PHPStan errors
yguedidi Jan 1, 2024
122e293
Make RabbitMQConsumerTotalProxy non-lazy
yguedidi Jan 1, 2024
08a813e
Bump PHP dependencies
yguedidi Jan 2, 2024
101b356
Remove most self deprecation notices
yguedidi Jan 9, 2024
ef52786
Remove all direct deprecation notices
yguedidi Jan 10, 2024
ecf08d8
Remove need for TEST_DATABASE_PATH
yguedidi Jan 14, 2024
4f772fd
Migrate from *.yml to *.yaml for configuration files
yguedidi Dec 10, 2023
12d37f7
Move test parameters template files
yguedidi Dec 10, 2023
158ee58
Move Webpack config
yguedidi Dec 10, 2023
463c4a8
Move Wallabag config
yguedidi Dec 10, 2023
2c608c5
Remove useless framework configuration
yguedidi Dec 10, 2023
ad4eef9
Move Routing config
yguedidi Dec 10, 2023
49aa373
Move Translation config
yguedidi Dec 10, 2023
fe4bdd7
Move Mailer config
yguedidi Dec 10, 2023
bb11829
Move Validator config
yguedidi Dec 10, 2023
ba6ac85
Move WebProfiler config
yguedidi Dec 10, 2023
6dc8eb3
Move Framework config
yguedidi Dec 10, 2023
6334e6d
Move Doctrine config
yguedidi Dec 10, 2023
ff9e3dc
Move Monolog config
yguedidi Dec 10, 2023
5e2740f
Move Sentry config
yguedidi Dec 10, 2023
3cbf37e
Move Twig config
yguedidi Dec 10, 2023
5941643
Move DoctrineMigrations config
yguedidi Dec 10, 2023
ddf9a06
Move StofDoctrineExtensions config
yguedidi Dec 10, 2023
79e0897
Move FOSRestBundle config
yguedidi Dec 10, 2023
fbe23c1
Move NelmioApiDocBundle config
yguedidi Dec 10, 2023
39c8175
Move NelmioCorsBundle config
yguedidi Dec 10, 2023
b7286cc
Move FOSUserBundle config
yguedidi Dec 10, 2023
6f29eae
Move FOSOAuthServerBundle config
yguedidi Dec 10, 2023
e48adda
Move SchebTwoFactorBundle config
yguedidi Dec 10, 2023
329650b
Move RulerZBundle config
yguedidi Dec 10, 2023
c65d410
Move OldSoundRabbitMqBundle config
yguedidi Dec 10, 2023
6f416d5
Move FOSJsRoutingBundle config
yguedidi Dec 10, 2023
7b22b65
Move JMSSerializerBundle config
yguedidi Dec 10, 2023
c2f2824
Move SensioFrameworkExtraBundle config
yguedidi Dec 10, 2023
33187d0
Move HttplugBundle config
yguedidi Dec 10, 2023
768706c
Move CraueConfigBundle config
yguedidi Dec 10, 2023
6a261ca
Move services config
yguedidi Dec 10, 2023
afd78c8
fixup! Move services config
yguedidi Dec 10, 2023
a132031
Move Security config
yguedidi Dec 10, 2023
8090c3a
Move test parameters
yguedidi Dec 10, 2023
d3d8e45
Move parameters to services
yguedidi Dec 10, 2023
c7a212a
Load services after packages
yguedidi Dec 10, 2023
9727a2c
Move AppKernel from app/ as Kernel in src/
yguedidi Dec 10, 2023
561d83c
fixup! Move AppKernel from app/ as Kernel in src/
yguedidi Dec 10, 2023
e86a5b9
fixup! Move AppKernel from app/ as Kernel in src/
yguedidi Dec 10, 2023
1f93d4d
Move AppCache from app/ as CacheKernel in src/
yguedidi Dec 10, 2023
de9607a
Move routes to config
yguedidi Dec 10, 2023
531896c
Move WebProfilerBundle routes
yguedidi Dec 10, 2023
2846cbd
Move FrameworkBundle routes
yguedidi Dec 10, 2023
a217d47
Move NelmioApiDocBundle routes
yguedidi Dec 10, 2023
0516045
Move FOSUserBundle routes
yguedidi Dec 10, 2023
fe8d57f
Move FOSOAuthServerBundle routes
yguedidi Dec 10, 2023
231e59b
Move CraueConfigBundle routes
yguedidi Dec 10, 2023
388f264
Move FOSJsRoutingBundle routes
yguedidi Dec 10, 2023
313fabc
Move SchebTwoFactorBundle routes
yguedidi Dec 10, 2023
8f571e3
Move bundles routes at the top
yguedidi Dec 10, 2023
63b1e82
Move migrations
yguedidi Dec 10, 2023
ed21eb9
Move app resources to assets
yguedidi Dec 10, 2023
c574ce0
Use an APP_SECRET env var with fallback
yguedidi Dec 10, 2023
082dac5
Install symfony/dotenv
yguedidi Dec 10, 2023
653c17b
Install symfony/runtime
yguedidi Jan 14, 2024
7ac3dc1
Sync Kernel with framework-bundle recipe
yguedidi Dec 10, 2023
23ea7b3
Sync remaining files with framework-bundle recipe
yguedidi Dec 10, 2023
cdc1564
fixup! Sync remaining files with framework-bundle recipe
yguedidi Dec 12, 2023
2af7a29
fixup! Sync remaining files with framework-bundle recipe
yguedidi Dec 11, 2023
4ea21f5
fixup! Sync remaining files with framework-bundle recipe
yguedidi Jan 14, 2024
24cfea0
fixup! Sync remaining files with framework-bundle recipe
yguedidi Jan 14, 2024
0c0d6bd
Make app.php and app_dev.php use index.php
yguedidi Dec 11, 2023
2a72622
Sync with console recipe
yguedidi Dec 10, 2023
3beeb28
Sync with phpunit-bridge recipe
yguedidi Dec 11, 2023
7339837
fixup! Sync with phpunit-bridge recipe
yguedidi Dec 12, 2023
205d1d5
fixup! Sync with phpunit-bridge recipe
yguedidi Jan 14, 2024
70c02e8
Remove explicit setting of test env in bootstrap commands
yguedidi Jan 14, 2024
51790d9
test
yguedidi Jan 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ indent_style = tab

[.github/**.yml]
indent_size = 2

[phpstan-baseline.neon]
indent_style = tab
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
###> symfony/framework-bundle ###
Copy link
Contributor Author

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

APP_ENV=dev
APP_SECRET=CHANGE_ME_TO_SOMETHING_SECRET_AND_RANDOM
Copy link
Contributor Author

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

###< symfony/framework-bundle ###
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='Wallabag\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=weak
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
sudo systemctl start mysql.service
sudo mysql -u root -proot -h 127.0.0.1 -e "CREATE DATABASE wallabag_test"
cp app/config/tests/parameters_test.mysql.yml app/config/parameters_test.yml
cp tests/configs/parameters_test.mysql.yaml config/parameters_test.yaml

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
composer-options: "--optimize-autoloader --prefer-dist"

- name: "Prepare database configuration"
run: cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
run: cp tests/configs/parameters_test.${{ matrix.database }}.yaml app/config/parameters_test.yaml

- name: "Run PHPUnit"
run: "php bin/phpunit -v"
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
composer-options: "--optimize-autoloader --prefer-dist"

- name: "Prepare database configuration"
run: cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
run: cp tests/configs/parameters_test.${{ matrix.database }}.yaml app/config/parameters_test.yaml

- name: "Run PHPUnit"
run: "php bin/phpunit -v"
30 changes: 15 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

# Cache, logs & sessions
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
/bin/*
!/bin/console
.php-cs-fixer.php
.php-cs-fixer.cache
.phpunit.result.cache
phpunit.xml
docker-compose.override.yml

# Parameters
/app/config/parameters.yml

# Managed by Composer
/vendor/

# Assets and user uploads
web/uploads/
/web/bundles/*
Expand Down
11 changes: 7 additions & 4 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

$config = new PhpCsFixer\Config();

return $config
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => [
'syntax' => 'short'
'syntax' => 'short',
],
'combine_consecutive_unsets' => true,
'heredoc_to_nowdoc' => true,
Expand All @@ -21,21 +22,23 @@
'use',
'parenthesis_brace_block',
'square_brace_block',
'curly_brace_block'
'curly_brace_block',
],
],
'no_unreachable_default_argument_value' => true,
'no_useless_concat_operator' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'phpdoc_separation' => false,
// 'psr_autoloading' => true,
'strict_comparison' => true,
'strict_param' => true,
'concat_space' => [
'spacing' => 'one'
'spacing' => 'one',
],
])
->setFinder(
Expand All @@ -44,7 +47,7 @@
'node_modules',
'vendor',
'var',
'web'
'web',
])
->in(__DIR__)
)
Expand Down
4 changes: 2 additions & 2 deletions RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ During this documentation, we assume the release is `$LAST_WALLABAG_RELEASE` (li
#### Prepare the release

- Update these files with new information
- `app/config/wallabag.yml` (`wallabag_core.version`)
- `config/packages/wallabag.yaml` (`wallabag_core.version`)
- `CHANGELOG.md`
- Create a PR named "Prepare $LAST_WALLABAG_RELEASE release".
- Wait for test to be ok, merge it.
Expand All @@ -19,7 +19,7 @@ During this documentation, we assume the release is `$LAST_WALLABAG_RELEASE` (li
- [Create the new release on GitHub](https://github.com/wallabag/wallabag/releases/new) by targetting the `master` branch or any appropriate branch (for instance backports).
- Update [website](https://github.com/wallabag/website) to change MD5 sum and create the release blog post (based on the changelog).
- Update Dockerfile https://github.com/wallabag/docker (and create a new tag)
- Put the next patch version suffixed with `-dev` in `app/config/wallabag.yml` (`wallabag_core.version`)
- Put the next patch version suffixed with `-dev` in `config/packages/wallabag.yaml` (`wallabag_core.version`)
- Drink a :beer:!

### Target PHP version
Expand Down
4 changes: 2 additions & 2 deletions app/AppCache.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
use Wallabag\CacheKernel;

class AppCache extends HttpCache
class AppCache extends CacheKernel
{
}
128 changes: 1 addition & 127 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -1,133 +1,7 @@
<?php

use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Wallabag\Kernel;
Copy link
Contributor Author

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.


class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new FOS\RestBundle\FOSRestBundle(),
new FOS\UserBundle\FOSUserBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Craue\ConfigBundle\CraueConfigBundle(),
new BabDev\PagerfantaBundle\BabDevPagerfantaBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(),
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
new Http\HttplugBundle\HttplugBundle(),
new Sentry\SentryBundle\SentryBundle(),
new Twig\Extra\TwigExtraBundle\TwigExtraBundle(),

// wallabag bundles
new Wallabag\CoreBundle\WallabagCoreBundle(),
new Wallabag\ApiBundle\WallabagApiBundle(),
new Wallabag\UserBundle\WallabagUserBundle(),
new Wallabag\ImportBundle\WallabagImportBundle(),
new Wallabag\AnnotationBundle\WallabagAnnotationBundle(),
];

if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();

if ('test' === $this->getEnvironment()) {
$bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle();
}

if ('dev' === $this->getEnvironment()) {
$bundles[] = new Symfony\Bundle\MakerBundle\MakerBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
}
}

return $bundles;
}

public function getCacheDir()
{
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
}

public function getLogDir()
{
return dirname(__DIR__) . '/var/logs';
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml');

$loader->load(function ($container) {
if ($container->getParameter('use_webpack_dev_server')) {
$container->loadFromExtension('framework', [
'assets' => [
'base_url' => 'http://localhost:8080/',
],
]);
} else {
$container->loadFromExtension('framework', [
'assets' => [
'base_url' => $container->getParameter('domain_name'),
],
]);
}
});

$loader->load(function (ContainerBuilder $container) {
// $container->setParameter('container.autowiring.strict_mode', true);
// $container->setParameter('container.dumper.inline_class_loader', true);
$container->addObjectResource($this);
});

$loader->load(function (ContainerBuilder $container) {
$this->processDatabaseParameters($container);
});
}

private function processDatabaseParameters(ContainerBuilder $container)
{
switch ($container->getParameter('database_driver')) {
case 'pdo_mysql':
$scheme = 'mysql';
break;
case 'pdo_pgsql':
$scheme = 'pgsql';
break;
case 'pdo_sqlite':
$scheme = 'sqlite';
break;
default:
throw new \RuntimeException('Unsupported database driver: ' . $container->getParameter('database_driver'));
}

$container->setParameter('database_scheme', $scheme);

if ('sqlite' === $scheme) {
$container->setParameter('database_name', $container->getParameter('database_path'));
}

$container->setParameter('database_user', (string) $container->getParameter('database_user'));
$container->setParameter('database_password', (string) $container->getParameter('database_password'));
$container->setParameter('database_port', (string) $container->getParameter('database_port'));
$container->setParameter('database_socket', (string) $container->getParameter('database_socket'));
}
}