eZ Platform Discussions

2.4 -> 2.5.6 content cache not regenerated automatically

I upgraded a site from 2.4 -> 2.5.6 LTS but the content cache is not invalidated after publishing of content. To see the changes on the sight i have to manually clear the cache… :confused:

The ezplatform.yml:

# Siteaccess configuration, with one siteaccess per default
siteaccess:
    list: [de, en, admin]
    groups:
        site_group: [de, en]

        # WARNING: Do not remove or rename this group.
        # It's used to distinguish common siteaccesses from admin ones.
        # In case of multisite with multiple admin panels, remember to add any additional admin siteaccess to this group.
        admin_group: [admin]
    default_siteaccess: de
    match:
        Map\URI:
            admin: admin
        Map\Host:
            '%site_domain_dot_de%': de
            '%site_domain_dot_com%': en
        URIElement: 1

# System settings, read in following order: `default`, <siteaccess-group>, <siteacces>, and `global`
# TIP: For multisite installations organize shared config into SiteAccess groups,
#      on single-site you can place shared config under "default" for simplicity as shown below.
system:
    site_group:
        content:
            # As we by default enable EzSystemsPlatformHttpCacheBundle which is designed to expire all affected cache
            # on changes, and as error / redirects now have separate ttl, we easier allow ttl to be greatly increased
            view_cache: true      # Activates HTTP cache for content
            ttl_cache: true       # Activates expiration based HTTP cache for content (very fast)
            default_ttl: 60

            tree_root:
                # This feature is a reimplementation of the PathPrefix one that existed in eZ Publish Legacy.
                location_id: 54
                # Every URL aliases starting with those prefixes will be considered
                # being outside of the subtree starting at root_location.
                # Default value is an empty array.
                # Prefixes are not case sensitive.
                excluded_uri_prefixes: [ /media, /images ]

I assume this is due to our cache settings, but the above is as they were in the 2.4 installation. Did anything change?

Hi John,

Just checking a few common items:

Hi Janit,

Thanks for the reply.

I started via the composer merge but then opted to just start a new project, copy over the rel. view and controller files, update the ezplatform.yml, config and routing.

After this step, I injected all the additional packages then ran the required sql updates to get me to 2.5.6, The composer json after the updated now look like:

{
    "name": "ezsystems/ezplatform",
    "description": "eZ Platform distribution",
    "homepage": "https://github.com/ezsystems/ezplatform",
    "license": "GPL-2.0-only",
    "type": "project",
    "authors": [
        {
            "name": "eZ dev-team & eZ Community",
            "homepage": "https://github.com/ezsystems/ezplatform/contributors"
        }
    ],
    "replace": {
        "ezsystems/ezpublish-community": "*"
    },
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle/"
        },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },
    "autoload-dev": {
        "psr-4": { "Tests\\": "tests/" },
        "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
    },
    "require": {
        "php": "^7.1.3",
        "doctrine/doctrine-bundle": "^1.9.1",
        "doctrine/orm": "^2.6.3",
        "ezsystems/doctrine-dbal-schema": "~0.1.2",
        "ezsystems/ez-support-tools": "~1.0.4",
        "ezsystems/ezplatform-admin-ui": "~1.5.7",
        "ezsystems/ezplatform-admin-ui-assets": "~4.2.0",
        "ezsystems/ezplatform-admin-ui-modules": "~1.5.5",
        "ezsystems/ezplatform-core": "~1.0.3",
        "ezsystems/ezplatform-cron": "~2.0.0",
        "ezsystems/ezplatform-design-engine": "~2.0.0",
        "ezsystems/ezplatform-graphql": "~1.0.3",
        "ezsystems/ezplatform-http-cache": "~0.9.1",
        "ezsystems/ezplatform-matrix-fieldtype": "~1.0.2",
        "ezsystems/ezplatform-richtext": "~1.1.4",
        "ezsystems/ezplatform-solr-search-engine": "~1.7.1",
        "ezsystems/ezplatform-standard-design": "~0.2.1",
        "ezsystems/ezplatform-user": "~1.0.4",
        "ezsystems/ezpublish-kernel": "~7.5.5",
        "ezsystems/repository-forms": "~2.5.4",
        "ezsystems/symfony-tools": "~1.0.3",
        "friendsofsymfony/jsrouting-bundle": "^1.6.3",
        "incenteev/composer-parameter-handler": "^2.1.3",
        "knplabs/knp-menu-bundle": "^2.2.1",
        "overblog/graphql-bundle": "^0.11.11",
        "scssphp/scssphp": "~1.0",
        "sensio/distribution-bundle": "^5.0.23",
        "sensiolabs/security-checker": "^5.0",
        "symfony/assetic-bundle": "^2.8.2",
        "symfony/monolog-bundle": "3.1.2",
        "symfony/swiftmailer-bundle": "^3.2.4",
        "symfony/symfony": "^3.4.18",
        "symfony/thanks": "^1.1.0",
        "symfony/webpack-encore-bundle": "^1.0.0",
        "twig/extensions": "^1.5.3",
        "twig/twig": "^2.5",
        "white-october/pagerfanta-bundle": "^1.2.2",
        "willdurand/js-translation-bundle": "^2.6.6",

        "lolautruche/ez-core-extra-bundle": "^2.2.2",
        "kaliop/ezmigrationbundle": "dev-master",
        "netgen/tagsbundle": "^3.3.3",
        "novactive/ezseobundle": "^4.1.3",
        "suncat/mobile-detect-bundle": "^1.1.1"
    },
    "require-dev": {
        "behat/behat": "^3.5.0",
        "behat/mink-extension": "^2.3.1",
        "behat/mink-goutte-driver": "^1.2.1",
        "behat/mink-selenium2-driver": "^1.3.1",
        "behat/symfony2-extension": "^2.1.5",
        "bex/behat-screenshot": "^1.2.7",
        "ezsystems/behat-screenshot-image-driver-cloudinary": "~1.1.1",
        "ezsystems/behatbundle": "~7.0.1",
        "overblog/graphiql-bundle": "^0.1.2",
        "phpunit/phpunit": "^6.5.13",
        "sensio/generator-bundle": "^3.1.7",
        "symfony/phpunit-bridge": "^3.4.18",
        "liuggio/fastest": "^1.6"
    },
    "conflict": {
        "symfony/symfony": "3.4.9||3.4.12||3.4.16",
        "doctrine/dbal": "2.7.0",
        "twig/twig": "2.6.1",
        "symfony/webpack-encore-bundle": "1.2.0||1.2.1"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "eZ\\Bundle\\EzPublishCoreBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "@php bin/console bazinga:js-translation:dump web/assets --merge-domains",
            "@php bin/console assetic:dump",
            "yarn install",
            "EzSystems\\EzPlatformEncoreBundle\\Composer\\ScriptHandler::compileAssets",
            "@php bin/security-checker security:check"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ],
        "post-create-project-cmd": [
            "eZ\\Bundle\\EzPublishCoreBundle\\Composer\\ScriptHandler::installWelcomeText"
        ],
        "ezplatform-install": [
            "@php bin/console ezplatform:install clean"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "sort-packages": true,
        "preferred-install": {
            "ezsystems/*": "dist"
        }
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "keep-outdated": true,
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.5.x-dev"
        }
    }
}

In this app it is a fairly simple installation, a few custom controllers to fetch children objects, a straight forward blog, a contact form… nothing out of the ordinary.

The full ezplatform.yml with the admin section modifications from the upgrade now looks like:

imports:
    - { resource: nova_ezseo.yml }

# services, this replaces the services yml from symfony
services:
    app.twig_extension:
        class: AppBundle\Twig\AppExtension
        tags:
            - { name: twig.extension }
        arguments:
            - '@ezpublish.api.repository'
            - '@ezpublish.translation_helper'
    app.pre_content_view_listener:
        class: AppBundle\EventListener\PreContentViewListener
        tags:
            - {name: kernel.event_listener, event: ezpublish.pre_content_view, method: onPreContentView}
        arguments:
            - '@ezpublish.api.repository'
            - '@ezpublish.templating.global_helper'
            - '@request_stack'
    app.content_types:
        class: AppBundle\Service\ContentTypes
        arguments:
            - '@ezpublish.api.inner_repository'
            - '@ezpublish.api.service.content_type'

ezpublish:
    # HttpCache settings, By default 'local' (Symfony HttpCache Proxy), by setting it to 'http' you can point it to Varnish
    http_cache:
        purge_type: '%purge_type%'

    # Repositories configuration, setup default repository to support solr if enabled
    repositories:
        default:
            storage: ~
            search:
                engine: '%search_engine%'
                connection: default
            fields_groups:
                list: [content, settings, features, metadata, seo]
                default: content

    # Siteaccess configuration, with one siteaccess per default
    siteaccess:
        list: [de, en, admin]
        groups:
            site_group: [de, en]

            # WARNING: Do not remove or rename this group.
            # It's used to distinguish common siteaccesses from admin ones.
            # In case of multisite with multiple admin panels, remember to add any additional admin siteaccess to this group.
            admin_group: [admin]
        default_siteaccess: de
        match:
            Map\URI:
                admin: admin
            Map\Host:
                '%site_domain_dot_de%': de
                '%site_domain_dot_com%': en
            URIElement: 1

    # System settings, read in following order: `default`, <siteaccess-group>, <siteacces>, and `global`
    # TIP: For multisite installations organize shared config into SiteAccess groups,
    #      on single-site you can place shared config under "default" for simplicity as shown below.
    system:
        site_group:
            content:
                # As we by default enable EzSystemsPlatformHttpCacheBundle which is designed to expire all affected cache
                # on changes, and as error / redirects now have separate ttl, we easier allow ttl to be greatly increased
                view_cache: true      # Activates HTTP cache for content
                ttl_cache: true       # Activates expiration based HTTP cache for content (very fast)
                default_ttl: 60

                tree_root:
                    # This feature is a reimplementation of the PathPrefix one that existed in eZ Publish Legacy.
                    location_id: 54
                    # Every URL aliases starting with those prefixes will be considered
                    # being outside of the subtree starting at root_location.
                    # Default value is an empty array.
                    # Prefixes are not case sensitive.
                    excluded_uri_prefixes: [ /media, /images ]
            api_keys: { google_maps: "AIzaSyAQxS8BllcoYZwzrtBbwc8jk_qz2kTZYpo" }
            # Cache pool service, needs to be different per repository (database) on multi repository install.
            cache_service_name: '%cache_pool%'
            # These reflect the current installers, complete installation before you change them. For changing var_dir
            # it is recommended to install clean, then change setting before you start adding binary content, otherwise you'll
            # need to manually modify your database data to reflect this to avoid exceptions.
            var_dir: var/site
            # System languages. Note that by default, content, content types, and other data are in eng-GB locale,
            # so removing eng-GB from this list may lead to errors or content not being shown, unless you change
            # all eng-GB data to other locales first.
            image_variations:
                full_size:
                    reference: null
                    filters:
                        - { name: geometry/scalewidthdownonly, params: [1500] }
                social_share_facebook:
                    reference: null #social_share_fb
                    filters:
                        - { name: geometry/scaledownonly, params: [500, 300] }
                article_prev_mobile:
                    reference: null
                    filters:
                        - { name: geometry/scalewidth, params: [737]}
                article_prev_desk:
                    reference: null
                    filters:
                        - { name: geometry/scaleheight, params: [220]}
                blog_prev_desk:
                    reference: null
                    filters:
                        - { name: geometry/scaleheight, params: [350]}
                article_keyvis_mobile:
                    reference: null
                    filters:
                        - { name: geometry/scalewidth, params: [768]}
            content_view:
                full:
                    root_folder:
                        template: "full/home_page.html.twig"
                        match:
                            Identifier\ContentType: "home_page"
                    article_container:
                        controller: "AppBundle:ArticleContainer:articleContainerChildren"
                        match:
                            Identifier\ContentType: "article_container"
                    article:
                        template: "full/article.html.twig"
                        match:
                            Identifier\ContentType: "article"
                    job:
                        template: "full/job.html.twig"
                        match:
                            Identifier\ContentType: "job"
                    simple_page:
                        template: "full/simple_page.html.twig"
                        match:
                            Identifier\ContentType: "simple_page"
                    people_container:
                        controller: "AppBundle:PeopleContainer:containerChildren"
                        template: "full/people_container.html.twig"
                        match:
                            Identifier\ContentType: "people_container"
                    blog_container:
                        controller: "AppBundle:BlogContainer:blogContainerChildren"
                        template: "full/blog_container.html.twig"
                        match:
                            Identifier\ContentType: "blog_container"
                    blog_article:
                        template: "full/blog_article.html.twig"
                        match:
                            Identifier\ContentType: "blog_article"
                embed:
                    module:
                        template: "embed/module.html.twig"
                        match:
                            Identifier\ContentType: "module"
                    quote:
                        template: "embed/quote.html.twig"
                        match:
                            Identifier\ContentType: "quote"
                    article:
                        template: "embed/article.html.twig"
                        match:
                            Identifier\ContentType: "article"
                    article_container:
                        template: "embed/article_container.html.twig"
                        match:
                            Identifier\ContentType: "article_container"
                    blog_container:
                        template: "embed/blog_container.html.twig"
                        match:
                            Identifier\ContentType: "blog_container"
                    job_application_form:
                        template: 'embed/job_application_form.html.twig'
                        match:
                            Identifier\ContentType: "job_application_form"
                line:
                    article:
                        template: "line/article.html.twig"
                        match:
                            Identifier\ContentType: "article"
                    job:
                        template: "line/job.html.twig"
                        match:
                            Identifier\ContentType: "job"
                    blog_article:
                        template: "line/blog_article.html.twig"
                        match:
                            Identifier\ContentType: "blog_article"
            # HttpCache purge server(s) setting, eg Varnish, for when ezpublish.http_cache.purge_type is set to 'http'.
            http_cache:
                purge_servers: ['%purge_server%']
            user:
                layout: pagelayout.html.twig
        de:
            languages: [ger-DE, eng-GB]
        en:
            languages: [eng-GB]

        admin_group:
            # System languages. Note that by default, content, content types, and other data are in eng-GB locale,
            # so removing eng-GB from this list may lead to errors or content not being shown, unless you change
            # all eng-GB data to other locales first.
            # For admin this needs to contain all languages you want to translate content to on the given repository.
            languages: [eng-GB]
            var_dir: var/site
            content_tree_module:
                contextual_tree_root_location_ids:
                    - 2 # Home (Content structure)
                    - 5 # Users
                    - 43 # Media
                    - 48 # Setup
            subtree_paths:
                content: /1/2/
                media: /1/43/

    url_alias:
        slug_converter:
            transformation: 'urlalias_lowercase'

ez_platform_standard_design:
    # makes Kernel default templates (in EzPublishCoreBundle/Resources/views) part of standard Design
    override_kernel_templates: false

liip_imagine:
    filter_sets:

        # the name of the "filter set"
        social_share_fb:

            # adjust the image quality to 75%
            quality: 75

            # list of transformations to apply (the "filters")
            filters:

                # create a thumbnail: set size to 120x90 and use the "outbound" mode
                # to crop the image when the size ratio of the input differs
                thumbnail:
                    size: [120, 90]
                    mode: outbound  # crop the input image, if required

                # create a 2px black border: center the thumbnail on a black background
                # 4px larger to create a 2px border around the final image
                # background: { size: [124, 94], position: center, color: '#000000' }

Everything now works nicely, except this caching issue.