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
Integrity check for templates and more #21
Comments
I'm actually not sure if this is the right way to go. Don't we want those errors to occur so the webmaster notices it? Otherwise it would just fail silently. |
There is a similar situation with the Imho that's fine though, since updating your page layout and template files yourself is part of the regular, upgrade process. The same is still true for those article templates, however it's far easier to just edit and save page layouts. With the article templates you'd have to go through each article manually (if you are not very tech savvy and don't fix it directly in the database with one query 😉). |
May be instead of trying to fix stuff like that for the user, we could introduce some sort of analyzer to help users migrating such things? In case of an upgrade it could analyze and show the user, what he has to do manually. e.g. it could detect whether a page layout still has old core templates selected, that don't exist anymore, same for the article template selection. |
Sidenote: There's some inconsistency how missing elements are handled. Missing templates throw an exception, missing modules / content elements only add an error message. Would be nice if both cases are handled equally. |
As discussed in Mumble on August 30th, we do not want to migrate the templates, because there are too many edge cases in which this can cause problems.
This is a good idea. Can we add this to the Contao check? Or a separate tool? We have to be able to run the tool before we actually update the installation. |
@ausi suggested to add checks in the |
My suggestion would also be to add those checks to |
It would be nice if this appears in a separate fieldset/legend and covers not just "old" templates but checks for existence of any manually assigned template. |
Fixed in 9fe6884. |
@asaage This seems way out of scope for the install tool, don't you think? |
I would also add the |
OK It probably is way out of scope for the install tool... |
@fritzmg These templates are adjusted automatically.
It is most likely not easier but it makes a lot more sense. Frankly, I am thinking about reverting 9fe6884, because the note will only be shown once during the version 4.0.0 update and I don't know if it is helpful at this time. A generic solution would allow to retrieve the information at any time. And it could be enhanced with more integrity checks. @contao/developers /cc |
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
Issue by @fritzmg
August 17th, 2018, 12:05 GMT
In Contao 3 you were able to select a variety of custom template for articles, including
mod_article_plain
andmod_article_teaser
which were removed in Contao 4.However, this will lead to an
error after upgrading to Contao 4 if these template were previously set as a
customTpl
manually (for whatever reason) and no such template is present as a custom template.Thus may be
Version400Update
should check whether or not a custom template with these names are present and if not,tl_module.customTpl
should be emptied for these records.The text was updated successfully, but these errors were encountered: