tx_news, manipulate DB, cache issue

316 views Asked by At

We use the tx_news 2.3.0 (not the newest version! - right now not possible to update..) and there is a strange bug, that does not publish news when Publish Date is set (or better, it publish them days later).

As a work around I created a small script and run it with a cronjob:

UPDATE `tx_news_domain_model_news` SET `datetime` = `starttime`, `starttime` = 0 WHERE `starttime` <>0 and `starttime` < UNIX_TIMESTAMP()

Basicly it sets the Date & Time field = Publish Date and clears the Publish Date field if that is older then now. This workaround did a good job until we enabled some caches.

Now there is a problem that sometimes the new published article does not show up in the frontend in a news listview plugin. After Flush frontend caches it is there. But sometimes it works without clear the cache. And sometimes when not clearing the cache the article is there after some hours.

I do not want to disable the cache for the site with the news listview plugin on it.

So what would be the best way to handle this? Is there a way to only clear the cache for the tx_news plugin? Maybe even better only for a specific site or news folder? Maybe direct via the database?

Any ideas?

Edit: If I am right the cache should be deleted automaticly when you change something in the news article. As I do it via DB the cache is not deleted for this articles. So I tested it, I run the script, see that the articles are not published, go to backend, open onen one of this article and saved it (without any change), and after that all articles are published. Maybe there is a way to simulate that?

1

There are 1 answers

0
nbar On

I found a solution:

As I manipulate the database directly the cache system does not know about this change. So if you save an article after this change the cachesystem delete the entries for this site (and only for this site). To force the cache to create a new cacheentry for this site I can manipulate the table cf_cache_pagesection and set the expires field to 1 (that means this cache entry is expired. I use the following SQl for it:

update `cf_cache_pagesection` set expires = 1 where identifier like '44_%'

(the page I want to change got the uid 44, that is used in the identifier)