Skip to content

Commit

Permalink
Migrated meta repository to Symfony 5 (#507)
Browse files Browse the repository at this point in the history
* Symfony 5 compatibility

* Added files installed by flex

* Enabled twig extensions used by our packages

* Replaced front controller with Symfony 5's

* Added missing bundles

* Fixed usage of getenv

* Set composer branches

* Removed symfony/web-server-bundle

* Removed symfony/web-server-bundle

* Removed obsolete repositories

* Fixed front controller

* Fixed behat suites

* Added missing behat context service definitions

* Fixed behat suites

* Fixed getenv calls

* Removed obsolete services_behat.yaml

* Changed all $_ENV references to $_SERVER

* Prepared composer.json for release

* Removed minimum-stability and prefer-stable from composer.json

* Removed boilerplate files installed by flex

Co-authored-by: Andrew Longosz <[email protected]>
  • Loading branch information
webhdx and alongosz authored Mar 18, 2020
1 parent 0837d29 commit cd03c40
Show file tree
Hide file tree
Showing 22 changed files with 177 additions and 124 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ ide-twig.json
/var/
/vendor/
###< symfony/framework-bundle ###
###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

###> liip/imagine-bundle ###
/public/media/cache/
###< liip/imagine-bundle ###
Expand All @@ -112,3 +108,7 @@ behat.yml
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> friends-of-behat/symfony-extension ###
/behat.yml
###< friends-of-behat/symfony-extension ###
23 changes: 11 additions & 12 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,26 @@ default:

DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~

Behat\Symfony2Extension:
FriendsOfBehat\SymfonyExtension\ServiceContainer\SymfonyExtension:
kernel:
bootstrap: config/bootstrap.php
path: src/Kernel.php
class: App\Kernel
env: behat
environment: behat
debug: true

EzSystems\BehatBundle\BehatExtension: ~

Liuggio\Fastest\Behat\ListFeaturesExtension\Extension: ~

Bex\Behat\ScreenshotExtension:
active_image_drivers: cloudinary
image_drivers:
cloudinary:
screenshot_directory: /tmp/behat-screenshot/
cloud_name: ezplatformtravis
preset: ezplatform
mode: normal
limit: 10
# Bex\Behat\ScreenshotExtension:
# active_image_drivers: cloudinary
# image_drivers:
# cloudinary:
# screenshot_directory: /tmp/behat-screenshot/
# cloud_name: ezplatformtravis
# preset: ezplatform
# mode: normal
# limit: 10

Allure\Behat\AllureFormatterExtension: ~

Expand Down
76 changes: 38 additions & 38 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"ezsystems/doctrine-dbal-schema": "^1.0@dev",
"ezsystems/ez-support-tools": "^2.0@dev",
"ezsystems/ezplatform-admin-ui": "^2.0@dev",
"ezsystems/ezplatform-admin-ui-assets": "^5.0@dev",
"ezsystems/ezplatform-admin-ui-assets": "^5.0@beta",
"ezsystems/ezplatform-admin-ui-modules": "^2.0@dev",
"ezsystems/ezplatform-core": "^2.0@dev",
"ezsystems/ezplatform-cron": "^3.0@dev",
"ezsystems/ezplatform-design-engine": "^3.0@dev",
"ezsystems/ezplatform-graphql": "^2.0@dev",
"ezsystems/ezplatform-http-cache": "^2.0@dev",
"ezsystems/ezplatform-http-cache": "^1.0@dev",
"ezsystems/ezplatform-matrix-fieldtype": "^2.0@dev",
"ezsystems/ezplatform-query-fieldtype": "^2.0@dev",
"ezsystems/ezplatform-rest": "^1.0@dev",
Expand All @@ -33,55 +33,55 @@
"ezsystems/ezplatform-user": "^2.0@dev",
"ezsystems/ezpublish-kernel": "^8.0@dev",
"ezsystems/ezplatform-content-forms": "^1.0@dev",
"friendsofsymfony/jsrouting-bundle": "^2.3",
"knplabs/knp-menu-bundle": "^2.2",
"monolog/monolog": "^1.25.2",
"friendsofsymfony/jsrouting-bundle": "^2.5",
"knplabs/knp-menu-bundle": "^3.0",
"ezsystems/templated-uri-bundle": "^3.3@dev",
"monolog/monolog": "^2.0",
"php-http/guzzle6-adapter": "^2.0",
"platformsh/symfonyflex-bridge": "^2.2",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^5.0",
"symfony/asset": "^4.3",
"symfony/cache": "^4.3",
"symfony/console": "^4.3",
"symfony/dotenv": "^4.3",
"symfony/expression-language": "^4.3",
"symfony/flex": "^1.1",
"symfony/form": "^4.3",
"symfony/framework-bundle": "^4.3",
"symfony/monolog-bundle": "^3.1",
"sensio/framework-extra-bundle": "^5.5",
"sensiolabs/security-checker": "^6.0",
"symfony/asset": "^5.0",
"symfony/cache": "^5.0",
"symfony/console": "^5.0",
"symfony/dotenv": "^5.0",
"symfony/expression-language": "^5.0",
"symfony/flex": "^1.6",
"symfony/form": "^5.0",
"symfony/framework-bundle": "^5.0",
"symfony/monolog-bundle": "^3.5",
"symfony/orm-pack": "^1.0",
"symfony/process": "^4.3",
"symfony/proxy-manager-bridge": "^4.3",
"symfony/security-bundle": "^4.3",
"symfony/process": "^5.0",
"symfony/proxy-manager-bridge": "^5.0",
"symfony/security-bundle": "^5.0",
"symfony/serializer-pack": "^1.0",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/thanks": "^1.1",
"symfony/translation": "^4.3",
"symfony/twig-bundle": "^4.3",
"symfony/validator": "^4.3",
"symfony/web-link": "^4.3",
"symfony/webpack-encore-bundle": "^1.4",
"symfony/yaml": "^4.3"
"symfony/swiftmailer-bundle": "^3.4",
"symfony/thanks": "^1.2",
"symfony/translation": "^5.0",
"symfony/twig-bundle": "^5.0",
"symfony/validator": "^5.0",
"symfony/web-link": "^5.0",
"symfony/webpack-encore-bundle": "^1.7",
"symfony/yaml": "^5.0",
"twig/extra-bundle": "^3.0"
},
"require-dev": {
"behat/behat": "^3.5",
"behat/mink": "^1.7",
"behat/mink-extension": "^2.3",
"behat/behat": "^3.6",
"behat/mink": "^1.8",
"friends-of-behat/mink-extension": "^2.4",
"behat/mink-goutte-driver": "^1.2",
"behat/mink-selenium2-driver": "^1.3",
"behat/symfony2-extension": "^2.1",
"bex/behat-screenshot": "^1.2",
"behat/mink-selenium2-driver": "^1.4",
"friends-of-behat/symfony-extension": "^2.1@beta",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"ezsystems/allure-behat": "^3.0",
"ezsystems/allure-behat": "^3.0@dev",
"ezsystems/behat-screenshot-image-driver-cloudinary": "^1.1@dev",
"ezsystems/behatbundle": "^8.0@dev",
"liuggio/fastest": "^1.6",
"overblog/graphiql-bundle": "^0.1.2",
"ezsystems/fastest": "^1.7",
"overblog/graphiql-bundle": "^0.2",
"symfony/debug-pack": "^1.0",
"symfony/maker-bundle": "^1.0",
"symfony/maker-bundle": "^1.14",
"symfony/test-pack": "^1.0",
"symfony/web-server-bundle": "^4.2",
"phpunit/phpunit": "^8.2"
},
"conflict": {
Expand Down
9 changes: 4 additions & 5 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,19 @@
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'behat' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'behat' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true],
JMS\TranslationBundle\JMSTranslationBundle::class => ['all' => true],
Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
FOS\HttpCacheBundle\FOSHttpCacheBundle::class => ['all' => true],
// eZ Platform
eZ\Bundle\EzPublishCoreBundle\EzPublishCoreBundle::class => ['all' => true],
EzSystems\EzPlatformCoreBundle\EzPlatformCoreBundle::class => ['all' => true],
eZ\Bundle\EzPublishLegacySearchEngineBundle\EzPublishLegacySearchEngineBundle::class => ['all' => true],
Expand Down Expand Up @@ -53,4 +48,8 @@
EzSystems\EzPlatformQueryFieldType\Symfony\EzSystemsEzPlatformQueryFieldTypeBundle::class => ['all' => true],
Overblog\GraphQLBundle\OverblogGraphQLBundle::class => ['all' => true],
Overblog\GraphiQLBundle\OverblogGraphiQLBundle::class => ['dev' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'behat' => true],
Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle::class => ['all' => true],
];
10 changes: 0 additions & 10 deletions config/packages/doctrine_cache.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions config/packages/doctrine_migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations
4 changes: 2 additions & 2 deletions config/packages/ezplatform_admin_ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jms_translation:
configs:
admin:
dirs:
- '%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui/src'
output_dir: '%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/translations/'
- '%kernel.project_dir%/vendor/ezsystems/ezplatform-admin-ui/src'
output_dir: '%kernel.project_dir%/vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/translations/'
excluded_dirs: [Behat, Tests, node_modules]
extractor:
- ez_policy
Expand Down
4 changes: 2 additions & 2 deletions config/packages/ezplatform_admin_ui_modules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jms_translation:
configs:
admin_modules:
dirs:
- '%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui-modules/src'
output_dir: '%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui-modules/Resources/translations/'
- '%kernel.project_dir%/vendor/ezsystems/ezplatform-admin-ui-modules/src'
output_dir: '%kernel.project_dir%/vendor/ezsystems/ezplatform-admin-ui-modules/Resources/translations/'
excluded_dirs: [Behat, Tests, node_modules]
output_format: "xliff"
28 changes: 15 additions & 13 deletions config/packages/overrides/generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,42 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader;

