[Plugin: WordPress Popular Posts] Data Reset after Update
-
I updated WordPress Popular Post but now all stats are reseted. I have two tables in my Database: wp_popularpostsdata and wp_popularpostsdata_backup but i don′t know how to get the old stats for my blog. All Blogentries now have 1 Pageview.
-
The table wb_wpptemp now exists in my Database.
I′m not a coder or somebody like this, but this line of your script:
$wpdb->query(“CREATE TABLE wp_wpptemp ( UNIQUE KEY id (postid), postid int(10) NOT NULL, day datetime NOT NULL default ‘0000-00-00 00:00:00’, last_viewed datetime NOT NULL default ‘0000-00-00 00:00:00’, pageviews int(10) default 1 )”);has been done.
Hi topas,
Please go to phpmyadmin and run this query: SELECT DISTINCT postid FROM wp_popularpostsdata_backup ORDER BY postid
Let me know what are the results from that.
Hey Ikki … i write out all entries (56 Pages á 30 Entries) and sum them up … i make new entries in wp_popularpostsdata with this data and the number of pageviews of each postid. I have 91 postID′s (my Blog exists since may … a new blog) and i made it in the last hour. Now the Data is ready, correct and live.
Thank′s for your great support!!! I hope this was the last time, i make you crazy with my Problems. ??
I′m happy that my Blog has only 56 Pages and not 500 … then your script will be the best solution.
That’s why I wrote that script xD Anyways, hope to get a feedback from someone else having this issue.
Cheers!
Yes your script gave me the idea and the amount of data is small sized. ?? So i do it manually.
Thank you again!
Ok, so I have an old blog since 2004, more than schubbiduuh articles and run into the same problem as described by topas.
I didn’t have the right to execute the script, and yes i renamed it.
Any hints how to modify your script?Well I’ve been doing some research about that permission issue topas mentioned and it seems to be a WordPress thing. Please try this (backup your data first!): https://beconfused.com/2007/08/28/how-to-solve-you-do-not-have-sufficient-permissions-to-access-this-page-in-wordpress/
I had the same problem and tried the script above. Everything worked as you said except that it had precisely the opposite effect. All of my data is now gone. It was showing some data before, but this script seemed to completely reset everything.
I looked at my database and see that this table wp_popularpostsdata is basically empty (i.e., only has from the time I upgraded the plugin). However, wp_popularpostsdata_backup seems to have all the historical data down to the minute I upgraded the plug in. Is there a way to have the plug in call data form the backup and also current? Or to merge the two?
Thanks! I love this plugin and hope I can get it working again.
Best,
JMRHi jonmrich,
The script attempts to import all data from wp_popularpostsdata_backup into wp_popularpostsdata. However, for some reason I have yet to discover it doesn’t work for some people.
I’ve updated the script, can you please test it for me? If so, please download it here and place it into the wordpress-popular-posts directory. Then, log in into your wp-admin area, and type this URL into your address bar: https://yoursite.com/wp-admin/options-general.php?page=wordpress-popular-posts/recovery.php (please replace yoursite.com with your actual url!) to run the script.
Thanks for getting back with me so quickly. The script ran perfectly fine and I got the “done!” message, but it didn’t have any effect. The all-time popular posts and pages appear only to be those since I reactivated the plugin after running the script (i.e., only shows 5 page views total).
I’m assuming that it is still not pull from the back up. The script actually seems to have the opposite effect from what’s intended. As an experiment, I ran the script again and reactivated the plug in. This time it showed “Sorry no data.” as if the script erased the data that was captured in the few minutes it was active before I re-ran the script.
Any other thoughts you have would be appreciated.
Thanks again for your efforts.
Best,
JonathanHey, no problem!
Anyways, back on topic. This is what happens when the script is ran:
# Table wp_popularpostsdata is deleted
# Then, a temporary table is created
# Next, the script attempts to retrieve all data from wp_popularpostsdata_backup
# If success, all the retrieved data is inserted into the temporary table that was created earlier
# Temporary table is renamed to wp_popularpostsdata, and a “success” message is printedCan you please re-run the script and then take a screenshot of the wp_popularpostsdata table in your phpmyadmin?
Thanks again…
Re-ran the script and got a message of “done!” Couldn’t do a screenshot having trouble with access to my phpmyadmin, but I did a database back up and got this.
#
# Data contents of tablewp_popularpostsdata
##
# End of data contents of tablewp_popularpostsdata
# ——————————————————–# ——————————————————–
# Table:wp_popularpostsdata_backup
# ——————————————————–#
# Delete any existing tablewp_popularpostsdata_backup
#DROP TABLE IF EXISTS
wp_popularpostsdata_backup
;#
# Table structure of tablewp_popularpostsdata_backup
#CREATE TABLE
wp_popularpostsdata_backup
(
postid
int(10) NOT NULL,
day
datetime NOT NULL default ‘0000-00-00 00:00:00’,
pageviews
int(10) default ‘1’,
UNIQUE KEYid
(postid
,day
)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;#
# Data contents of tablewp_popularpostsdata_backup
#INSERT INTO
wp_popularpostsdata_backup
VALUES (131, ‘2009-01-18 00:00:00’, 1);
INSERT INTOwp_popularpostsdata_backup
VALUES (127, ‘2009-01-18 00:00:00’, 2);
INSERT INTOwp_popularpostsdata_backup
VALUES (83, ‘2009-01-18 00:00:00’, 1);This table goes on for a while with all the popular posts data. It looks like the data from the backup wasn’t moved at all.
Let me know if you can make anything of this.
Thanks again.
JMR
Hey, sorry for not replying earlier. Busy weekend!
Anyways, please open recovery.php using a text editor such as Dreamweaver or Windows’ Notepad and replace this line of code:
$old_rows = $wpdb->get_results("SELECT DISTINCT postid FROM ".$wpdb->prefix."popularpostsdata_backup ORDER BY postid");
…with this one:
$old_rows = $wpdb->get_results("SELECT postid FROM ".$wpdb->prefix."popularpostsdata_backup GROUP BY postid ORDER BY postid");
Then, run the script again. Let me know what happens.
Thanks so much for the ongoing help. Unfortunately, this didn’t work. The script loaded fine, I got a message of “done!” but the plug in still serves up “Sorry. Not data so far.”
I can’t begin to know what’s wrong, but I don’t think the data from this table (wp_popularpostsdata_backup) is actually being moved. That’s where all the data is stored right now. It’s still there and I don’t see anything in the plug in or script that would indicate that it would try to move or call anything from there. Is that the issue or is the “wp_” part not essential?
Anyway…happy continue to have your help. I appreciate it. Just bought you a beer via PayPal. The least I can do to get one more minute from you.
Thanks,
JMRWell, WordPress’ table prefix is automatically added with $wpdb->prefix, so that can’t be the problem. You’re right, though. For some reason it’s not accesing that table and therefore no exporting can be done. You might want to change …
$old_rows = $wpdb->get_results("SELECT postid FROM ".$wpdb->prefix."popularpostsdata_backup GROUP BY postid ORDER BY postid");
… into …
$old_rows = $wpdb->get_results("SELECT postid FROM wp_popularpostsdata_backup GROUP BY postid ORDER BY postid");
Also, please change:
global $wp;
…into:
global $wp, $wpdb;
… and run the script again.
And hey, thanks for the beer! I’d help you even without it, but thanks anyways!
- The topic ‘[Plugin: WordPress Popular Posts] Data Reset after Update’ is closed to new replies.