dfactoryplugins / post-views-counter

Post Views Counter
56 stars 20 forks source link

Views flushing from cache not working after `PVC 1.3.1` #42

Open fagiani opened 3 years ago

fagiani commented 3 years ago

@psielicki @bartoszarendt

I've recently updated from 1.3.1 to 1.3.4 and after a while noticed all page views have been lost in the mean time. I didn't change any settings or behaviors after the update. After a closer look on the source code, it looks like some refactor was being conducted and as far as I could understand it wasn't completed but actually released.

This commit looks like where it all changed as you can see it will call a db_prepare_insert and then db_commit_insert instead of the former db_insert.

Below you can check the actual method code with the important INSERT query commented: https://github.com/dfactoryplugins/post-views-counter/blob/b2059150ec6accb83a39123b3af5c51e41bc109f/includes/counter.php#L671-L686

I'm not sure why it is commented or how did this get to a release without working and specially because it has been a long while it has happened and no one eventually noticed I am curious if there is actually a different way to do it after that release that I didn't catch.

P.S. Reverting to PVC 1.3.1 got it back working.

For the record, I am using WP 5.7 with nginx 1.18.0 and PHP 7.4.16.

Below a screenshot of relevant configuration screen: Screen Shot 2021-04-15 at 2 53 58 PM

Please let me know if I can provide any further information and be helpful on improving this great plugin!

Keep Rocking!

bartoszarendt commented 3 years ago

Thanks for pointing this out @fagiani We've already pushed a fix and an official WP upfate will be released shortly.

fagiani commented 3 years ago

Great @bartoszarendt! I saw the fix here: https://github.com/dfactoryplugins/post-views-counter/commit/e6a620d2aa7d0e0cec9a457b013e11ddcd58b2d9 by @psielicki

I should have sent a PR with that but I was unsure uncommenting it would be enough.

I'd appreciate if you could ping here when you release it to WP.

Thanks again!