if ($dfsNfsPath = getenv('DFS_NFS_PATH')) {
require_once dirname(__DIR__, 2).'/bootstrap.php';

if ($dfsNfsPath = $_SERVER['DFS_NFS_PATH'] ?? false) {
$container->setParameter('dfs_nfs_path', $dfsNfsPath);

if ($value = getenv('DFS_DATABASE_DRIVER')) {
if ($value = $_SERVER['DFS_DATABASE_DRIVER'] ?? false) {
$container->setParameter('dfs_database_driver', $value);
} else {
$container->setParameter('dfs_database_driver', $container->getParameter('database_driver'));
}

if ($value = getenv('DFS_DATABASE_HOST')) {
if ($value = $_SERVER['DFS_DATABASE_HOST'] ?? false) {
$container->setParameter('dfs_database_host', $value);
} else {
$container->setParameter('dfs_database_host', $container->getParameter('database_host'));
}

if ($value = getenv('DFS_DATABASE_PORT')) {
if ($value = $_SERVER['DFS_DATABASE_PORT'] ?? false) {
$container->setParameter('dfs_database_port', $value);
} else {
$container->setParameter('dfs_database_port', $container->getParameter('database_port'));
}

if ($value = getenv('DFS_DATABASE_NAME')) {
if ($value = $_SERVER['DFS_DATABASE_NAME'] ?? false) {
$container->setParameter('dfs_database_name', $value);
} else {
$container->setParameter('dfs_database_name', $container->getParameter('database_name'));
}

if ($value = getenv('DFS_DATABASE_USER')) {
if ($value = $_SERVER['DFS_DATABASE_USER'] ?? false) {
$container->setParameter('dfs_database_user', $value);
} else {
$container->setParameter('dfs_database_user', $container->getParameter('database_user'));
}

if ($value = getenv('DFS_DATABASE_PASSWORD')) {
if ($value = $_SERVER['DFS_DATABASE_PASSWORD'] ?? false) {
$container->setParameter('dfs_database_password', $value);
} else {
$container->setParameter('dfs_database_password', $container->getParameter('database_password'));
Expand All @@ -51,28 +53,28 @@

// Cache settings
// If CACHE_POOL env variable is set, check if there is a yml file that needs to be loaded for it
if (($pool = getenv('CACHE_POOL')) && file_exists(dirname(__DIR__)."/cache_pool/${pool}.yaml")) {
if (($pool = $_SERVER['CACHE_POOL'] ?? false) && file_exists(dirname(__DIR__)."/cache_pool/${pool}.yaml")) {
$loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/cache_pool'));
$loader->load($pool.'.yaml');
}

// Params that needs to be set at compile time and thus can't use Symfony's env()
if ($purgeType = getenv('HTTPCACHE_PURGE_TYPE')) {
if ($purgeType = $_SERVER['HTTPCACHE_PURGE_TYPE'] ?? false) {
$container->setParameter('purge_type', $purgeType);
}

if ($value = getenv('MAILER_TRANSPORT')) {
if ($value = $_SERVER['MAILER_TRANSPORT'] ?? false) {
$container->setParameter('mailer_transport', $value);
}

if ($value = getenv('LOG_TYPE')) {
if ($value = $_SERVER['LOG_TYPE'] ?? false) {
$container->setParameter('log_type', $value);
}

if ($value = getenv('SESSION_HANDLER_ID')) {
if ($value = $_SERVER['SESSION_HANDLER_ID'] ?? false) {
$container->setParameter('ezplatform.session.handler_id', $value);
}

if ($value = getenv('SESSION_SAVE_PATH')) {
if ($value = $_SERVER['SESSION_SAVE_PATH'] ?? false) {
$container->setParameter('ezplatform.session.save_path', $value);
}
18 changes: 10 additions & 8 deletions config/packages/overrides/platformsh.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader;

require_once dirname(__DIR__, 2).'/bootstrap.php';

// Run for all hooks, incl build step
if (getenv('PLATFORM_PROJECT_ENTROPY')) {
if ($_SERVER['PLATFORM_PROJECT_ENTROPY'] ?? false) {
// Disable PHPStormPass as we don't have write access & it's not localhost
$container->setParameter('ezdesign.phpstorm.enabled', false);
}

// Will not be executed on build step
$relationships = getenv('PLATFORM_RELATIONSHIPS');
$relationships = $_SERVER['PLATFORM_RELATIONSHIPS'] ?? false;
if (!$relationships) {
return;
}
$routes = getenv('PLATFORM_ROUTES');
$routes = $_SERVER['PLATFORM_ROUTES'];

$relationships = json_decode(base64_decode($relationships), true);
$routes = json_decode(base64_decode($routes), true);

// PLATFORMSH_DFS_NFS_PATH is different compared to DFS_NFS_PATH in the sense that it is relative to ezplatform dir
// DFS_NFS_PATH is an absolute path
if ($dfsNfsPath = getenv('PLATFORMSH_DFS_NFS_PATH')) {
$container->setParameter('dfs_nfs_path', sprintf('%s/%s', dirname($container->getParameter('kernel.root_dir')), $dfsNfsPath));
if ($dfsNfsPath = $_SERVER['PLATFORMSH_DFS_NFS_PATH'] ?? false) {
$container->setParameter('dfs_nfs_path', sprintf('%s/%s', dirname($container->getParameter('kernel.project_dir')), $dfsNfsPath));

if (array_key_exists('dfs_database', $relationships)) {
foreach ($relationships['dfs_database'] as $endpoint) {
Expand Down Expand Up @@ -131,14 +133,14 @@
}
}

if ($route !== null && !getenv('HTTPCACHE_PURGE_TYPE')) {
if ($route !== null && !($_SERVER['HTTPCACHE_PURGE_TYPE'] ?? false)) {
$container->setParameter('purge_type', 'varnish');
$container->setParameter('purge_server', rtrim($route, '/'));
}

// Setting default value for HTTPCACHE_VARNISH_INVALIDATE_TOKEN if it is not explicitly set
if (!getenv('HTTPCACHE_VARNISH_INVALIDATE_TOKEN')) {
$container->setParameter('varnish_invalidate_token', getenv('PLATFORM_PROJECT_ENTROPY'));
if (!($_SERVER['HTTPCACHE_VARNISH_INVALIDATE_TOKEN'] ?? false)) {
$container->setParameter('varnish_invalidate_token', $_SERVER['PLATFORM_PROJECT_ENTROPY']);
}

// Adapt config based on enabled PHP extensions
Expand Down
3 changes: 3 additions & 0 deletions config/packages/prod/routing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
router:
strict_requirements: null
4 changes: 4 additions & 0 deletions config/packages/prod/webpack_encore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true
2 changes: 2 additions & 0 deletions config/packages/test/twig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
twig:
strict_variables: true
3 changes: 3 additions & 0 deletions config/packages/test/validator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
validation:
not_compromised_password: false
2 changes: 2 additions & 0 deletions config/packages/test/webpack_encore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#webpack_encore:
# strict_mode: false
Loading

0 comments on commit cd03c40

Please sign in to comment.