forked from contao/contao
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
Support router to generate SERP widget URL #3
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 tasks
aschempp
force-pushed
the
feature/serp-router
branch
from
July 11, 2020 08:42
7abfa23
to
1e7a771
Compare
aschempp
force-pushed
the
feature/serp-router
branch
from
July 20, 2020 21:04
1e7a771
to
b8aec5f
Compare
leofeyer
pushed a commit
to contao/contao
that referenced
this pull request
Jul 21, 2020
Description ----------- This PR implements several long-discussed improvements we want to have in the Contao routing. ### Features: - [x] Configure URL-prefix (`.html`) per root page instead of the app config - [x] Configure the _prepend locale_ setting per root page instead of the app config - [x] Implement support for custom language prefix (closes #862) - [x] Only redirect to the language version of a page if it exists (see #1456) - [x] Generate routes for entities (e.g. pass `PageModel` to `$router->generate()` (see #831) - [x] Allow for custom page types as controllers (see #1160, #390) - [x] Allow a page type to have a static URL suffix (e.g. `.xml` instead of `.html` for the XML sitemap). #### Side Features - [ ] ~Do not generate frontend URLs for pages with parameters~ - [ ] ~add alternative to the `Input` class that also tracks unused parameters~ (not sure about this, as the Input is no longer used with routing parameters) - [x] _really_ only create template article for new pages that can have them - [x] do not create article if the new page's layout does not have articles ### Tasks - [ ] write documentation about _legacy routing mode_. - [ ] include support for extended languages (see https://github.com/contao/core-bundle/issues/1579) - [x] the url prefix should be unique for pages with the same dns setting. #1516 (comment) ### Follow-Up PRs - [x] Use router to generate SERP widget URL aschempp#3 - [ ] Replace current page types aschempp#4 - [ ] Support news aschempp#5 - [ ] Support calendar events aschempp#6 - [ ] Support other content (faq, etc.) ### Notes about backwards compatibility As discussed at the developer meeting in February 2020, we cannot keep full BC between the new features and the existing routing. The `contao.prepend_locale` and `contao.url_suffix` container configuration as well as the `getPageIdFromUrl` or `getRootPageFromUrl` hooks are conflicting with the new features. We agreed that Contao should fall into a _legacy routing_ mode, where the new features are not available in the root page in that case. **BC Todos:** - [x] Disable root page configuration in legacy routing mode - [x] ~Find a way to keep supporting `contao.routing.url_generator` service~ _only in legacy mode_ ### Related PRs / Dependencies: - [x] #1447 - [x] #1448 - [x] #1458 - [x] #1501 - [x] #1503 - [x] #1506 - [x] #1518 - [x] #1533 - [x] #1182 - [x] ~~#1639 - [x] #1640 - [x] #1650 - [x] #1652 - [x] #1864 - [x] #1869 - [x] #1896 Commits ------- 21a9efe Use page language instead of _locale parameter for $_GET['language'] c2ba2d1 Add languagePrefix and urlSuffix fields to tl_page d3abce3 Deprecate the bundle config but override the page config if set 78dfc42 Fix alias rendering in PageTree b8616b0 Rewrite the language filter to use the page properties ec3969d Add legacy routing check to ContaoFramework class 4f26e73 Added separate class to generate URL candidates 29bd111 Add languagePrefix and urlSuffix to PageModel with BC layer 510da35 Update RouteProvider to use candidates based on root page 02eca55 Add redirect routes if page is requested without languagePrefix 62f3656 Update routing functional tests c1f2f93 Added migration for tl_page fields 39d987b Set config values from current request 5b03a6c Correctly generate root and fallback routes with languagePrefix db9768f Check for ID/alias duplicate with new page parameters 83fc289 Use pageModel from request or trigger exception in deprecated methods without legacy mode 01b9c97 Update Route404Provider to use languagePrefix from PageModel 0d3f58b Fixed service arguments for LegacyRoutingListener bc02925 Added duplicates validation for alias, languagePrefix and urlSuffix 95c7042 Correctly migrate the legacy routing configuration 192fff1 CS and test fixes aa09e96 Switch page type and alias field position 11638ac Add route name and object to the attributes 139b19c Add custom route object for PageModel 223182e Content resolvers convert content to a route object 168c218 Let the page model tell if useAutoItem is enabled 8158ad2 Use service tagging to add router enhancers bda2a16 CS 44a5a43 Let the router generate page URLs b7bd00b Use the DynamicRouter from CMF Routing Bundle a8dcc22 Rename the ContentResolverInterface to ContentUrlResolverInterface 692742d Introducing page providers 190a38b Make PageRoute more flexible 5375860 Always render regular page for unknown types 4a27948 Added autoconfiguration for contao.page_provider 1b3bf76 Added RootPageProvider which provides the default url suffixes 0e559fc Generate page type options from providers c03f503 Added ContentCompositionListener to correctly show or hide article features 8b27f64 Added BC layer for UrlGenerator and other legacy routing 2c0115f Enable legacy routing by container configuration and throw exception if hooks require it a9f09bc Add legacy routing information to the data collector 156ef52 Trigger deprecation warnings if the Symfony routing is not used 928de08 Always show list of legacy routing hooks in profiler 079370f Rename languagePrefix to urlPrefix a015340 Include the previous exception on re-throw ca7ea33 Fix spelling in method name f384d55 Use ::class in exception message 1fc7bfd ContentUrlResolvers must always return a route f9cfbe8 Decorate the Candidates to implement legacy behavior dea83be Add an additional router for the legacy routes in legacy mode 41ab6c6 Adjust routing to string route name see symfony-cmf/Routing#250 1d7968c Fix remaining objects passed to Router::generate() 10b1b3e Add some deprecation notices and annotations 815e1c0 Fixed argument order in exception message 8fdbdf9 Use anonymous services for legacy routing ba67633 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php # core-bundle/src/Resources/config/services.yml # core-bundle/src/Resources/contao/dca/tl_article.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/library/Contao/Template.php # core-bundle/src/Resources/contao/themes/flexible/main.min.css # core-bundle/tests/Routing/Enhancer/InputEnhancerTest.php # core-bundle/tests/Routing/Route404ProviderTest.php 50ba4cd Fix incorrect service name fc680b7 Fix unit tests for ContaoCoreExtension 534ccdd Fix some tests e0118c4 The contao.routing.url_generator is only available in legacy mode f6f1d19 Fix remaining unit tests 87c121a CS f7ae7a9 Trigger route error only when used 6ba5f7a Added 100% test coverage for ContentCompositionListener 74f8c7c Added missing unit tests 22394dd Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php # core-bundle/tests/Functional/RoutingTest.php 325b114 Fixed ContaoCoreExtensionTest 5627ec3 CS 888ec70 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/tests/Asset/ContaoContextTest.php 701cd59 CS 0be7232 Always insert the new article into an available layout column cbd42ac Expect deprecations afc706a CS 577f1fa CS c719b1c CS e51d432 Move classes to new namespace 5b30edd Refactor with PageRouteFactory edd253e Added PageRegistry de480f2 CS and tests 629300e Added concept of path parameters bb76ae6 Fixed service name 793b3d5 Providing URL suffixes without custom routes does not make sense 4692bcc PageModel is not optional 502276a Make the RouteFactory more generic f11ab17 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php 4dd724a Tests 6288646 Fixed failing test if there are no url suffixes ae90ba6 Logger is optional d696ed9 Logger is optional 0262068 phpstan 613c39e phpstan 2afd655 phpstan & tests 37c4dda phpstan & tests c337e1b phpstan & tests 5b78fa6 Merge remote-tracking branch 'upstream/master' into feature/routing 8342fa0 psalm & tests edb1e52 yamllint 194f942 Do not use warning color if legacy routing is disabled 5a1b41a Reuse class name variable c422a02 Register interfaces for autoconfiguration c93b1e6 Drop unnecessary tags with autoconfigure 4328f77 Correctly purge search index b5d4be1 Use PathUtil to check if hook is in vendor dir ece1376 Throw correct exception if route is not supported c60854c Merge remote-tracking branch 'upstream/master' into feature/routing f4ca10f Use the security voter to check article permissions 61bccf7 Tests 04f50f1 Tests c4b004b Rename page controllers a806b39 Use subscribed services 289cc0b URL must include prefix and suffix when generating candidates 2e507a4 CS a63f337 Rewrite candidates d023ee3 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/library/Contao/Controller.php e46b79a Fixed return type 82fbcc4 Code review 491c83b Code review 681dafd Check if the URL prefix is duplicated in another root page 2fa6eee Merge remote-tracking branch 'upstream/master' into feature/routing bfab096 Fix the coding style c1cca71 Merge branch 'master' into feature/routing f3cbd68 Fix the unit tests 63188d6 Fix the phpDoc types 92ea072 Adjust the deprecation messages 35e4d71 Fix a non-optimal if condition 7ba51e7 Fix some minor issues fba7c23 Adjust the "this setting has been disabled" warning a1d0532 Review from @dmolineus a972f8d Review from @leofeyer 164291b Fixed Route404Provider tests 0dea19a Use permission constants 5c72385 Remove invalid model methods 444c736 Use callback instead of listener method for help icon 6ef2654 Fix the coding style d9a259a Fix a wrong trans-unit ID 351c32f Replace "@var Adapter" with something the IDE and PhpStan understand ab6cb7e Correctly generate the index route b01b059 Correctly match a request with url prefix if there is no index page c089b6d Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/ContaoCoreBundle.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/models/PageModel.php # core-bundle/src/Routing/RouteProvider.php # core-bundle/tests/ContaoCoreBundleTest.php c338e4a CS 7763b81 Fix the CI chain 5db0afe Drop the parameters field a4aba62 Allow to define content composition in the service tag/annotation 31d34ec Get URL prefix and suffix from the page registry ea8f57b Rename the PageRouteEnhancerInterface 2e373e4 Update RootController, no longer needs additional interfaces b895744 Allow relative or absolute path for page controllers 3295ed8 CS 524c5e6 Fix tests 5850c24 CS 961ffcd Use $this->createResult() instead of new MigrationResult() 1f70bdb Implemented feedback from @Toflar ded7d5c Correctly validate the URL suffix 64b388e Correctly support absolute URLs with empty prefix f7fda16 CS
leofeyer
pushed a commit
to contao/manager-bundle
that referenced
this pull request
Jul 21, 2020
Description ----------- This PR implements several long-discussed improvements we want to have in the Contao routing. ### Features: - [x] Configure URL-prefix (`.html`) per root page instead of the app config - [x] Configure the _prepend locale_ setting per root page instead of the app config - [x] Implement support for custom language prefix (closes contao/contao#862) - [x] Only redirect to the language version of a page if it exists (see contao/contao#1456) - [x] Generate routes for entities (e.g. pass `PageModel` to `$router->generate()` (see contao/contao#831) - [x] Allow for custom page types as controllers (see contao/contao#1160, contao/contao#390) - [x] Allow a page type to have a static URL suffix (e.g. `.xml` instead of `.html` for the XML sitemap). #### Side Features - [ ] ~Do not generate frontend URLs for pages with parameters~ - [ ] ~add alternative to the `Input` class that also tracks unused parameters~ (not sure about this, as the Input is no longer used with routing parameters) - [x] _really_ only create template article for new pages that can have them - [x] do not create article if the new page's layout does not have articles ### Tasks - [ ] write documentation about _legacy routing mode_. - [ ] include support for extended languages (see https://github.com/contao/core-bundle/issues/1579) - [x] the url prefix should be unique for pages with the same dns setting. contao/contao#1516 (comment) ### Follow-Up PRs - [x] Use router to generate SERP widget URL aschempp/contao#3 - [ ] Replace current page types aschempp/contao#4 - [ ] Support news aschempp/contao#5 - [ ] Support calendar events aschempp/contao#6 - [ ] Support other content (faq, etc.) ### Notes about backwards compatibility As discussed at the developer meeting in February 2020, we cannot keep full BC between the new features and the existing routing. The `contao.prepend_locale` and `contao.url_suffix` container configuration as well as the `getPageIdFromUrl` or `getRootPageFromUrl` hooks are conflicting with the new features. We agreed that Contao should fall into a _legacy routing_ mode, where the new features are not available in the root page in that case. **BC Todos:** - [x] Disable root page configuration in legacy routing mode - [x] ~Find a way to keep supporting `contao.routing.url_generator` service~ _only in legacy mode_ ### Related PRs / Dependencies: - [x] contao/contao#1447 - [x] contao/contao#1448 - [x] contao/contao#1458 - [x] contao/contao#1501 - [x] contao/contao#1503 - [x] contao/contao#1506 - [x] #1518 - [x] #1533 - [x] #1182 - [x] ~~contao/contao#1639 - [x] contao/contao#1640 - [x] contao/contao#1650 - [x] contao/contao#1652 - [x] contao/contao#1864 - [x] contao/contao#1869 - [x] contao/contao#1896 Commits ------- 21a9efee Use page language instead of _locale parameter for $_GET['language'] c2ba2d18 Add languagePrefix and urlSuffix fields to tl_page d3abce32 Deprecate the bundle config but override the page config if set 78dfc423 Fix alias rendering in PageTree b8616b07 Rewrite the language filter to use the page properties ec3969d4 Add legacy routing check to ContaoFramework class 4f26e730 Added separate class to generate URL candidates 29bd1112 Add languagePrefix and urlSuffix to PageModel with BC layer 510da353 Update RouteProvider to use candidates based on root page 02eca555 Add redirect routes if page is requested without languagePrefix 62f36562 Update routing functional tests c1f2f93b Added migration for tl_page fields 39d987b6 Set config values from current request 5b03a6cf Correctly generate root and fallback routes with languagePrefix db9768f4 Check for ID/alias duplicate with new page parameters 83fc2890 Use pageModel from request or trigger exception in deprecated methods without legacy mode 01b9c97b Update Route404Provider to use languagePrefix from PageModel 0d3f58bf Fixed service arguments for LegacyRoutingListener bc029251 Added duplicates validation for alias, languagePrefix and urlSuffix 95c7042a Correctly migrate the legacy routing configuration 192fff16 CS and test fixes aa09e969 Switch page type and alias field position 11638acb Add route name and object to the attributes 139b19c3 Add custom route object for PageModel 223182e2 Content resolvers convert content to a route object 168c2182 Let the page model tell if useAutoItem is enabled 8158ad24 Use service tagging to add router enhancers bda2a160 CS 44a5a433 Let the router generate page URLs b7bd00bc Use the DynamicRouter from CMF Routing Bundle a8dcc223 Rename the ContentResolverInterface to ContentUrlResolverInterface 692742d8 Introducing page providers 190a38b1 Make PageRoute more flexible 53758600 Always render regular page for unknown types 4a27948d Added autoconfiguration for contao.page_provider 1b3bf760 Added RootPageProvider which provides the default url suffixes 0e559fc9 Generate page type options from providers c03f5037 Added ContentCompositionListener to correctly show or hide article features 8b27f64d Added BC layer for UrlGenerator and other legacy routing 2c0115f0 Enable legacy routing by container configuration and throw exception if hooks require it a9f09bca Add legacy routing information to the data collector 156ef523 Trigger deprecation warnings if the Symfony routing is not used 928de089 Always show list of legacy routing hooks in profiler 079370f9 Rename languagePrefix to urlPrefix a0153401 Include the previous exception on re-throw ca7ea33d Fix spelling in method name f384d55c Use ::class in exception message 1fc7bfd6 ContentUrlResolvers must always return a route f9cfbe88 Decorate the Candidates to implement legacy behavior dea83bef Add an additional router for the legacy routes in legacy mode 41ab6c65 Adjust routing to string route name see symfony-cmf/Routing#250 1d7968c1 Fix remaining objects passed to Router::generate() 10b1b3e3 Add some deprecation notices and annotations 815e1c07 Fixed argument order in exception message 8fdbdf95 Use anonymous services for legacy routing ba676339 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php # core-bundle/src/Resources/config/services.yml # core-bundle/src/Resources/contao/dca/tl_article.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/library/Contao/Template.php # core-bundle/src/Resources/contao/themes/flexible/main.min.css # core-bundle/tests/Routing/Enhancer/InputEnhancerTest.php # core-bundle/tests/Routing/Route404ProviderTest.php 50ba4cd8 Fix incorrect service name fc680b74 Fix unit tests for ContaoCoreExtension 534ccdd9 Fix some tests e0118c44 The contao.routing.url_generator is only available in legacy mode f6f1d198 Fix remaining unit tests 87c121ac CS f7ae7a9e Trigger route error only when used 6ba5f7a1 Added 100% test coverage for ContentCompositionListener 74f8c7c5 Added missing unit tests 22394dda Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php # core-bundle/tests/Functional/RoutingTest.php 325b1147 Fixed ContaoCoreExtensionTest 5627ec33 CS 888ec702 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/tests/Asset/ContaoContextTest.php 701cd593 CS 0be72326 Always insert the new article into an available layout column cbd42acc Expect deprecations afc706a1 CS 577f1fa3 CS c719b1c5 CS e51d4324 Move classes to new namespace 5b30edde Refactor with PageRouteFactory edd253ef Added PageRegistry de480f2f CS and tests 629300e4 Added concept of path parameters bb76ae64 Fixed service name 793b3d56 Providing URL suffixes without custom routes does not make sense 4692bccd PageModel is not optional 502276ad Make the RouteFactory more generic f11ab176 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php 4dd724af Tests 62886460 Fixed failing test if there are no url suffixes ae90ba66 Logger is optional d696ed9d Logger is optional 0262068f phpstan 613c39ee phpstan 2afd655c phpstan & tests 37c4dda4 phpstan & tests c337e1b0 phpstan & tests 5b78fa64 Merge remote-tracking branch 'upstream/master' into feature/routing 8342fa0b psalm & tests edb1e52b yamllint 194f942a Do not use warning color if legacy routing is disabled 5a1b41a1 Reuse class name variable c422a021 Register interfaces for autoconfiguration c93b1e6d Drop unnecessary tags with autoconfigure 4328f77a Correctly purge search index b5d4be1e Use PathUtil to check if hook is in vendor dir ece1376c Throw correct exception if route is not supported c60854cb Merge remote-tracking branch 'upstream/master' into feature/routing f4ca10f7 Use the security voter to check article permissions 61bccf79 Tests 04f50f1e Tests c4b004bb Rename page controllers a806b39c Use subscribed services 289cc0ba URL must include prefix and suffix when generating candidates 2e507a45 CS a63f3373 Rewrite candidates d023ee3e Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/library/Contao/Controller.php e46b79ad Fixed return type 82fbcc41 Code review 491c83b9 Code review 681dafdc Check if the URL prefix is duplicated in another root page 2fa6eee0 Merge remote-tracking branch 'upstream/master' into feature/routing bfab096b Fix the coding style c1cca71f Merge branch 'master' into feature/routing f3cbd681 Fix the unit tests 63188d64 Fix the phpDoc types 92ea0725 Adjust the deprecation messages 35e4d71e Fix a non-optimal if condition 7ba51e75 Fix some minor issues fba7c23a Adjust the "this setting has been disabled" warning a1d05327 Review from @dmolineus a972f8d8 Review from @leofeyer 164291bb Fixed Route404Provider tests 0dea19a8 Use permission constants 5c723859 Remove invalid model methods 444c7364 Use callback instead of listener method for help icon 6ef2654c Fix the coding style d9a259ae Fix a wrong trans-unit ID 351c32fa Replace "@var Adapter" with something the IDE and PhpStan understand ab6cb7eb Correctly generate the index route b01b0598 Correctly match a request with url prefix if there is no index page c089b6dd Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/ContaoCoreBundle.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/models/PageModel.php # core-bundle/src/Routing/RouteProvider.php # core-bundle/tests/ContaoCoreBundleTest.php c338e4a0 CS 7763b81d Fix the CI chain 5db0afe7 Drop the parameters field a4aba627 Allow to define content composition in the service tag/annotation 31d34ec2 Get URL prefix and suffix from the page registry ea8f57bd Rename the PageRouteEnhancerInterface 2e373e43 Update RootController, no longer needs additional interfaces b8957447 Allow relative or absolute path for page controllers 3295ed80 CS 524c5e62 Fix tests 5850c246 CS 961ffcd4 Use $this->createResult() instead of new MigrationResult() 1f70bdbe Implemented feedback from @Toflar ded7d5c2 Correctly validate the URL suffix 64b388e0 Correctly support absolute URLs with empty prefix f7fda160 CS
leofeyer
pushed a commit
to contao/core-bundle
that referenced
this pull request
Jul 21, 2020
Description ----------- This PR implements several long-discussed improvements we want to have in the Contao routing. ### Features: - [x] Configure URL-prefix (`.html`) per root page instead of the app config - [x] Configure the _prepend locale_ setting per root page instead of the app config - [x] Implement support for custom language prefix (closes contao/contao#862) - [x] Only redirect to the language version of a page if it exists (see contao/contao#1456) - [x] Generate routes for entities (e.g. pass `PageModel` to `$router->generate()` (see contao/contao#831) - [x] Allow for custom page types as controllers (see contao/contao#1160, contao/contao#390) - [x] Allow a page type to have a static URL suffix (e.g. `.xml` instead of `.html` for the XML sitemap). #### Side Features - [ ] ~Do not generate frontend URLs for pages with parameters~ - [ ] ~add alternative to the `Input` class that also tracks unused parameters~ (not sure about this, as the Input is no longer used with routing parameters) - [x] _really_ only create template article for new pages that can have them - [x] do not create article if the new page's layout does not have articles ### Tasks - [ ] write documentation about _legacy routing mode_. - [ ] include support for extended languages (see https://github.com/contao/core-bundle/issues/1579) - [x] the url prefix should be unique for pages with the same dns setting. contao/contao#1516 (comment) ### Follow-Up PRs - [x] Use router to generate SERP widget URL aschempp/contao#3 - [ ] Replace current page types aschempp/contao#4 - [ ] Support news aschempp/contao#5 - [ ] Support calendar events aschempp/contao#6 - [ ] Support other content (faq, etc.) ### Notes about backwards compatibility As discussed at the developer meeting in February 2020, we cannot keep full BC between the new features and the existing routing. The `contao.prepend_locale` and `contao.url_suffix` container configuration as well as the `getPageIdFromUrl` or `getRootPageFromUrl` hooks are conflicting with the new features. We agreed that Contao should fall into a _legacy routing_ mode, where the new features are not available in the root page in that case. **BC Todos:** - [x] Disable root page configuration in legacy routing mode - [x] ~Find a way to keep supporting `contao.routing.url_generator` service~ _only in legacy mode_ ### Related PRs / Dependencies: - [x] contao/contao#1447 - [x] contao/contao#1448 - [x] contao/contao#1458 - [x] contao/contao#1501 - [x] contao/contao#1503 - [x] contao/contao#1506 - [x] #1518 - [x] #1533 - [x] #1182 - [x] ~~contao/contao#1639 - [x] contao/contao#1640 - [x] contao/contao#1650 - [x] contao/contao#1652 - [x] contao/contao#1864 - [x] contao/contao#1869 - [x] contao/contao#1896 Commits ------- 21a9efee Use page language instead of _locale parameter for $_GET['language'] c2ba2d18 Add languagePrefix and urlSuffix fields to tl_page d3abce32 Deprecate the bundle config but override the page config if set 78dfc423 Fix alias rendering in PageTree b8616b07 Rewrite the language filter to use the page properties ec3969d4 Add legacy routing check to ContaoFramework class 4f26e730 Added separate class to generate URL candidates 29bd1112 Add languagePrefix and urlSuffix to PageModel with BC layer 510da353 Update RouteProvider to use candidates based on root page 02eca555 Add redirect routes if page is requested without languagePrefix 62f36562 Update routing functional tests c1f2f93b Added migration for tl_page fields 39d987b6 Set config values from current request 5b03a6cf Correctly generate root and fallback routes with languagePrefix db9768f4 Check for ID/alias duplicate with new page parameters 83fc2890 Use pageModel from request or trigger exception in deprecated methods without legacy mode 01b9c97b Update Route404Provider to use languagePrefix from PageModel 0d3f58bf Fixed service arguments for LegacyRoutingListener bc029251 Added duplicates validation for alias, languagePrefix and urlSuffix 95c7042a Correctly migrate the legacy routing configuration 192fff16 CS and test fixes aa09e969 Switch page type and alias field position 11638acb Add route name and object to the attributes 139b19c3 Add custom route object for PageModel 223182e2 Content resolvers convert content to a route object 168c2182 Let the page model tell if useAutoItem is enabled 8158ad24 Use service tagging to add router enhancers bda2a160 CS 44a5a433 Let the router generate page URLs b7bd00bc Use the DynamicRouter from CMF Routing Bundle a8dcc223 Rename the ContentResolverInterface to ContentUrlResolverInterface 692742d8 Introducing page providers 190a38b1 Make PageRoute more flexible 53758600 Always render regular page for unknown types 4a27948d Added autoconfiguration for contao.page_provider 1b3bf760 Added RootPageProvider which provides the default url suffixes 0e559fc9 Generate page type options from providers c03f5037 Added ContentCompositionListener to correctly show or hide article features 8b27f64d Added BC layer for UrlGenerator and other legacy routing 2c0115f0 Enable legacy routing by container configuration and throw exception if hooks require it a9f09bca Add legacy routing information to the data collector 156ef523 Trigger deprecation warnings if the Symfony routing is not used 928de089 Always show list of legacy routing hooks in profiler 079370f9 Rename languagePrefix to urlPrefix a0153401 Include the previous exception on re-throw ca7ea33d Fix spelling in method name f384d55c Use ::class in exception message 1fc7bfd6 ContentUrlResolvers must always return a route f9cfbe88 Decorate the Candidates to implement legacy behavior dea83bef Add an additional router for the legacy routes in legacy mode 41ab6c65 Adjust routing to string route name see symfony-cmf/Routing#250 1d7968c1 Fix remaining objects passed to Router::generate() 10b1b3e3 Add some deprecation notices and annotations 815e1c07 Fixed argument order in exception message 8fdbdf95 Use anonymous services for legacy routing ba676339 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php # core-bundle/src/Resources/config/services.yml # core-bundle/src/Resources/contao/dca/tl_article.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/library/Contao/Template.php # core-bundle/src/Resources/contao/themes/flexible/main.min.css # core-bundle/tests/Routing/Enhancer/InputEnhancerTest.php # core-bundle/tests/Routing/Route404ProviderTest.php 50ba4cd8 Fix incorrect service name fc680b74 Fix unit tests for ContaoCoreExtension 534ccdd9 Fix some tests e0118c44 The contao.routing.url_generator is only available in legacy mode f6f1d198 Fix remaining unit tests 87c121ac CS f7ae7a9e Trigger route error only when used 6ba5f7a1 Added 100% test coverage for ContentCompositionListener 74f8c7c5 Added missing unit tests 22394dda Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php # core-bundle/tests/Functional/RoutingTest.php 325b1147 Fixed ContaoCoreExtensionTest 5627ec33 CS 888ec702 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/tests/Asset/ContaoContextTest.php 701cd593 CS 0be72326 Always insert the new article into an available layout column cbd42acc Expect deprecations afc706a1 CS 577f1fa3 CS c719b1c5 CS e51d4324 Move classes to new namespace 5b30edde Refactor with PageRouteFactory edd253ef Added PageRegistry de480f2f CS and tests 629300e4 Added concept of path parameters bb76ae64 Fixed service name 793b3d56 Providing URL suffixes without custom routes does not make sense 4692bccd PageModel is not optional 502276ad Make the RouteFactory more generic f11ab176 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php 4dd724af Tests 62886460 Fixed failing test if there are no url suffixes ae90ba66 Logger is optional d696ed9d Logger is optional 0262068f phpstan 613c39ee phpstan 2afd655c phpstan & tests 37c4dda4 phpstan & tests c337e1b0 phpstan & tests 5b78fa64 Merge remote-tracking branch 'upstream/master' into feature/routing 8342fa0b psalm & tests edb1e52b yamllint 194f942a Do not use warning color if legacy routing is disabled 5a1b41a1 Reuse class name variable c422a021 Register interfaces for autoconfiguration c93b1e6d Drop unnecessary tags with autoconfigure 4328f77a Correctly purge search index b5d4be1e Use PathUtil to check if hook is in vendor dir ece1376c Throw correct exception if route is not supported c60854cb Merge remote-tracking branch 'upstream/master' into feature/routing f4ca10f7 Use the security voter to check article permissions 61bccf79 Tests 04f50f1e Tests c4b004bb Rename page controllers a806b39c Use subscribed services 289cc0ba URL must include prefix and suffix when generating candidates 2e507a45 CS a63f3373 Rewrite candidates d023ee3e Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/library/Contao/Controller.php e46b79ad Fixed return type 82fbcc41 Code review 491c83b9 Code review 681dafdc Check if the URL prefix is duplicated in another root page 2fa6eee0 Merge remote-tracking branch 'upstream/master' into feature/routing bfab096b Fix the coding style c1cca71f Merge branch 'master' into feature/routing f3cbd681 Fix the unit tests 63188d64 Fix the phpDoc types 92ea0725 Adjust the deprecation messages 35e4d71e Fix a non-optimal if condition 7ba51e75 Fix some minor issues fba7c23a Adjust the "this setting has been disabled" warning a1d05327 Review from @dmolineus a972f8d8 Review from @leofeyer 164291bb Fixed Route404Provider tests 0dea19a8 Use permission constants 5c723859 Remove invalid model methods 444c7364 Use callback instead of listener method for help icon 6ef2654c Fix the coding style d9a259ae Fix a wrong trans-unit ID 351c32fa Replace "@var Adapter" with something the IDE and PhpStan understand ab6cb7eb Correctly generate the index route b01b0598 Correctly match a request with url prefix if there is no index page c089b6dd Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/ContaoCoreBundle.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/models/PageModel.php # core-bundle/src/Routing/RouteProvider.php # core-bundle/tests/ContaoCoreBundleTest.php c338e4a0 CS 7763b81d Fix the CI chain 5db0afe7 Drop the parameters field a4aba627 Allow to define content composition in the service tag/annotation 31d34ec2 Get URL prefix and suffix from the page registry ea8f57bd Rename the PageRouteEnhancerInterface 2e373e43 Update RootController, no longer needs additional interfaces b8957447 Allow relative or absolute path for page controllers 3295ed80 CS 524c5e62 Fix tests 5850c246 CS 961ffcd4 Use $this->createResult() instead of new MigrationResult() 1f70bdbe Implemented feedback from @Toflar ded7d5c2 Correctly validate the URL suffix 64b388e0 Correctly support absolute URLs with empty prefix f7fda160 CS
aschempp
pushed a commit
that referenced
this pull request
Aug 4, 2020
Description ----------- With @Toflar we have discovered by accident that if a URL is double-encoded (for some reason, doesn't matter) the Contao's `RouteProvider` will eventually throw an error trying to query a database. ``` URL original: drachenlochmuseum-v%25c3%25a4ttis.html URL decoded: drachenlochmuseum-v%c3%a4ttis.html URL decoded 2nd time: drachenlochmuseum-vättis.html ``` The decoded URL is used in the database query and that fails because the database driver would like to replace wildcards `%c` with parameters that were not provided. Stack trace: ``` Exception: Too few arguments to build the query string contao#27 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(304): replaceWildcards contao#26 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(249): execute contao#25 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(1102): find contao#24 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(973): findBy contao#23 vendor/contao/core-bundle/src/Framework/Adapter.php(38): __call contao#22 vendor/contao/core-bundle/src/Routing/RouteProvider.php(493): findPages contao#21 vendor/contao/core-bundle/src/Routing/RouteProvider.php(88): getRouteCollectionForRequest contao#20 vendor/contao/core-bundle/src/Routing/LegacyRouteProvider.php(43): getRouteCollectionForRequest contao#19 vendor/symfony-cmf/routing/src/NestedMatcher/NestedMatcher.php(141): matchRequest contao#18 vendor/contao/core-bundle/src/Routing/Matcher/LegacyMatcher.php(69): matchRequest contao#17 vendor/symfony-cmf/routing/src/DynamicRouter.php(271): matchRequest contao#16 vendor/symfony-cmf/routing/src/ChainRouter.php(188): doMatch contao#15 vendor/symfony-cmf/routing/src/ChainRouter.php(158): matchRequest contao#14 vendor/symfony/http-kernel/EventListener/RouterListener.php(115): onKernelRequest contao#13 vendor/symfony/event-dispatcher/EventDispatcher.php(212): doDispatch contao#12 vendor/symfony/event-dispatcher/EventDispatcher.php(44): dispatch #11 vendor/symfony/http-kernel/HttpKernel.php(126): handleRaw #10 vendor/symfony/http-kernel/HttpKernel.php(67): handle #9 vendor/symfony/http-kernel/Kernel.php(198): handle #8 vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(85): handle #7 vendor/symfony/http-kernel/HttpCache/HttpCache.php(448): forward #6 vendor/symfony/framework-bundle/HttpCache/HttpCache.php(57): forward #5 vendor/symfony/http-kernel/HttpCache/HttpCache.php(420): fetch #4 vendor/contao/manager-bundle/src/HttpKernel/ContaoCache.php(46): fetch #3 vendor/symfony/http-kernel/HttpCache/HttpCache.php(317): lookup #2 vendor/symfony/http-kernel/HttpCache/HttpCache.php(192): handle #1 vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(98): handle #0 web/app.php(58): null ``` Commits ------- 8ae2582 Fix a potential error if the URL has percentage in it 8caaf25 Fix unit tests 509f762 Correctly encode the page aliases
aschempp
pushed a commit
that referenced
this pull request
Mar 15, 2021
) Description ----------- Fixes contao#2787 ([thread](https://community.contao.org/de/showthread.php?80310-Internal-Server-Error-beim-Dr%C3%BCcken-auf-quot-Auswahl-%C3%A4ndern-quot-bei-der-Weiterleitungsseite&p=540163&viewfull=1#post540163)): ``` TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, null given at vendor/contao/core-bundle/src/EventListener/DataContainer/ContentCompositionListener.php:107 at preg_replace() (vendor/contao/core-bundle/src/EventListener/DataContainer/ContentCompositionListener.php:107) at Contao\CoreBundle\EventListener\DataContainer\ContentCompositionListener->renderPageArticlesOperation() (vendor/contao/core-bundle/src/Resources/contao/classes/DataContainer.php:804) at Contao\DataContainer->generateButtons() (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:4028) at Contao\DC_Table->generateTree() (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:3628) at Contao\DC_Table->treeView() (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:353) at Contao\DC_Table->showAll() (vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:644) at Contao\Backend->getBackendModule() (vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:167) at Contao\BackendMain->run() (vendor/contao/core-bundle/src/Controller/BackendController.php:48) at Contao\CoreBundle\Controller\BackendController->mainAction() (vendor/symfony/http-kernel/HttpKernel.php:158) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:80) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:201) at Symfony\Component\HttpKernel\Kernel->handle() (web/index.php:31) ``` Since `$icon` can specifically be null. Not sure why it would be though in this specific instance, but apparently it can happen. Commits ------- 1f5fa9d check if icon is null d3f8425 return empty string if href and icon are missing a6d128a Merge branch '4.11' into fix-content-composition-listener-if-icon-is-null 7fc3159 Update core-bundle/src/EventListener/DataContainer/ContentCompositionListener.php Co-authored-by: Leo Feyer <github@contao.org> 69243b6 Correctly merge image size _defaults (see contao#2783) Description ----------- | Q | A | -----------------| --- | Fixed issues | - | Docs PR or issue | - Currently defining `formats` under the image size `_defaults` is broken. This is because the processed config values of the individual size definitions already contain an empty `formats` array which then wins in `array_merge`. This PR fixes this problem by giving the values under `_defaults` precedence over empty arrays. Unfortunately this case was missing from the tests and went unnoticed (added now)… Commits ------- b7b7b60 merge _defaults with precedence over empty arrays 990be33 add reference af36ec2 Merge branch '4.11' into bugfix/image-size-defaults-empty-arrays aafb762 Suggest using the contao-setup binary with @php prefix (see contao#2796) Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes contao#2776 | Docs PR or issue | - related contao/managed-edition#57 Commits ------- b1bd185 suggest using the prefixed contao-setup binary 9cfd8c6 fix accessing undefined variable (see contao#2806) Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes #... | Docs PR or issue | contao/docs#... Sigh, another one for PHP8. Fixes ``` Warning: Undefined array key "breadcrumb" ``` after clicking on the articles selection in the page tree because the `sorting` array does not contain `breadcrumb`. Commits ------- 36dcf5e fix accessing undefined variable fdbc6b8 Correctly sort pages if the URL suffix is empty (see contao#2784) Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes contao#2775 Apparently, `substr('foo', 0, -0)` is empty 🙈 Commits ------- 502a0e0 Correctly sort pages on empty URL suffix aa5fe3b Merge branch '4.11' into bugfix/folderurl f16cbfc Fix accessing Model\Collection instead of Model in ModuleFaqPage (see contao#2788) Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes contao#2786 | Docs PR or issue | - `$figureBuilder->setMetadata($objFaq->getOverwriteMetadata())` was failing because `$objFaq` is a `Model\Collection` instead of a `Model`. To prevent this rather hard to spot error in the future, I adjusted how we're iterating over the results instead. Commits ------- ff2f8b9 iterate over FaqModels instead of operating on Model\Collection c2934f0 Merge branch '4.11' into bugfix/module-faq-model-collection 51107f0 Handle another illegal array access in the tl_page DCA (see contao#2794) Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes - | Docs PR or issue | - This fixes `Warning: Undefined array key "root"` coming from `DCTable` line 3669. This also hardens `tl_page#pastePage()` that will receive an incomplete `$row` by the call in line 3678 and would otherwise produce `Warning: Undefined array key "pid"`. https://github.com/contao/contao/blob/1873bcc9ea728a08ca8755f6e7251d999d7b316b/core-bundle/src/Resources/contao/drivers/DC_Table.php#L3669-L3690 Commits ------- 7e5b39f handle illegal array access 5ff8b5f simplify expression Co-authored-by: Leo Feyer <github@contao.org> aaa71e1 Fix the logout handler in Symfony 5 (see contao#2818) Description ----------- This PR fixes the following error in Contao **4.11.0**: ``` TypeError: Argument 2 passed to Contao\CoreBundle\Security\Logout\LogoutHandler::logout() must be an instance of Symfony\Component\HttpFoundation\Response, null given, called in vendor\symfony\security-bundle\Security\LegacyLogoutHandlerListener.php on line 42 at vendor\contao\contao\core-bundle\src\Security\Logout\LogoutHandler.php:50 at Contao\CoreBundle\Security\Logout\LogoutHandler->logout() (vendor\symfony\security-bundle\Security\LegacyLogoutHandlerListener.php:42) at Symfony\Bundle\SecurityBundle\Security\LegacyLogoutHandlerListener->onLogout() (vendor\symfony\event-dispatcher\EventDispatcher.php:270) at Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (vendor\symfony\event-dispatcher\EventDispatcher.php:230) at Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (vendor\symfony\event-dispatcher\EventDispatcher.php:59) at Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (vendor\symfony\security-http\Firewall\LogoutListener.php:122) at Symfony\Component\Security\Http\Firewall\LogoutListener->authenticate() (vendor\symfony\security-bundle\Debug\WrappedLazyListener.php:49) at Symfony\Bundle\SecurityBundle\Debug\WrappedLazyListener->authenticate() (vendor\symfony\security-http\Firewall\AbstractListener.php:26) at Symfony\Component\Security\Http\Firewall\AbstractListener->__invoke() (vendor\symfony\security-bundle\Debug\TraceableFirewallListener.php:62) at Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->callListeners() (vendor\symfony\security-http\Firewall.php:86) at Symfony\Component\Security\Http\Firewall->onKernelRequest() (vendor\symfony\event-dispatcher\Debug\WrappedListener.php:117) at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke() (vendor\symfony\event-dispatcher\EventDispatcher.php:230) at Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (vendor\symfony\event-dispatcher\EventDispatcher.php:59) at Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (vendor\symfony\event-dispatcher\Debug\TraceableEventDispatcher.php:151) at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch() (vendor\symfony\http-kernel\HttpKernel.php:133) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor\symfony\http-kernel\HttpKernel.php:79) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor\symfony\http-kernel\Kernel.php:195) at Symfony\Component\HttpKernel\Kernel->handle() (web\index.php:31) at require('web\\index.php') (web\app.php:4) ``` **Reproduction**: 1. Create a login form, login page and member. 2. Create a logout page. 3. Log into the front end. 4. Use the link in the menu for the logout. Apparently the `LogoutEvent` might not contain a `Response` object any more. Commits ------- aa5b2e8 fix argument error in Symfony 5 bd06335 Merge branch '4.11' into fix-logout-handler e1f1e8d Fix an illegal array access in DC_Table when expanding the tree (see contao#2805) Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes contao#2797 | Docs PR or issue | - I split the PR in two commits: * one that *only* formats the code so that there is any chance of reviewing this: contao@a1a16fe * one that applies the fixes: contao@9bcedb7 (If you want to, I can collapse the whole thing into a oneline-mega-expression again in a third one…) Commits ------- a1a16fe format call 9bcedb7 fix illegal array access 2f22b2f collapse expression 01a9a39 Allow passing an array of IDs to User::isMemberOf() (see contao#2834) Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes contao#2753 | Docs PR or issue | - To fix contao#2753 (do not show protected pages in the sitemap if there is no front end user or the user groups do not match), I have adjusted the `User::isMemberOf()` method to also accept an array of group IDs. This allows us to greatly simplify other checks as well: ### Current ```php $blnFeUserLoggedIn = System::getContainer()->get('contao.security.token_checker')->hasFrontendUser(); while ($objCalendar->next()) { if ($objCalendar->protected) { if (!$blnFeUserLoggedIn || !\is_array($this->User->groups)) { continue; } $groups = StringUtil::deserialize($objCalendar->groups); if (empty($groups) || !\is_array($groups) || \count(array_intersect($groups, $this->User->groups)) < 1) { continue; } } // … } ``` ### New ```php $user = null; if (System::getContainer()->get('contao.security.token_checker')->hasFrontendUser()) { $user = FrontendUser::getInstance(); } while ($objCalendar->next()) { if ($objCalendar->protected && (!$user || !$user->isMemberOf(StringUtil::deserialize($objCalendar->groups)))) { continue; } // … } ``` Commits ------- 9a924c3 Allow passing an array of IDs to User::isMemberOf() c5c39ae add some unit tests 2db757c Merge branch '4.11' into fix-content-composition-listener-if-icon-is-null
aschempp
pushed a commit
that referenced
this pull request
Mar 23, 2021
Description ----------- | Q | A | -----------------| --- | Fixed issues | partly solves contao#2316 | Docs PR or issue | - I'm working on test isolation. This part makes sure tests aren't reading temporary data from each other. This effectively means that a test should never write into the `Fixtures` dir (or anywhere else inside the source directories). If temporary files need to be created this now will happen inside the test's own `tmp` dir. While working on these files, I'm also adjusting the following for consistency: 1) Refactoring path operations to use `Path` 1) Removing private property `$filesystem` (if we want to share the `Filesystem` instance across tests, we should imo add it to `ContaoTestCase` as a static property) 1) Use `$filesystem` instead of `$fs` everywhere Following changes needed for contao#2316 (but unrelated to writing files) are also part of this PR: 1) Reset template loader every time (was missing once, now in `tearDown`). 1) Do not share `ContaoCacheWarmer` instance. Commits ------- 4e5fa52 never write into tests/Fixture dir baf27c4 always reset TemplateLoader 827d5f2 add missing file c3c0e62 backport changes from contao#1918 2aeb2ee CS 7927286 Merge branch '4.9' into bugfix/test-order/do-not-write-in-fixture-dir a50db5c Fix the prefer-lowest tests 71e7cfa clear var directory after running functional tests c466d7e bugfix for bugfix/test-order/do-not-write-in-fixture-dir 3b4fdb4 Merge pull request #2 from fritzmg/fix-bugfix/test-order/do-not-write-in-fixture-dir bugfix for bugfix/test-order/do-not-write-in-fixture-dir 9891c55 fix filepath comparisons a25d552 Merge pull request #3 from fritzmg/fix-imagefactorytest-filepath-comparisons Fix filepath comparisons
AlexejKossmann
pushed a commit
to AlexejKossmann/contao
that referenced
this pull request
Apr 6, 2021
Description ----------- This PR implements several long-discussed improvements we want to have in the Contao routing. ### Features: - [x] Configure URL-prefix (`.html`) per root page instead of the app config - [x] Configure the _prepend locale_ setting per root page instead of the app config - [x] Implement support for custom language prefix (closes contao#862) - [x] Only redirect to the language version of a page if it exists (see contao#1456) - [x] Generate routes for entities (e.g. pass `PageModel` to `$router->generate()` (see contao#831) - [x] Allow for custom page types as controllers (see contao#1160, contao#390) - [x] Allow a page type to have a static URL suffix (e.g. `.xml` instead of `.html` for the XML sitemap). #### Side Features - [ ] ~Do not generate frontend URLs for pages with parameters~ - [ ] ~add alternative to the `Input` class that also tracks unused parameters~ (not sure about this, as the Input is no longer used with routing parameters) - [x] _really_ only create template article for new pages that can have them - [x] do not create article if the new page's layout does not have articles ### Tasks - [ ] write documentation about _legacy routing mode_. - [ ] include support for extended languages (see https://github.com/contao/core-bundle/issues/1579) - [x] the url prefix should be unique for pages with the same dns setting. contao#1516 (comment) ### Follow-Up PRs - [x] Use router to generate SERP widget URL aschempp#3 - [ ] Replace current page types aschempp#4 - [ ] Support news aschempp#5 - [ ] Support calendar events aschempp#6 - [ ] Support other content (faq, etc.) ### Notes about backwards compatibility As discussed at the developer meeting in February 2020, we cannot keep full BC between the new features and the existing routing. The `contao.prepend_locale` and `contao.url_suffix` container configuration as well as the `getPageIdFromUrl` or `getRootPageFromUrl` hooks are conflicting with the new features. We agreed that Contao should fall into a _legacy routing_ mode, where the new features are not available in the root page in that case. **BC Todos:** - [x] Disable root page configuration in legacy routing mode - [x] ~Find a way to keep supporting `contao.routing.url_generator` service~ _only in legacy mode_ ### Related PRs / Dependencies: - [x] contao#1447 - [x] contao#1448 - [x] contao#1458 - [x] contao#1501 - [x] contao#1503 - [x] contao#1506 - [x] contao#1518 - [x] contao#1533 - [x] contao#1182 - [x] ~~contao#1639 - [x] contao#1640 - [x] contao#1650 - [x] contao#1652 - [x] contao#1864 - [x] contao#1869 - [x] contao#1896 Commits ------- 21a9efe Use page language instead of _locale parameter for $_GET['language'] c2ba2d1 Add languagePrefix and urlSuffix fields to tl_page d3abce3 Deprecate the bundle config but override the page config if set 78dfc42 Fix alias rendering in PageTree b8616b0 Rewrite the language filter to use the page properties ec3969d Add legacy routing check to ContaoFramework class 4f26e73 Added separate class to generate URL candidates 29bd111 Add languagePrefix and urlSuffix to PageModel with BC layer 510da35 Update RouteProvider to use candidates based on root page 02eca55 Add redirect routes if page is requested without languagePrefix 62f3656 Update routing functional tests c1f2f93 Added migration for tl_page fields 39d987b Set config values from current request 5b03a6c Correctly generate root and fallback routes with languagePrefix db9768f Check for ID/alias duplicate with new page parameters 83fc289 Use pageModel from request or trigger exception in deprecated methods without legacy mode 01b9c97 Update Route404Provider to use languagePrefix from PageModel 0d3f58b Fixed service arguments for LegacyRoutingListener bc02925 Added duplicates validation for alias, languagePrefix and urlSuffix 95c7042 Correctly migrate the legacy routing configuration 192fff1 CS and test fixes aa09e96 Switch page type and alias field position 11638ac Add route name and object to the attributes 139b19c Add custom route object for PageModel 223182e Content resolvers convert content to a route object 168c218 Let the page model tell if useAutoItem is enabled 8158ad2 Use service tagging to add router enhancers bda2a16 CS 44a5a43 Let the router generate page URLs b7bd00b Use the DynamicRouter from CMF Routing Bundle a8dcc22 Rename the ContentResolverInterface to ContentUrlResolverInterface 692742d Introducing page providers 190a38b Make PageRoute more flexible 5375860 Always render regular page for unknown types 4a27948 Added autoconfiguration for contao.page_provider 1b3bf76 Added RootPageProvider which provides the default url suffixes 0e559fc Generate page type options from providers c03f503 Added ContentCompositionListener to correctly show or hide article features 8b27f64 Added BC layer for UrlGenerator and other legacy routing 2c0115f Enable legacy routing by container configuration and throw exception if hooks require it a9f09bc Add legacy routing information to the data collector 156ef52 Trigger deprecation warnings if the Symfony routing is not used 928de08 Always show list of legacy routing hooks in profiler 079370f Rename languagePrefix to urlPrefix a015340 Include the previous exception on re-throw ca7ea33 Fix spelling in method name f384d55 Use ::class in exception message 1fc7bfd ContentUrlResolvers must always return a route f9cfbe8 Decorate the Candidates to implement legacy behavior dea83be Add an additional router for the legacy routes in legacy mode 41ab6c6 Adjust routing to string route name see symfony-cmf/Routing#250 1d7968c Fix remaining objects passed to Router::generate() 10b1b3e Add some deprecation notices and annotations 815e1c0 Fixed argument order in exception message 8fdbdf9 Use anonymous services for legacy routing ba67633 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php # core-bundle/src/Resources/config/services.yml # core-bundle/src/Resources/contao/dca/tl_article.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/library/Contao/Template.php # core-bundle/src/Resources/contao/themes/flexible/main.min.css # core-bundle/tests/Routing/Enhancer/InputEnhancerTest.php # core-bundle/tests/Routing/Route404ProviderTest.php 50ba4cd Fix incorrect service name fc680b7 Fix unit tests for ContaoCoreExtension 534ccdd Fix some tests e0118c4 The contao.routing.url_generator is only available in legacy mode f6f1d19 Fix remaining unit tests 87c121a CS f7ae7a9 Trigger route error only when used 6ba5f7a Added 100% test coverage for ContentCompositionListener 74f8c7c Added missing unit tests 22394dd Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php # core-bundle/tests/Functional/RoutingTest.php 325b114 Fixed ContaoCoreExtensionTest 5627ec3 CS 888ec70 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/tests/Asset/ContaoContextTest.php 701cd59 CS 0be7232 Always insert the new article into an available layout column cbd42ac Expect deprecations afc706a CS 577f1fa CS c719b1c CS e51d432 Move classes to new namespace 5b30edd Refactor with PageRouteFactory edd253e Added PageRegistry de480f2 CS and tests 629300e Added concept of path parameters bb76ae6 Fixed service name 793b3d5 Providing URL suffixes without custom routes does not make sense 4692bcc PageModel is not optional 502276a Make the RouteFactory more generic f11ab17 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Framework/ContaoFramework.php 4dd724a Tests 6288646 Fixed failing test if there are no url suffixes ae90ba6 Logger is optional d696ed9 Logger is optional 0262068 phpstan 613c39e phpstan 2afd655 phpstan & tests 37c4dda phpstan & tests c337e1b phpstan & tests 5b78fa6 Merge remote-tracking branch 'upstream/master' into feature/routing 8342fa0 psalm & tests edb1e52 yamllint 194f942 Do not use warning color if legacy routing is disabled 5a1b41a Reuse class name variable c422a02 Register interfaces for autoconfiguration c93b1e6 Drop unnecessary tags with autoconfigure 4328f77 Correctly purge search index b5d4be1 Use PathUtil to check if hook is in vendor dir ece1376 Throw correct exception if route is not supported c60854c Merge remote-tracking branch 'upstream/master' into feature/routing f4ca10f Use the security voter to check article permissions 61bccf7 Tests 04f50f1 Tests c4b004b Rename page controllers a806b39 Use subscribed services 289cc0b URL must include prefix and suffix when generating candidates 2e507a4 CS a63f337 Rewrite candidates d023ee3 Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/Resources/contao/library/Contao/Controller.php e46b79a Fixed return type 82fbcc4 Code review 491c83b Code review 681dafd Check if the URL prefix is duplicated in another root page 2fa6eee Merge remote-tracking branch 'upstream/master' into feature/routing bfab096 Fix the coding style c1cca71 Merge branch 'master' into feature/routing f3cbd68 Fix the unit tests 63188d6 Fix the phpDoc types 92ea072 Adjust the deprecation messages 35e4d71 Fix a non-optimal if condition 7ba51e7 Fix some minor issues fba7c23 Adjust the "this setting has been disabled" warning a1d0532 Review from @dmolineus a972f8d Review from @leofeyer 164291b Fixed Route404Provider tests 0dea19a Use permission constants 5c72385 Remove invalid model methods 444c736 Use callback instead of listener method for help icon 6ef2654 Fix the coding style d9a259a Fix a wrong trans-unit ID 351c32f Replace "@var Adapter" with something the IDE and PhpStan understand ab6cb7e Correctly generate the index route b01b059 Correctly match a request with url prefix if there is no index page c089b6d Merge remote-tracking branch 'upstream/master' into feature/routing # Conflicts: # core-bundle/src/ContaoCoreBundle.php # core-bundle/src/Resources/contao/dca/tl_page.php # core-bundle/src/Resources/contao/models/PageModel.php # core-bundle/src/Routing/RouteProvider.php # core-bundle/tests/ContaoCoreBundleTest.php c338e4a CS 7763b81 Fix the CI chain 5db0afe Drop the parameters field a4aba62 Allow to define content composition in the service tag/annotation 31d34ec Get URL prefix and suffix from the page registry ea8f57b Rename the PageRouteEnhancerInterface 2e373e4 Update RootController, no longer needs additional interfaces b895744 Allow relative or absolute path for page controllers 3295ed8 CS 524c5e6 Fix tests 5850c24 CS 961ffcd Use $this->createResult() instead of new MigrationResult() 1f70bdb Implemented feedback from @Toflar ded7d5c Correctly validate the URL suffix 64b388e Correctly support absolute URLs with empty prefix f7fda16 CS
aschempp
pushed a commit
that referenced
this pull request
Jun 9, 2021
Description ----------- This PR * ensures the new `ResponseContext` does contain clean and unencoded values in preparation for the future (one thing less to migrate) * unifies the handling of insert tags for meta description. Sometimes it was stripped, sometimes replaced Commits ------- 3b9922c Ensure clean response context and unify meta handling 6b28659 Move description shortening to template ee9eedf Add StringUtil::getRawDecodedValue() f7969ba Add StringUtil::getRawDecodedValueFromHtml() 5821b91 Test and fix getRawDecodedValueFromHtml method 84a80bd Fix tests 7980cda Improve insert tag braces encoding bd10538 Merge pull request #2 from ausi/fix/response-context-encoding 1054d98 Use our own string util to shorten the description a5586c0 CS 3bd6984 Improve string util test cbd11c4 Merge pull request #3 from ausi/fix/improve-string-util-test 4dc2d38 CS 5a5578f Rename to StringUtil methods 207df74 CS
aschempp
pushed a commit
that referenced
this pull request
Nov 29, 2021
Description ----------- @m-vo @ausi I am not sure how to fix the remaining 10 issues: <img width="1183" alt="" src="https://user-images.githubusercontent.com/1192057/143582970-6915b42f-a754-4760-9d75-27508c710f2f.png"> Any idea? Commits ------- 93b2621 Unlock PHPStan level 6 08fcf19 Fix PHPStan 2e46f7a Adjust the FigureBuilder::setLinkAttribute() method 4856530 Fix two wrong @param annotations 5cef696 Fix two errors 77979af Merge branch '4.x' into fix/phpstan6 db8023d More PHPStan changes (see #3)
aschempp
pushed a commit
that referenced
this pull request
Dec 10, 2021
Description ----------- See contao#3743 (comment) Commits ------- 292c5a1 Unify MakeServicesPublicPass 797a4e7 Sort the IDs 9fc88f2 Do not call getDefinition() if the service ID is an alias (#3)
aschempp
pushed a commit
that referenced
this pull request
Dec 10, 2021
Description ----------- | Q | A | -----------------| --- | Fixed issues | Fixes contao#3415 | Docs PR or issue | - This PR implements the discussed solution for not generating any routes for the special `error_*` page types. The `PageRegistry` will throw a `RouteNotFoundException` when the route for any of the `error_*` pages is retrieved. The "non-routable" page types are hard coded in the `PageRegistry`, similar to the legacy page types which do not have content composition (`PageRegistry::DISABLE_CONTENT_COMPOSITION` & `PageRegistry::DISABLE_ROUTING`). Additionally the `SitemapController` checks the `_format` of the processed page and only adds pages with `html` content to the sitemap. Commits ------- b4c077c do not create routes for error pages 07621be only add html routes to the sitemap 8d29330 add test for PageRegistry dc1ddbb introduce UnroutablePageRouteCompiler 2b24459 add comment 9702ab7 fix functional tests 8f64d97 update all navigation modules 784b85f fix SitemapControllerTest after 4.x rebase ea6eca4 fix custom nav and change quick link 0999177 fix return type in breadcrumb 8e65d7e merge with 4.x aca2257 move isRoutable check to page registry e79e450 CS d8cdf7a fix Route404ProviderTest 178ad6b Merge branch '4.x' into no-routes-for-error-pages edc70ca revert changes to navigation modules e1a7b86 allow RouteConfig path to be boolean 1da20f9 code style 24d1c61 Merge branch '4.x' into no-routes-for-error-pages e212e63 Various improvements (#3) ed32cc4 merge with 4.x 582ecff code style ccb85c3 allow preview for non-routable pages, if they support content composition effb8d3 Revert "allow preview for non-routable pages, if they support content composition" This reverts commit ccb85c3. aaea5a5 satisfy PHPstan 0e4c098 use consistent variable naming 011ebb1 Merge branch '4.x' into no-routes-for-error-pages 66ef9f8 fix type hint Co-authored-by: Leo Feyer <github@contao.org> abba526 do not check for route instance cda07ce CS 7c16a22 fix return type 35dbc23 CS
aschempp
pushed a commit
that referenced
this pull request
Mar 14, 2022
…ng (see contao#4259) Description ----------- I think there might be a problem in `contao/manager-bundle`: https://github.com/contao/manager-bundle/blob/4.13/src/ContaoManager/Plugin.php#L514 If the `.env` file contains the empty `DATABASE_URL` value, which could be the case when it is committed to the git repository; for example: ```env DATABASE_URL= ``` … and there is no `.env.local` file (in my case in CI/CD Github Action) then I do get an error upon `composer install` (or speaking precisely upon `@php vendor/bin/contao-setup`): ``` PHP Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, null given in /home/runner/work/my_vendor/my_project/vendor/contao/manager-bundle/src/ContaoManager/Plugin.php:511 ``` The reason is that `parse_url($url, PHP_URL_SCHEME)` returns `null` if the `$url` is an empty string. I find it quite common to have the `.env` file in the repository with an empty `DATABASE_URL` value, and it should not interrupt the fundamental command such as `composer install`. Thus my proposal to check if `$url` is an empty value, or not. Commits ------- 45c9c5a Avoid error if the DATABASE_URL environment variable is an empty string
leofeyer
pushed a commit
that referenced
this pull request
Jan 4, 2024
Description ----------- Description (and possibily title) could be nullable fields in the database. I got the following error from calling `StringUtil::substr` on the value: ``` Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated ``` see https://terminal42.sentry.io/share/issue/fbb102c0dc534b939824576c09de1bc1/ Commits ------- cac0d06 Fix NULL handling in SerpPreview
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.