Bug #82249

Cache problems on flexform when using "Content from pid" feature

Added by José Ricardo about 3 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2017-08-30
Due date:
% Done:

100%

TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Hi,

On TYPO 8.7.4, i have a page X which renders the content of another page Y (field content_from_pid).
On page Y i have a content with a flexform and two fields (text and image), as shown below.

When I edit this content on TYPO3, the page X shows the image changed but the text unchanged.
Page Y shows both changed.
Using ?no_cache=1 on X shows both changed.

So, it looks like TYPO3 is making cache of the flexform, but only in the page X.
The image changes on frontend because it is retrieved from the database (as the flexform contains only the number '1' and not the image or reference uids).

I get the image using these lines of code:

$fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$image = $fileRepository->findByRelation('tt_content', 'featured_image', $contentUid);

Here's the flexform i'm using.

<sFEATUREDNEWS>
    <ROOT>
        <TCEforms>
            <sheetTitle>Featured News</sheetTitle>
        </TCEforms>
        <type>array</type>
        <el>
            <title>
                <TCEforms>
                    <label>Title</label>
                    <config>
                        <type>input</type>
                        <size>48</size>
                        <eval>trim</eval>
                    </config>
                </TCEforms>
            </title>
            <featured_image>
                <TCEforms>
                    <label>Image</label>
                    <config>
                        <type>inline</type>
                        <appearance type="array">
                            <enabledControls type="array">
                                <delete>1</delete>
                                <dragdrop>1</dragdrop>
                                <hide>1</hide>
                                <info>1</info>
                                <localize>1</localize>
                            </enabledControls>
                            <headerThumbnail type="array">
                                <field>uid_local</field>
                                <height>45c</height>
                                <width>45</width>
                            </headerThumbnail>
                            <useSortable>1</useSortable>
                        </appearance>
                        <behaviour type="array">
                            <localizationMode>select</localizationMode>
                            <localizeChildrenAtParentLocalization>1</localizeChildrenAtParentLocalization>
                        </behaviour>
                        <filter type="array">

                        </filter>
                         <foreign_types type="array">
                            <numIndex index="2" type="array">
                                <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
                            </numIndex>
                        </foreign_types>
                        <foreign_table>sys_file_reference</foreign_table>
                        <foreign_sortby>sorting_foreign</foreign_sortby>
                        <foreign_table_field>tablenames</foreign_table_field>
                        <foreign_field>uid_foreign</foreign_field>
                        <foreign_label>uid_local</foreign_label>
                        <foreign_match_fields type="array">
                            <fieldname>featured_image</fieldname>
                        </foreign_match_fields>
                        <foreign_selector>uid_local</foreign_selector>
                        <foreign_selector_fieldTcaOverride type="array">
                            <config type="array">
                                <appearance type="array">
                                    <elementBrowserAllowed>gif,jpg,jpeg,png</elementBrowserAllowed>
                                    <elementBrowserType>file</elementBrowserType>
                                </appearance>
                            </config>
                        </foreign_selector_fieldTcaOverride>
                        <maxitems>1</maxitems>
                        <minitems>0</minitems>
                    </config>
                </TCEforms>
            </featured_image>            
        </el>
    </ROOT>
</sFEATUREDNEWS>

Cheers

82249-content-from-pid-typo3-9.diff View (992 Bytes) Olaf Schmidt-Wischhöfer, 2019-10-24 16:06

82249-content-from-pid-typo3-8.diff View (817 Bytes) Olaf Schmidt-Wischhöfer, 2019-10-24 16:06

82249-content-from-pid-master.diff View (935 Bytes) Olaf Schmidt-Wischhöfer, 2019-10-24 16:06


Related issues

Related to TYPO3 Core - Bug #59411: Forward: Clear cache for pages content_from_pid New 2014-06-08
Related to TYPO3 Core - Bug #18534: The cache of pages which include content from another one is not emptied automatically when source content is edited Closed 2008-04-01
Related to TYPO3 Core - Bug #18534: The cache of pages which include content from another one is not emptied automatically when source content is edited Closed 2008-04-01

Associated revisions

Revision 2758aa4f (diff)
Added by Benni Mack 8 months ago

[BUGFIX] Respect content_from_pid in page cache

When using "content_from_pid" and the content from a different
pid is changing, the cache of the frontend page should be affected as well.

Resolves: #82249
Releases: master, 9.5
Change-Id: If62c01e1844e1369fab49db483600c9a6d907099
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63531
Tested-by: TYPO3com <>
Tested-by: Oliver Bartsch <>
Tested-by: Georg Ringer <>
Reviewed-by: Oliver Bartsch <>
Reviewed-by: Georg Ringer <>

Revision 410c35f9 (diff)
Added by Georg Ringer 8 months ago

[BUGFIX] Respect content_from_pid in page cache

When using "content_from_pid" and the content from a different
pid is changing, the cache of the frontend page should be affected as well.

Resolves: #82249
Releases: master, 9.5
Change-Id: If62c01e1844e1369fab49db483600c9a6d907099
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63536
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Olaf Schmidt-Wischhöfer 12 months ago

I have attached patches that fix this issue for various branches.

#2 Updated by Olaf Schmidt-Wischhöfer 12 months ago

  • Related to Bug #59411: Forward: Clear cache for pages content_from_pid added

#3 Updated by Olaf Schmidt-Wischhöfer 12 months ago

  • Related to Bug #18534: The cache of pages which include content from another one is not emptied automatically when source content is edited added

#4 Updated by Olaf Schmidt-Wischhöfer 12 months ago

  • Complexity set to easy

#5 Updated by Gerrit Code Review 8 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63531

#6 Updated by Benni Mack 8 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Gerrit Code Review 8 months ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63536

#8 Updated by Georg Ringer 8 months ago

  • Status changed from Under Review to Resolved

#9 Updated by Benni Mack 7 months ago

  • Related to Bug #18534: The cache of pages which include content from another one is not emptied automatically when source content is edited added

#10 Updated by Benni Mack 7 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF