Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Views flushing from cache not working after PVC 1.3.1 #42

Open
fagiani opened this issue Apr 15, 2021 · 2 comments
Open

Views flushing from cache not working after PVC 1.3.1 #42

fagiani opened this issue Apr 15, 2021 · 2 comments

Comments

@fagiani
Copy link

fagiani commented Apr 15, 2021

@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:

private function db_commit_insert() {
if ( empty( $this->db_insert_values ) )
return false;
global $wpdb;
// $result = $wpdb->query( "
// INSERT INTO " . $wpdb->prefix . "post_views (id, type, period, count)
// VALUES " . $this->db_insert_values . "
// ON DUPLICATE KEY UPDATE count = count + VALUES(count)"
// );
$this->db_insert_values = '';
// return $result;
}

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
Copy link
Contributor

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

@fagiani
Copy link
Author

fagiani commented Apr 22, 2021

Great @bartoszarendt! I saw the fix here: e6a620d 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants