Support » Plugin: WordPress Popular Posts » wp_popularpostssummary did not update on multi-site local activate

  • Resolved djkimmel

    (@djkimmel)


    I updated a small WP Multi-site to WP v4.9 and then also updated WordPress Popular Posts to v4.0.12. I noticed my theme’s sidebar Popular widget was no longer working with the “Sorry. No data so far.” message while I knew I had visits. Pretty much every time I’ve seen this there’s been an error somewhere causing WPP not to work correctly. I looked at my error log and it had gone from 0 to 660K+ just today. The log was full of errors like this:

    [20-Nov-2017 23:34:04 UTC] WordPress database error Unknown column 'v.view_datetime' in 'where clause'
     for query SELECT p.ID AS id, p.post_title AS title, p.post_author AS uid, p.post_excerpt AS post_excerpt,
     p.post_content AS post_content,
     ( SUM(v.pageviews)/(IF ( DATEDIFF('2017-11-20 18:34:04', DATE_SUB('2017-11-20 18:34:04', INTERVAL 6 DAY)) > 0,
     DATEDIFF('2017-11-20 18:34:04', DATE_SUB('2017-11-20 18:34:04', INTERVAL 6 DAY)), 1) ) )
     AS avg_views FROM <code>pcv_21_popularpostssummary</code> v LEFT JOIN <code>pcv_21_posts</code> p ON v.postid = p.ID WHERE 1 = 1
     AND p.post_type IN('post') AND v.view_datetime > DATE_SUB('2017-11-20 18:34:04', INTERVAL 6 DAY)
     AND p.post_password = '' AND p.post_status = 'publish' GROUP BY v.postid ORDER BY avg_views DESC LIMIT 5 OFFSET 0;
     made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'),
     include('/themes/wp-shopkeeper101/page-widgetized.php'), get_template_part, locate_template, load_template,
     require('/themes/wp-shopkeeper101/content-after.php'), get_sidebar, locate_template, load_template,
     require_once('/themes/wp-shopkeeper101/sidebar.php'), dynamic_sidebar, call_user_func_array,
     WP_Widget->display_callback, Sidetabs_Widget->widget, get_template_part, locate_template, load_template,
     require('/themes/wp-shopkeeper101/featured-sidetabs.php'), wpp_get_mostpopular, do_shortcode,
     preg_replace_callback, do_shortcode_tag, call_user_func, WPP_Public->wpp_shortcode, WPP_Query->__construct,
     WPP_Query->run_query

    Looked at my tables in each site and none of the sites I’m using WPP on had a column ‘view_datetime’ in them. I tried deactivating and reactivating WPP in each site it is used on and there was no change in the wp_popularpostssummary table for any site. I do not have WPP network activated since I do not need or want it on many of this multi-site’s websites.

    At the moment the WPP stats on these sites was not important to me as I’m cleaning them up and making changes so I deleted WPP at the network level and reinstalled the plugin. When I activated it now on the sites I need it on the wp_popularpostssummary was created with the view_datetime column. I don’t know why when I upgraded the network the database updates for WPP did not happen on the sites I was using it on but the only option besides deleting and installing new was to manually run queries on each site it was needed on. I hope you can fix it so this doesn’t continue to be an issue going forward for non-network activated multi-site installs.

    I have to update a bunch more sites with WP 4.9 and WPP 4.0.12 but only one other one is a multi-site. I hate to have to run queries on each separate site to make this update work.

    Just updated to WordPress 4.9
    WordPress Popular Posts 4.0.12
    PHP 5.6.28
    Theme WP-Shopkeeper v1.0.1 child (though same thing happened with several other themes)
    This site active plugins
    Bad Behavior Version 2.2.20 Network Active
    Ban Hammer Version 2.6 Network Active
    Contact Form 7 Version 4.9.1
    Easy FancyBox Version 1.6
    Ebay Feeds for WordPress Version 1.12
    FV Simpler SEO Version 1.6.35 Network Active
    Google Analytics for WordPress by MonsterInsights Version 6.2.6 Network Active
    Head, Footer and Post Injections Network Active
    Link Manager Version 0.1-beta Network Active
    Members Version 2.0.2 Network Active
    Multisite Enhancements Version 1.4.1 Network Active
    Page Tagger Version 0.4.2 Deactivate
    PHP Code Widget Version 2.3 Network Active
    Share Buttons by AddThis Version 6.1.1
    Shield Version 5.16.4 Network Active
    Version 2.9.1 | By Vladimir Prelovac | View details
    Ultimate Nofollow Version 1.4.7
    White Label CMS Version 1.6.1 Network Active
    WordPress Importer Version 0.6.3 Network Active
    WordPress MU Domain Mapping Version 0.5.5.1 Network Active
    WP-PageNavi Version 2.92

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Héctor Cabrera

    (@hcabrera)

    Another way to trigger the upgrade process would be by changing the meta wpp_version -stored in the options table of each site using the plugin- to a previous version (eg. 4.0.0).

    Problem seems to be that for some people this option -wpp_version- was never created and so when the plugin checks for it WPP doesn’t find it and so it doesn’t run the upgrade process (something I wasn’t aware of until not long ago, unfortunately). This was probably your case as well, so the workaround from above should work.

    Thread Starter djkimmel

    (@djkimmel)

    Thank you for that information. I looked at my other multi-site install and none of the _options tables have the wpp_ver meta. I’m assuming I can manually add that to each table before I upgrade and hopefully that causes the upgrade to do the sql table changes.

    I looked at several of my other non-multi-site installs with versions of WPP as far back as v3.3.4 and they all so far seem to have the wpp_ver meta. Must be something with the multi-site only, I guess.

    • This reply was modified 3 years, 3 months ago by djkimmel.
    Plugin Author Héctor Cabrera

    (@hcabrera)

    I’m assuming I can manually add that to each table before I upgrade and hopefully that causes the upgrade to do the sql table changes.

    Yep, that would work too.

    I looked at several of my other non-multi-site installs with versions of WPP as far back as v3.3.4 and they all so far seem to have the wpp_ver meta. Must be something with the multi-site only, I guess.

    It affected some “regular” WP sites as well, actually. Fortunately, it appears that the number of affected sites isn’t that big (and that I’ve been releasing updates more frequently now with additional minor bug fixes / enhancements, hopefully triggering missed upgrades as well).

    I already took measures to make sure wpp_ver is (re)created if not found, so this should not happen again.

    woodwardmatt

    (@woodwardmatt)

    I have observed this same issue on my multisite install. Some of the sites have the wpp_ver (with the latest value 4.0.13) but not the v.view_datetime column in the summary table. I just have:

    – ID
    – postid
    – pageviews
    – view_date
    – last_viewed

    So in terms of trying to fix this am I best to:

    – Bulk reset the wpp-ver option value to something lower than 4.0.1.3 (e.g. 4.0.1.2) on all sites

    – Network deactivate / re-activate the plugin (this is currently network activated).

    The same error is filling my log file too.

    TYIA 🙂

    woodwardmatt

    (@woodwardmatt)

    And will doing that lose the existing data within those tables, as they are recreated on activation?

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Hi @woodwardmatt,

    Don’t worry. All the upgrade does is update some table columns -changes the name of one of them actually, and updates the indexes accordingly- so no data will be lost.

    If you want to be extra careful, a database backup before making any changes won’t hurt (not that it’s any necessary though).

    woodwardmatt

    (@woodwardmatt)

    Thanks @hcabrera appreciate that 🙂 And the approach to correct the issue that I’ve outlined above is ok?

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Yep @woodwardmatt, that is basically what I suggested the OP to do 😛

    Only one minor correction: it’s wpp_ver.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘wp_popularpostssummary did not update on multi-site local activate’ is closed to new replies.