-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Merge branch '5.3' into 5.x #7200
Merged
Merged
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
Description ----------- As discussed on the Contao camp, we need a way to work with serialized data coming from the DB in Twig templates, e.g. ```twig {% for index, value in 'a:2:{i:0;s:3:"foo";i:1;s:3:"bar";}'|deserialize %} {{ index }}: {{ value }} {% endfor %} ``` 1. Is a Twig filter the best option or do we need a Twig function so we can pass the `$force` argument? 2. Is deserializing in the template the best option or should we try to deserialize the data when passing it to the template? Commits ------- ada37c9 Add a `deserialize` Twig filter 75c8949 Set the $forceArray parameter to true
Description ----------- Tests for contao#7139 Commits ------- 52a3dd2 Test deserialize filter 9892323 Remove left over method call f65deba Add return type
…7147) Description ----------- The `{{news_url::ID}}` insert tag will throw an exception and break the page completely, if the reader page for this news archive is unpublished. Instead, we should likely return an empty string. Commits ------- db07f65 Catch the URL generator exception in the news insert tags
Description ----------- The binary is determined by `PhpSubprocess` itself or it has to be passed as a separate parameter which I think we should do here as we're caching it. Now we should finally have gotten this right. Commits ------- 11105f0 Fixed subprocess call once again 20e25a5 Update core-bundle/src/Util/ProcessUtil.php
Description ----------- Accessing the `$document->getContentCrawler()` is a very heavy operation if you have `masterminds/html5` installed because Symfony's DomCrawler component will use this parser automatically to parse the entire HTML. This can be very heavy, especially in the back end. I noticed that this listener is not needed in the back end at all, it's only wasted resources. I didn't bother fixing it in 4.13 because I don't use it anywhere anymore and by default, Contao does not have that problem because it does not require `masterminds/html5` itself. You will only have this useless slow-down when having it installed. Commits ------- a2f0e64 Skip search index listener in back end
…hp' (see contao#7155) Description ----------- Backport fix for contao#7152 Commits ------- 40eea98 Fix non-existent "contao.image.image_factory" in FeedItem.php contao#7153
Description ----------- **Problem:** The `DcaExtractor` is parsing DCA data and provides information about any enumeration fields within a DCA (see contao#6584 for the original feature). However, if the extracted data is cached by the `ContaoCacheWarmer`, the enum configuration is missing. This results in an incorrect/incomplete configuration and it is not possible to resolve enumerations within a model if the extract is read from the cache. **Solution:** This PR adds the enumeration configuration to the cached data in `ContaoCacheWarmer`, making the information available in cached extracts. **Additional optimisation & Tests** Manually assembling the extract for the cache does not appear to be the most sustainable solution. However, this is outside the scope of this PR. I have not made any adjustments to the tests in `ContaoCacheWarmerTest`, as so far only the output of `$this->arrFields` is tested in the extract and any other information (e.g. `arrRelations`, `arrKeys`, ...) is not checked explicitly. If an addition to the test is desired, I can extend the test case and test data to include a field with an enum configuration. Commits ------- 407b777 Fix DCA extractor cache for enum fields
) Description ----------- Contao 4 already has support for `boolean` SQL fields. However, there is still one issue remaining: if you try to copy records, you might encounter the following error: ``` Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `tl_content`.`foobar` at row 1 ``` This can be reproduced by the following DCA: ```php // contao/dca/tl_content.php $GLOBALS['TL_DCA']['tl_content']['fields']['foobar'] = [ 'eval' => ['doNotCopy' => true], 'sql' => ['type' => 'boolean', 'default' => false], ]; ``` Update the database and then try to copy a page article that contains content elements. This happens because the PDO driver automatically casts everything strings, if no type is given - which for `false` means an empty string - which in turn is not compatible with a `boolean` (`tinyint(1)`) field. To fix this we need to backport [this](https://github.com/contao/contao/blob/110d32fd52f5abfb58a07d15813d09dda7292e8e/core-bundle/contao/library/Contao/Database/Statement.php#L243-L248) from contao#4797. Commits ------- f2b4709 cast boolean to integer 7753a81 set type instead 4d8e742 cs fix 0126e2c Update core-bundle/src/Resources/contao/library/Contao/Database/State… c67a11e use string param and only fill array if empty d0801f9 fix check 5d992d2 cs fix 8698b23 Only set type to boolean if it wasn’t set explicitly (#8) 70d240f use foreach Co-authored-by: ausi <martin@auswoeger.com>
Description ----------- Alternative solution for contao#7148 - which will need to be reverted (the revert will fix contao#7159). The problematic code is https://github.com/contao/contao/blob/0792bf9cf7fd2d3a354b372b532e0a49661f7ed4/core-bundle/src/EventListener/SearchIndexListener.php#L95 which will be slow in the back end if you have a large site structure for instance - or a lot of files visible in the file manager etc. Instead of checking for the `backend` scope in the `SearchIndexListener` (which is not possible) we can instead add `X-Robots-Tag: noindex` to any back end response, as this will be checked for before that: https://github.com/contao/contao/blob/0792bf9cf7fd2d3a354b372b532e0a49661f7ed4/core-bundle/src/EventListener/SearchIndexListener.php#L89-L92 And besides it probably makes sense to add this for back end responses in any case. Commits ------- 4b4c81f Add 'X-Robots-Tag: noindex' to the back end
Description ----------- Fixes contao#7024 This will render the back end error screen, not the Symfony 404 message. I tried using a controller that throws an `NotFoundHttpException`, but that will result in the exact same template. Because our pretty error screen always handles backend exceptions. <img width="989" alt="Bildschirmfoto 2024-04-04 um 21 27 22" src="https://github.com/contao/contao/assets/1073273/91ab4423-ec6c-4ff0-88e4-e09f764f1eef"> Commits ------- eadd3a3 Add a fallback route for the back end 309b850 Adjust the exception message 76db678 Define the language in the route context Co-authored-by: leofeyer <1192057+leofeyer@users.noreply.github.com>
Description ----------- As discussed in contao#7158 and in Slack this restores the time period back end setting which had been erroneously removed in contao@77b024a in the wake of contao#203 - as no bundle config alternative or other alternative location was provided. And the setting itself is still actively used by Contao. I did not include `sessionTimeout` as this has been removed in Contao 5 and thus I would consider this a deprecated setting. While still used in Contao 4, you will need to adjust more than just the `localconfig.sessionTimeout` in order to increase the session timeout for example. Its usefulness as a back end setting is thus inherently limited. Commits ------- bdf7098 restore time period back end settings
# Conflicts: # core-bundle/contao/dca/tl_settings.php # core-bundle/contao/languages/en/tl_settings.xlf # core-bundle/src/Resources/contao/library/Contao/Database/Statement.php
Description ----------- I was trying to add another `imgSize` field to `tl_module` and wanted to re-use the `contao.listener.image_size_options` listener which would be super easy like so: ```php $services->set('my_listener') ->parent('contao.listener.image_size_options') ->tag('contao.callback', [ 'table' => 'tl_module', 'target' => 'fields.my_image_sizes_field.options', ]) ; ``` However, this currently fails because parent services are not correctly resolved. This PR fixes this. The `while (!$definition->getClass() && $definition instanceof ChildDefinition) {` logic is Symfony standard and can be found in many other places for example the `RegisterEventListenersAndSubscribersPass` which has bascially more or less exactly the same responsibility as our `DataContainerCallbackPass` 😊 I've also updated the `TestListener` which technically is not necessary. I could've used another method to mock this logic but I figured I wanted to work with my use case which as the options listener 😉 Commits ------- 97da131 Fixed missing child definition support for callback tags d00c19e Both services must be public
Description ----------- Fixes contao#7162 Commits ------- 536c710 Fix invalid HTML Markup in Splashscreen (see contao#7162) 9d3f712 Fix invalid HTML Markup in Splashscreen (see contao#7162) 1d83149 Fix test for VideoController
Description ----------- Contao 4.13 already supports `boolean` SQL fields. However, there is still one issue: if you adjust your DCA from ```php 'sql' => "char(1) NOT NULL default ''", ``` or ```php 'sql' => ['type' => 'string', 'length' => 1, 'default' => '', 'options' => ['fixed' => true]], ``` to ```php 'sql' => ['type' => 'boolean', 'default' => false], ``` the following error will occur during migration (if you already have records in the affected DCA in your database): ``` [ERROR] An exception occurred while executing a query: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect INTEGER value: ' ' ``` This is something we fixed in Contao 5 with the `BooleanFieldsMigration` as it was needed there since we made that switch there as well. However, any project or extension in Contao 4.13 that makes that same switch will always run into this error. For example this error will happen if you update `terminal42/notification_center` from `1.x` to `2.x` (given that you already had entries in your database): ``` * ALTER TABLE tl_nc_language CHANGE fallback fallback TINYINT(1) DEFAULT 0 NOT NULL......FAILED * ALTER TABLE tl_nc_message CHANGE published published TINYINT(1) DEFAULT 0 NOT NULL......FAILED [OK] Executed 0 SQL queries. [ERROR] An exception occurred while executing a query: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect INTEGER value: ' ' [ERROR] An exception occurred while executing a query: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect INTEGER value: ' ' ``` Now you could of course implement the `BooleanFieldsMigration` in those extensions or projects. But it would definitely be more convenient if Contao already supports you in this and not every extension has to implement this on their own. To reproduce you can do the following: 1. Create the following DCA adjustment: ```php // contao/dca/tl_content.php $GLOBALS['TL_DCA']['tl_content']['fields']['foobar'] = [ 'sql' => "char(1) NOT NULL default ''", ]; ``` 2. Execute `contao:migrate --no-interaction`. 3. Create a new content element, if you have no content elements yet in your database. 4. Change the DCA to: ```php // contao/dca/tl_content.php $GLOBALS['TL_DCA']['tl_content']['fields']['foobar'] = [ 'sql' => ['type' => 'boolean', 'default' => false], ]; ``` 5. Execute `contao:migrate --no-interaction`. _Note:_ we could provide this migration in perpetuity, i.e. moving it to the `Contao\CoreBundle\Migration\` namespace. wdyt? Commits ------- 53ae9ab backport BooleanFieldsMigration 201fb64 cs fix
…(see contao#7170) Description ----------- Noticed this while working on contao#7038, it is currently possible to set metadata for folders etc. The new `onpalette_callback` in Contao 5.3 allows to apply this correctly for each individual record in multi-edit mode. Commits ------- 1324e4f Correctly adjust files palettes in edit-all mode
…contao#7173) Description ----------- Fixes contao#7166 Commits ------- 2a8440f Fix defer for combined JS Co-authored-by: <rene.luecking@sergroup.com>
Description ----------- Fixes contao#7116 Commits ------- a4c8e06 Allow to move an error page within its root e9eb53d Update core-bundle/src/Security/Voter/DataContainer/PageTypeAccessVot…
Description ----------- Fixes contao#7178 Commits ------- c369890 Render the `date::Y` insert tag inline
Description ----------- To reproduce this, delete the whole site structure of the official demo and click the "show details" button. <img width="900" alt="" src="https://github.com/contao/contao/assets/1192057/fd791ef2-fd22-4b8b-a9e2-0d17d7830b21"> Commits ------- 46d8596 Implode arrays recursively when showing undo records f919ae6 Use the YAML dumper dc4945d Remove the ArrayUtil::implodeRecursive() method again
…ao#7151) Description ----------- Fixes contao#7124 Commits ------- 4b352cf Add the Twig style sheets before the user style sheets 181cffc Add a new "stylesheets" target 187624c Insert the component style sheets before the CSS framework
Description ----------- In contao#731 a deprecation for hyphens in template names was added which turned into an exception in Contao 5. However it is unclear why this deprecation was added in the first place. The original issue contao#725 was fixed and this fix is still present in Contao 5. There are no actual issues with hyphens in template names, neither in Contao 4 nor in Contao 5. Besides, the error suggests to use snake case instead, which is semantically incorrect. In legacy templates names the underscore semantically creates template name (sub) groups. If you have a template called `mod_newslist_three-columns` it would technically be semantically incorrect to rename it `mod_newslist_three_columns`. As discussed on Slack it is unclear whether this deprecation was added in the first place. There are no actual issues with hyphens in template names. However, my guess is we added it because we wanted to change the template naming structure in Contao 5 - but this never happened for legacy PHP templates, as we switched to Twig templates. And Twig templates _do_ have a new structuring scheme. Therefore this restriction can be removed completely. _Note:_ I will do a separate PR for 4.13 to remove the deprecation. Commits ------- 01fdd9a remove hyphens restriction for templates names 10a8de9 remove accidental change 6f115fa remove test 3f313cc update tests
Description ----------- Fixes contao#7137 Commits ------- eda4b33 Show all page types in the help wizard
…ao#7175) Description ----------- Fixes contao#7038 The permission check is applied by the `TableAccessVoter` here. It is intentionally only applied to the edit operation, because move or copy should not check for `canEditFieldsOfTable`. Also does not work with Contao 4.13 – not sure we want to backport that. We don't check any such permissions in 4.13. Contrary to 5.3, where an access denied exception is thrown by the `TableAccessVoter`, in Contao 4.13 we just render an empty list of fields to edit everywhere. --- Side note: I also started working on actual file permissions in contao/contao@5.3...aschempp:contao:fix/files-permissions. There are a number of unknowns though, e.g. is editing a file (content) not the same as editing file metadata. It also related to the virtual file system and a possible redesign of the file manager by @m-vo. After discussing stuff like the `UploadAction` I postponed that for now and setteled for this "quick fix". Commits ------- d9843ba Check fieldsOfTable access for file edit operation
Description ----------- We currently trigger several `Using the "replaceInsertTags" hook has been deprecated…` deprecations because we still use the legacy hook. Is this a bug? Commits ------- 99a451d Do not use deprecated replaceInsertTags hook
…o#7186) Description ----------- As mentioned in contao#7185 (comment) if you add a `contao.insert_tag` service tag without the `AsInsertTag` attribute, e.g. directly via your `services.yaml` for example ```yaml services: App\InsertTag\MyInsertTag: tags: - contao.insert_tag: name: my_tag ``` you will get warnings for missing `method` and `priority` array keys. This PR fixes that by falling back to the same values as in the `AsInsertTag` attribute (`null` and `0` respectively). Commits ------- 8984de2 allow insert tag tags without method and priority
Description ----------- Fixes contao#7184 Commits ------- 0546ab4 Fix ParsedSequence serialize() method
Description ----------- Commits ------- 7f0efad Hide migrated news feeds in the navigation menu
Description ----------- This restores the permission handling we had in all previous Contao versions. After discussing with @Toflar, this is the only viable solution to fix our permission issues. Here are two examples that are imho impossible to fix otherwise. They are not a technical issue, but a logical one. 1. If you duplicate a page, its articles will be duplicated as well as its content elements. If you do not have access to some elements, the whole page and articles are duplicated, **but "random" content elements will be missing**. 2. even worse, when deleting a page, DC_Table tries to delete all child records and create an undo record for them. The ones that the user does not have access will not be deleted, **and will not be added to the undo record**. They are however still removed by our reviseTable, and will therefore be lost without the option to undo. In the same sense we could discuss to adjust the `undo` method instead of what we discussed in contao#7056 FYI @Toflar and me discussed that the same handling will not be possible in a regular REST/CRUD API. It would require special APIs for that, which can always be added if necessary. - Fixes contao#7101 - Probably also makes contao#7102 obsolete but correctly checking the IDs/updating the cache might still be correct. Commits ------- eb388c6 Skip permissions checks for child records 961033f Also remove permission check in undo operation 70d7577 Fixed duplicate variable name
…ao#7195) Description ----------- Fixes contao#7182 Same as contao#7194 for Contao 5.3 Commits ------- e1d089f Fix boolean fields migration column name
…ao#7194) Description ----------- Fixes contao#7182 Commits ------- 52244e3 Fix boolean fields migration column name
# Conflicts: # core-bundle/src/Resources/config/migrations.yml # core-bundle/src/Resources/contao/library/Contao/InsertTags.php
# Conflicts: # CHANGELOG.md # calendar-bundle/contao/languages/it/tl_module.xlf # core-bundle/config/listener.yaml # core-bundle/contao/languages/it/default.xlf # core-bundle/contao/languages/it/tl_article.xlf # core-bundle/contao/languages/it/tl_content.xlf # core-bundle/contao/languages/it/tl_maintenance.xlf # core-bundle/contao/languages/it/tl_member.xlf # core-bundle/contao/languages/it/tl_module.xlf # core-bundle/contao/languages/it/tl_page.xlf # core-bundle/contao/languages/it/tl_theme.xlf # core-bundle/contao/languages/it/tl_user.xlf # core-bundle/contao/languages/sl/default.xlf # core-bundle/contao/languages/sl/exception.xlf # core-bundle/contao/languages/sl/explain.xlf # core-bundle/contao/languages/sl/modules.xlf # core-bundle/contao/languages/sl/tl_article.xlf # core-bundle/contao/languages/sl/tl_content.xlf # core-bundle/contao/languages/sl/tl_files.xlf # core-bundle/contao/languages/sl/tl_image_size.xlf # core-bundle/contao/languages/sl/tl_log.xlf # core-bundle/contao/languages/sl/tl_maintenance.xlf # core-bundle/contao/languages/sl/tl_member.xlf # core-bundle/contao/languages/sl/tl_module.xlf # core-bundle/contao/languages/sl/tl_page.xlf # core-bundle/contao/languages/sl/tl_settings.xlf # core-bundle/contao/languages/sl/tl_theme.xlf # core-bundle/contao/languages/sl/tl_user.xlf # news-bundle/contao/languages/it/tl_module.xlf
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.