Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-24154

Overriding template with section_identifier fails when cached

    Details

      Description

      If a template is declared to override using the match by section_identifier, and the view cache is enabled, the cached versions will fall back to default templates and ignore the overrides.

      test case:
      1 - setting up the environment

      • enable debug and list templates options in admin
      • create a section called "test" (name and identifier)
      • create a folder X, set the section to "test"
      • assign anonymous user permissions to read section "test"
      • open X in frontend
      • check the full path of the "pagelayout.tpl" used, to override it. it will depend on the extension used to generate the frontend (ezflow, ezdemo, etc)

      2 - making the override

      • edit the "pagelayout.tpl" file with some change, save it at the path <extension>/overrides/templates/modified_pagelayout.tpl
      • add to the default frontend siteaccess settings/override.ini.append.php:

          [pagelayout_section_test]
          Source=pagelayout.tpl
          MatchFile=modified_pagelayout.tpl
          Subdir=templates
          Match[section_identifier]=test
        

      • clear all caches
      • open X in frontend. the modified_pagelayout.tpl is used, at bottom of debug it can be checked the correct usage.
      • reload the page, view falls back to default template. the debug at bottom shows that none of the templates are overriden.

        Activity

        Hide
        Rui Silva (Inactive) added a comment -

        Tested and approved by QA

        Show
        Rui Silva (Inactive) added a comment - Tested and approved by QA
        Show
        André Rømcke added a comment - Merged: https://github.com/ezsystems/ezpublish-legacy/commit/3882dd3dc8614f3a14aae553c561c54d384376c7
        Hide
        André Rømcke added a comment -

        > So i suppose the section_identifier is not set for the cached result as cache key.

        Yes this is what I'm about to fix (and backport):
        https://github.com/ezsystems/ezpublish-legacy/pull/1151

        Thanks for all the feedback and testing, feel free to try out the patch in the pull request and comment on that there.

        Show
        André Rømcke added a comment - > So i suppose the section_identifier is not set for the cached result as cache key. Yes this is what I'm about to fix (and backport): https://github.com/ezsystems/ezpublish-legacy/pull/1151 Thanks for all the feedback and testing, feel free to try out the patch in the pull request and comment on that there.
        Hide
        Artur Wawrzynkiewicz added a comment -

        This works with and w/o cache:

        [pagelayout_section_test]
        Source=pagelayout.tpl
        MatchFile=pagelayout_section_test.tpl
        Subdir=templates
        Match[section]=7

        This does not work with enabled cache, but works w/o cache:

        [pagelayout_section_test]
        Source=pagelayout.tpl
        MatchFile=pagelayout_section_test.tpl
        Subdir=templates
        Match[section_identifier]=test

        So i suppose the section_identifier is not set for the cached result as cache key.

        Show
        Artur Wawrzynkiewicz added a comment - This works with and w/o cache: [pagelayout_section_test] Source=pagelayout.tpl MatchFile=pagelayout_section_test.tpl Subdir=templates Match [section] =7 This does not work with enabled cache, but works w/o cache: [pagelayout_section_test] Source=pagelayout.tpl MatchFile=pagelayout_section_test.tpl Subdir=templates Match [section_identifier] =test So i suppose the section_identifier is not set for the cached result as cache key.
        Hide
        André Rømcke added a comment - - edited

        Ok,

        so does that also mean pagelayout override works (cached, cached on page refresh, and uncached) with the following?

          [pagelayout_section_test]
          Source=pagelayout.tpl
          MatchFile=modified_pagelayout.tpl
          Subdir=templates
          Match[section]=7
        

        If so I'll focus on the existing section_identifier PR, otherwise I'll look into where the override keys might get reset or something.

        Show
        André Rømcke added a comment - - edited Ok, so does that also mean pagelayout override works (cached, cached on page refresh, and uncached) with the following? [pagelayout_section_test] Source=pagelayout.tpl MatchFile=modified_pagelayout.tpl Subdir=templates Match[section]=7 If so I'll focus on the existing section_identifier PR, otherwise I'll look into where the override keys might get reset or something.

          People

          • Assignee:
            Unassigned
            Reporter:
            Paulo Bras (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: