DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: BE Clear cache cmd helper

Author:Michiel Roos
Created:2010-05-14T16:28:24
Changed by:Michiel Roos
Changed:2010-05-18T23:00:38
Email:extensions@netcreators.com
Info 2:
Info 3:
Info 4:

EXT: BE Clear cache cmd helper

Extension Key: nc_clearcachecmdhelper

Copyright 2009-2010, Michiel Roos <extensions@netcreators.com>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: BE Clear cache cmd helper 1

Introduction 3

What does it do? 3

An extension that makes configuring the TCEMAIN clear cache settings less hard. 3

Screenshots 4

Page properties 4

General usage 5

Administration 6

Installation 6

Tutorial 7

Turning tt_news into a USER extension 7

Sending proper cache headers 7

Automating the clearing of the cache 7

Instructing editors to update the list 8

Known problems 9

TODO 10

Changelog 11

Introduction

What does it do?

An extension that makes configuring the TCEMAIN clear cache settings less hard.

Before using this extension please familiarize yourself with http://typo3.org/documentation/document-library/core- documentation/doc_core_tsconfig/current/

“This document deals with the options you can set for “Page TSconfig” and “User TSconfig”. Notice that because TypoScript is a 'declarational' language (that is, it's mere "configuration") it does not in itself carry out a sequence of actions. The reason why the TypoScript Templates used for the frontend seem to work a like this is because those values are interpreted into PHP function calls which constructs a page. In the case where TypoScript is used for configuration like here it's clearly more like the Registration Database in Windows: The values configure how the application works.”For the sake of speed you can make certain extensions USER instead of USER_INT. This will make sure the page that holds the plugin will be cached by TYPO3. When an editor adds a new record to be shown by the plugin, the cache for all pages with that plugin must be cleared to see any change.

The TCEMAIN clear cache commands can be set in the page properties of the sysfolder holding the records. Some people find the settings hard to remember / manage.

This extension hopes to make this a bit easier.

Screenshots

Everybody loves screenshots.

Page properties

img-1 Illustration 1: Clear cache configuration

img-2 Illustration 2: Resulting page TSConfig

General usage

  • Add a new clear cache ruleset to page properties
  • Save the page

Administration

Installation

Install the extension using the extension manager.

Tutorial

tt_news is USER_INT by default. Many sites use tt_news to display news on the front page of a site. The front page should always be fully cacheable because it will probably get the most hits of all the pages.

Turning tt_news into a USER extension

The tt_news extension can be turned into a USER extension by changing the TypoScript of your news template as follows:

plugin.tt_news = USER
plugin.tt_news {
        # your configuration
}

Sending proper cache headers

The page on which you display your news will probably send cache headers to the visitors browsers. Those browsers will cache the page for the amount of time specified in page properties of a page. The default period is 12 hours.

I advise you to change this to a period that better fits with the frequency of your news releases.

img-3 Illustration 3: Part of the page properties of 'Thuis'

Automating the clearing of the cache

Clients expect the newly created news articles to show up on the home page right after they created them. This will not work with a USER extension. Once USER plugin content is cached, it will not be refreshed with information from newly created plugin records unless the cache for the page is cleared.

This is not what users expect. It is hard for users to remember to clear the cache for all pages on which the news plugin is present after creating a new news article.

Even if they do remember, it's too much work.

TYPO3 can help here by placing the following snippet of page TSConfig on the folder in which the editors create their news articles:

TCEMAIN.clearCacheCmd = 1

This means that when the contents of this folder change (add, remove, hide, change, etc.) the page cache for the page with id 1 will be cleared. In my case this is the 'Thuis' page.

Editors do not like to type and it is a lot to ask of a mortal admin to keep up with the list of installed news plugins and add them to the TSConfig field under page properties. This extension makes this task a little less painful.

When editing the page properties you can manage the cache clearing on the 'Extended' tab.

img-4 Illustration 4: Clear cache of Thuis

Upon saving the page properties, the page TSConfig is automagically added to the TSConfig field:

# TCEMAIN.clearCacheSettings.begin
# Do not modify! Automagically updated by nc_beclearcachehelper

TCEMAIN.clearCacheCmd = 1
# TCEMAIN.clearCacheSettings.end

Instructing editors to update the list

The list of pages in the page properties must be updated when a new tt_news plugin is added to the site.

Known problems

If you find any problems, please report them to: extensions@netcreators.com

Please take some time and make a proper report stating at least:

  • version of the extension
  • reproducibility
  • steps to reproduce
  • observed behavior
  • expected behavior

Writing a good bug report will help us to fix the bugs faster and better.

TODO

Currently we have no TODO. If you have great innovative ideas, please let us know by posting a feature request to: extensions@netcreators.com

I have been experimenting with 'autoconfiguration' of the clear cache settings. For a given page/folder we can detect what records are available in the folder and sub-folders. For all those folders we can find the plugin instances that the records belong to. We can also look up the page id's on which the plugin instances are installed. All this work should result in a list of pages for which cache must be cleared when changing a record of the page for which we are changing the page properties.

But there are problems:

  • Not all plugins are USER
  • Not all plugins are included on a page by adding them as tt_content. Some may be included via TypoScript
  • The legacy naming is no fun to work with (tt_news => list_type 9)
  • A lot of records should be ignored from the autoconfig ('pages', 'tt_ content','tt_content','tx_powermail_mails','tx_templavoila_tmplob j','tx_templavoila_datastructure','sys_dmail','sys_dmail_group',' sys_template','fe_users','fe_groups', etc.)

This all makes the current testing (disabled) autoconfig attempt pretty slow.

Maybe there will be an autoconfig option some day. If you have any clever ideas about this . . . drop us a line.

Changelog

Version

a

Version

b

Date

c

Changes

1.0.0

a

1.0.0

b

14 May 2010

c

First release

img-5

EXT: BE Clear cache cmd helper 0