Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #4

Closed
wants to merge 1 commit into from
Closed

Update README.md #4

wants to merge 1 commit into from

Conversation

xchs
Copy link
Contributor

@xchs xchs commented Aug 19, 2018

Fix a typo.

Fix a typo.
@xchs xchs closed this Aug 19, 2018
@xchs xchs deleted the patch-1 branch August 19, 2018 19:52
leofeyer pushed a commit that referenced this pull request Nov 1, 2019
…es command (see #866)

Description
-----------

Together with @Toflar we had a hard time debugging why the `contao:resize-images` command stopped at some point and did not want to continue. The error message was quite unclear especially that the requested file existed:

```
6/77b26349-9084f1ba.jpg......... failed
Unable to open image /var/www/vhosts/domain.tld/httpdocs/releases/233/assets/images/../../var/pim-images/77b26349.jpg
```

So we decided to introduce an option that allows to output more verbose error message simply by executing command in verbose mode `contao:resize-images -v`:

```
f/8ac5c4ec-213df40b.jpg.............. failed

 [ERROR] ImagickException: cache resources exhausted
         `/var/www/vhosts/domain.tld/httpdocs/releases/233/assets/images/../../var/pim-images/8ac5c4ec.jpg' @
         error/cache.c/OpenPixelCache/3864 in
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/imagine/imagine/src/Imagick/Imagine.php:69
         Stack trace:
         #0 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/imagine/imagine/src/Imagick/Imagine.php(69):
         Imagick->__construct('/var/www/vhosts...')
         #1 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/Resizer.php(93):
         Imagine\Imagick\Imagine->open('/var/www/vhosts...')
         #2 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/DeferredResizer.php(185):
         Contao\Image\Resizer->executeResize(Object(Contao\Image\Image), Object(Contao\Image\ResizeCoordinates),
         '/var/www/vhosts...', Object(Contao\Image\ResizeOptions))
         #3 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/DeferredResizer.php(108):
         Contao\Image\DeferredResizer->executeDeferredResize('f/8ac5c4ec-213d...', Array,
         Object(Imagine\Imagick\Imagine))
         #4
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/core-bundle/src/Command/ResizeImagesComma
         nd.php(189): Contao\Image\DeferredResizer->resizeDeferredImage(Object(Contao\Image\DeferredImage), false)
         #5
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/core-bundle/src/Command/ResizeImagesComma
         nd.php(166): Contao\CoreBundle\Command\ResizeImagesCommand->resizeImage('f/8ac5c4ec-213d...',
         Object(Symfony\Component\Console\Style\SymfonyStyle))
         #6 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/symfony/console/Command/Command.php(255):
```

Commits
-------

e9c6de9 Allow to output more verbose error messages in contao:resize-images command
leofeyer 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
#27 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(304): replaceWildcards
#26 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(249): execute
#25 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(1102): find
#24 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(973): findBy
#23 vendor/contao/core-bundle/src/Framework/Adapter.php(38): __call
#22 vendor/contao/core-bundle/src/Routing/RouteProvider.php(493): findPages
#21 vendor/contao/core-bundle/src/Routing/RouteProvider.php(88): getRouteCollectionForRequest
#20 vendor/contao/core-bundle/src/Routing/LegacyRouteProvider.php(43): getRouteCollectionForRequest
#19 vendor/symfony-cmf/routing/src/NestedMatcher/NestedMatcher.php(141): matchRequest
#18 vendor/contao/core-bundle/src/Routing/Matcher/LegacyMatcher.php(69): matchRequest
#17 vendor/symfony-cmf/routing/src/DynamicRouter.php(271): matchRequest
#16 vendor/symfony-cmf/routing/src/ChainRouter.php(188): doMatch
#15 vendor/symfony-cmf/routing/src/ChainRouter.php(158): matchRequest
#14 vendor/symfony/http-kernel/EventListener/RouterListener.php(115): onKernelRequest
#13 vendor/symfony/event-dispatcher/EventDispatcher.php(212): doDispatch
#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
leofeyer pushed a commit that referenced this pull request Jun 14, 2021
Description
-----------

Alternative approach for response context as discussed in Core team call.
I guess there's no point in explaining it all here - I'll just document the final iteration once everything is done in the Contao dev docs ^^

Commits
-------

205dafc Reworked response context concept
786b50c Merge branch '4.x' into feature/response-context-rework
4d1cf18 CS
d2151bb Fixed tests
aae1091 Implemented removing existing services and added support for interfaces
0a83cbe Added psalm docs
5f27ffc Make HtmlHeadBag final
5e75e38 CS
950e9bb Also consider parent classes as aliases
fbe8206 Going back to a regular array and removed the remove() method
41b1c60 Added support for lazy services
8a35bc9 Fixed tests
0d7f8d9 CS

Co-authored-by: Leo Feyer <github@contao.org>
5b9706c Added failing test to show class issue
d37a223 Merge pull request #4 from aschempp/feature/response-context-rework

Added failing test to show class issue
f0a1f35 Removed irrelevant assertion
1d29c95 Fixed tests
6399cc7 Cleanup
1255632 Fixed phpstan
6a1eebc CS
e90daf4 Added failing test to show alias being overridden
a5c9589 Merge pull request #5 from aschempp/feature/response-context-rework

Added failing test to show alias being overridden
1cb74c7 Fixed tests
84af804 Removed leftover
62cb0af CS
leofeyer added a commit that referenced this pull request Jan 17, 2022
Description
-----------

To-Do
-----

- [x] Naming
- [x] Tests

The idea is to get rid of multiple page layouts (or inserttags with module IDs in combination with `{{iflng::*}}` tags) for multiple root pages (and languages).

Usage
-----

You can now easy configure you modules for every root page available:

<img width="1232" alt="Bildschirmfoto 2021-12-15 um 22 36 21" src="https://user-images.githubusercontent.com/754921/146269104-58ae3bb8-f818-495b-8bd1-fa771213f4c4.png">


and include this module in your layout: 

<img width="830" alt="Bildschirmfoto 2021-12-15 um 22 39 41" src="https://user-images.githubusercontent.com/754921/146269130-9ede184a-c4d4-4efe-be76-7177a1c5255d.png">


This module will then render the configured module for each configured root page. 

Developers
----------

The module provides an additional input type to use in your own code:

**Use the default configuration** (loads all available modules):
```php
<?php
// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myRootPageDependentModule' => [
        'inputType' => 'rootPageDependentSelect',
        'eval' => [
            'tl_class' => 'w50',
        ],
        'sql' => 'blob NULL',
    ],
];
```

There is even more and you can customize this widget to your needs:

**use `options`** (for custom list of modules):
```php
<?php
// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myRootPageDependentModule' => [
        'inputType' => 'rootPageDependentSelect',
        'options' => [
            0 => 'My module 0',
            1 => 'My module 1',
        ],
        'eval' => [
            'tl_class' => 'w50',
        ],
        'sql' => 'blob NULL',
    ],
];
```

**use `options_callback`** (for custom list of modules):
```php
<?php
// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myRootPageDependentModule' => [
        'inputType' => 'rootPageDependentSelect',
        'options_callback' => ['my.service_id', 'methodName'],
        'eval' => [
            'tl_class' => 'w50',
        ],
        'sql' => 'blob NULL',
    ],
];

