Big problem with page increment

Hi there,

I have a simple visitor counter at all pages, done with $page->increment() | Kirby CMS

The big problem: sometimes, it’s hard to reproduce, the whole textfile for the page is deleted. How could something happens?

Hm, that sounds like a hard one. Do you have any code that deletes pages, in a hook, for example?

Is that a single or multi-language installation?

Any plugins involved?

Hi Sonja,

absolute nothing, no Hooks or plugins. Single Language installation. I know, really hard to reproduce …

I’ll see if I can somehow reproduce it later today. Could you please post your increment code?

Sure, it’s in the footer.php at the bottom …

if ( $page->slug() != 'error' ) {
  $kirby = kirby();
  $kirby->impersonate('kirby');
  $page->increment('pagehits');
  $kirby->impersonate();
}

One more thing: Which Kirby version are you using?

Does this only happen on the live server or can you also reproduce it locally. Wonder if that happens if many people open the same page concurrently.

Happens on all Kirby Versions … also Kirby 2 and the newest Kirby 3 Version. Currently we have only this error on live sites, I think this is a bug when a user visits the site and this code runs and maybe a Admin changes something. Can this be the error? Or like you said, when many people visits the site at the same time.

The bug should now be fixed in Kirby 3.8.1.1 if anyone is interested or comes across this conversation. So Topic can be closed