Bug #22273
closedPageRenderer does not work for USER_INT plugins
100%
Description
From the mailinglist (thread on typo3.dev called "PageRender and USER_INT Plugins")
"it looks like the pageRenderer actually renders all the page content before the USER_INT plugins are substituted in the cached output. When this substitution occurs, it seems to only support the old TSFE->additionalHeaderData and not the pageRenderer."
To reproduce
With felogin (or any other USER_INT plugin):
- Added "$GLOBALS['TSFE']->getPageRenderer()->addCssFile('fileadmin/html/123.css');" to the main function --> does not get included
- Changed plugin to USER instead of USER_INT --> file gets included
- Changed back --> gets not included
(issue imported from #M13808)
Files
Updated by Ingo Renner over 14 years ago
increased priority, I take the amount of people monitoring this issue as a sign of interest in getting this issue fixed...
Updated by Ingo Renner over 14 years ago
Hey Steffen,
a lot of people seem interested in this issue, could you take a look at it please?
Updated by Steffen Kamper almost 14 years ago
- Target version deleted (
0)
I look into this amd try to find a solution. It's not really a pageRenderer issue but the logic behind substitution in USER_INT. Now i'm aware of this problem again ;)
Updated by Tobias Hochgürtel almost 14 years ago
Steffen Kamper wrote:
I look into this amd try to find a solution. It's not really a pageRenderer issue but the logic behind substitution in USER_INT. Now i'm aware of this problem again ;)
I have fixed this issue. Should I attach here an patch, when I have complete done?
Updated by Clemens Riccabona over 13 years ago
Tobias, I would personally appreciate to have a patch, or at least some hints how to fix, as I need this really!
thxal in adv, clemens
Updated by Steffen Gebert over 13 years ago
Tobias? Could you please provide the patch?
Thanks for your contribution!
Steffen
Updated by Tobias Hochgürtel over 13 years ago
hey sorry for my late! I will answer later with Patch. Have to done an task now/currently.
Updated by Tobias Hochgürtel over 13 years ago
- File 22273.tar.gz 22273.tar.gz added
Here is my Fix/patch. I hope this is complete. The Used TYPO3 Version is: TYPO3_4.5 when I'm right. If you extract the Archive, you will find 3 folders,
- hackes | The Modified Files, which I have changed.
- hackes_with_debug | The Modiefied Files, which I have changed, with debuging Code inside, should not be used.
- orginales | The Orginal files, which I haven't modified.
All Directories have the folder structure from the typo3 root dir, with only the needed Directories with the changed/patches files.
I hope it will help! If there is an Problem write, I could help to get this into the official TYPO3 tree.
Updated by Chris topher over 13 years ago
- Status changed from New to Needs Feedback
Hi Tobias,
thanks for your work!
Can you please provide your changes as a diff file?
You can create such a file by using the tool "diff" on the folders "hackes" and "originales".
Use the parameter "-u" like "diff -u ..." to get the resulting diff file in unified format.
Updated by Tobias Hochgürtel over 13 years ago
- File 22273.patch 22273.patch added
okay, I think I have it?
Updated by Chris topher over 13 years ago
Yes, basically looks good. A quick formal review:
- General
- indentation always with tabs
- class.tslib_fe.php
- I think the patch - at least class.tslib_fe.php - is in the wrong direction (your new lines are displayed as "to be removed" and vice versa).
- Only that one hunk around lines 3199 with your changes should be there. The rest not.
- Shorten the comment. One or two lines above your new lines are enough.
- class.t3lib_pagerenderer.php
- Did you use the same code as a base for both file versions? I am asking because of the many changes, new functions and so on. It would be ideal if you took the most current version from the branch you are working with from http://git.typo3.org/TYPO3v4/Core.git (look for "heads" at bottom of page).
- remove debug() code.
- do not comment unused code, but remove it completely.
- do not add "@author" tags and "@see forge.typo3...".
Updated by Tobias Hochgürtel over 13 years ago
okay, thanks for the advice. I will try to consider them in the future, but don't hesitate to give me more advices.
I will check the patch/code for adding an clean Version of it.
I have use the same base version of the file. Without looking into the file now, I would say that the many new functions are from me. I have packed some Code into few small function's to get it working correctly and reducing doubled code.
Not used the git version yet of typo3. Shorting comments is possible.(question of taste). If I find time, I will implement the patch for the git-Version.
Indentation, that's an terrible thing. In one Project they use tabs and in an other they use spaces. I use normally 4 Spaces for intending.
Updated by Gerrit Code Review about 13 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review about 13 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Kim Lang over 12 years ago
i missed the "jsFooterFiles" in this patch.
perhaps was this a solution:
$this->content = str_replace('</body>', $additionalHeaderDataForUserIntPlugin['jsFooterFiles'] . $additionalHeaderDataForUserIntPlugin['jsFooterInline'] . '</body>', $this->content);
Updated by Markus Klein over 12 years ago
What do you mean with "I missed"?
If you have a comment to the code, please post it directly in gerrit.
Updated by Kim Lang over 12 years ago
- File 0001-include-jsFooterFiles-and-jsFooterInline-Javascript-.patch 0001-include-jsFooterFiles-and-jsFooterInline-Javascript-.patch added
Markus Klein wrote:
What do you mean with "I missed"?
If you have a comment to the code, please post it directly in gerrit.
I dont know how to do this.
a make a patch.
can you post it for me?
Updated by Simon Schaufelberger over 12 years ago
I dont know how to do this.
learn how to do it: http://wiki.typo3.org/Contribution_Walkthrough_with_CommandLine ;)
- do a checkout with the url in gerrit
- make your changes
- add them
- git commit --amend
- push them
Updated by Gerrit Code Review over 12 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Kim Lang over 12 years ago
I make an Update of the patch from "Dominique Feyer" that includes a Fix for TS Option "config.moveJsFromHeaderToFooter".
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Helmut Hummel over 12 years ago
Just for the records, here is how the rendering of *_INT works respecting the additionalHeaderData and additionalFooterData:
First Hit (or uncachable page):¶
- render page cObjects (
tslib_pagegen::renderContent
) - add placeholders for uncached objects during this rendering (
tslib_content_*Internal
) - Store additionalHeaderData and additionalFooterData in cached config (
tslib_pagegen::renderContentWithHeader
starting fromif (is_array($GLOBALS['TSFE']->config['INTincScript'])) {
) - Replace additionalHeaderData and additionalFooterData data array with placeholders (
$GLOBALS['TSFE']->additionalHeaderData = array ('<!--HD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->'); // Clearing the array
) - render the page with all placeholders (
tslib_pagegen::renderContentWithHeader
) - cache HTML page + config (
$TSFE->generatePage_postProcessing();
) - restore additionalHeaderData and additionalFooterData from config (
$TSFE->INTincScript();
) - replace placeholders of uncached objects (
$TSFE->INTincScript();
) - replace additionalHeaderData and additionalFooterData placeholders (
$TSFE->INTincScript();
)
Cache Hit:¶
- get placehoder HTML + config from cache (
$TSFE->getFromCache();
) - restore additionalHeaderData and additionalFooterData from config (
$TSFE->INTincScript();
) - replace placeholders of uncached objects (
$TSFE->INTincScript();
) - replace additionalHeaderData and additionalFooterData placeholders (
$TSFE->INTincScript();
)
As you can see, the last 3 steps are always the same. To get this working with the pageRenderer, we need to store the current state of it at step 3. of the uncached rendering and restore this state before the uncached objects are executed. This needs to be done to avoid double inclusion of assets with the pageRenderer which is easy with additionalHeaderData and additionalFooterData if unique keys for the arrays are used.
Hope this makes it a bit clearer and serves as a reference for future changes in this area.
Updated by Gerrit Code Review over 12 years ago
Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 10 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 11 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Gerrit Code Review over 12 years ago
Patch set 12 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7465
Updated by Helmut Hummel over 12 years ago
- Status changed from Under Review to Resolved
Applied in changeset 41f215f0d100bfe63b92b566f55b1a173776d80f.
Updated by Dominic Garms over 12 years ago
Hello, great that this issue is finally fixed! will it be backported into the versions 4.5, 4.6, 4.7? Some extensions requires the pageRenderer (fed, dmf_galleria ...) and would love to see this fix for the 4.x branch. Cheers Dominic
Updated by Kay Strobach about 12 years ago
Hello Dominnic,
as i would interpret that as a bug, please just cherrypick the current fix and port it to 4.5, 4.6 and 4.7 as seperate changerequest :D
I hope it will than be included in the next release - i stumbled upon that bug during the development of my dynamic css extension as well.
Especially stuff from ts (get files and replace them (*.less -> *.css) hasn't worked well with enabled caching :(
Regards
Kay
Updated by Helmut Hummel about 12 years ago
Hi,
Kay Strobach wrote:
as i would interpret that as a bug, please just cherrypick the current fix and port it to 4.5, 4.6 and 4.7 as seperate changerequest :D
I would also consider this a bug, but the fix was rather complicated and included a lot of prior refactoring of the pageRenderer.
This change will not go into released branches, sorry.