// you can also use this with service tagging, see https://docs.contao.org/dev/framework/dca/#registering-callbacks
```

**use `eval['modules']`** (to filter for custom types):
```php
<?php
// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myRootPageDependentModule' => [
        'inputType' => 'rootPageDependentSelect',
        'eval' => [
            'tl_class' => 'w50',
            'modules' => [
                'navigation',
                'customnav',
                'search',
                'html',
                'myCustomModule',
            ],
        ],
        'sql' => 'blob NULL',
    ],
];
```

**Change the label for the blank option**:
```php
<?php
// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myRootPageDependentModule' => [
        'inputType' => 'rootPageDependentSelect',
        'eval' => [
            'tl_class' => 'w50',
            'blankOptionLabel' => 'My Label'
        ],
        'sql' => 'blob NULL',
    ],
];
```

_Note:_ If you just want to change the label for the blank option of the default field, the key is: `tl_module.rootPageDependentModulesBlankOptionLabel`.

Commits
-------

b637e97 Add new language dependent module
056913d Fix method name
0d9824b Make it root page dependent
d78957c Remove loadLanguageFile call
214fd31 Remove use
7c8b11b Move configuration to DCA file
91235b8 Fix merge services.yml
7447cde Fix merge of listener.yml
f09c231 Fix listener.yml
8dd0d75 Fix services.yml
acfb8cf Fixes
1672060 Fix CS
ad83e0d Fix listener.yml
4bd2ead Fix services.yml
e8d2d79 Merge branch '4.x' of github.com:contao/contao into feature/language-dependent-module-configuration
83aab2e Fix sorting
127497d Merge branch '4.x' of github.com:contao/contao into feature/language-dependent-module-configuration
243920b Merge branch '4.x' of github.com:contao/contao into feature/language-dependent-module-configuration
67fde19 Add unit test for controller
6082295 More tests
d1e7104 CS
3fcbcc2 CS
0894a40 Remove unused
f6b8d50 Remove obsolete registration
b638dd2 Use Hook annotation
654cd29 Adjust wording
86cbde1 Remove template
e97704c Adjust palette
971a70a Tag response
6c85b7b Use callback annotation
68256d2 Rename and fixes
126ed6a Rename methods
64833ff Add test for wizardCallback
a91283f Fix CS
8f8cbc7 Fix tests on PHP8
d1a508f Cleanup
873e440 Merge branch '4.x' of github.com:contao/contao into feature/language-dependent-module-configuration
d960754 Test save callback
5c9f0a5 Test options callback
d60e29f Merge branch '4.x' of github.com:contao/contao into feature/language-dependent-module-configuration
6bbe3f3 CS fix
4d18783 Do not mark for internal caching
9920305 Merge branch '4.x' of github.com:contao/contao into feature/language-dependent-module-configuration
c742a6b Refactored logic into widget
0309d6b CS
2b801f2 Remove comment
de2b7dc Use ContaoCsrfTokenManager
9f56fda Search for type='root' instead of pid=0
a4762f9 Simplify
24f07a4 Merge branch '4.x' of github.com:contao/contao into feature/language-dependent-module-configuration
e2174c9 Add widget test
c48ea1b CS
a6e5469 Fix CS
d80d5e6 Remove useless mocks
9f2d99d Use PageModels & Collection in test
ae1520c CS
a562e5d CS
f2984b7 Adjusted controller
496e90a Remove buggy option groups feature
7b69035 CS
6335a6b Extend from AbstractFrontendModuleController (#4)
0442d14 Add test for Controller
728c12f Register the be_wildcard template in the unit test
91d6559 Canonicalize the path

Co-authored-by: Leo Feyer <github@contao.org>
leofeyer referenced this pull request in leofeyer/contao Mar 22, 2022
leofeyer referenced this pull request in leofeyer/contao Mar 22, 2022
Description
-----------

Unfortunately, #4 got merged without the changes we discussed, but here they are …

Commits
-------

03516da2 Fix FunctionalTestCase
6022d29e Fix method name
85e014d5 Boot kernel when resetting database
leofeyer added a commit that referenced this pull request May 9, 2022
Description
-----------

-

Commits
-------

32306fa Fix the global state unit tests
4405ac8 Suggestions for #4618 (#4)

Co-authored-by: Martin Auswöger <martin@auswoeger.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant