Missing wp_to_buffer_log table error on old Multisite install
-
Hi,
I run an old WordPress Multisite network (PHP 8.3). WP to Buffer is activated only on Site 1 of the network — it is not network-activated.
I’ve confirmed the issue is reproducible: every time a scheduled post on Site 1 auto-publishes, the following database error is written to the
PHP error log:WordPress database error Table ‘wp_XXXXXX.wp_to_buffer_log’ doesn’t exist
for query SHOW FULL COLUMNS FROMwp_to_buffer_logmade by
do_action_ref_array(‘publish_future_post’), WP_Hook->do_action,
WP_Hook->apply_filters, check_and_publish_future_post, wp_publish_post,
do_action(‘wp_insert_post’), WP_Hook->do_action, WP_Hook->apply_filters,
WPZinc\Social\Publish->wp_insert_post_publish, WPZinc\Social\Publish->publish,
WPZinc\Social\Publish->send, WPZinc\Social\Log->addDigging into the plugin code, this comes from
Log::add()inlib/social/includes/class-log.php. That method calls$wpdb->insert( $wpdb->prefix . $this->table, $log )directly, without
first checking whether the log table actually exists. On my install, the
table apparently was never created for this site — possibly because the
plugin’s activation routine (which is multisite-aware and loops throughget_sites()on network activation) never ran in this site’s context,
since the plugin was activated per-site rather than network-wide.The error itself isn’t fatal — WordPress just logs the warning and
carries on — but it fires on every single scheduled publish, which fills
up the error log needlessly.Would it be possible for
Log::add()(and the other methods that query
this table, likeget(),search(), andtotal()) to check
whether the table exists first, and create it on the fly if it’s
missing — similar to whatactivate()already does? That would make
the plugin self-heal in this situation instead of writing a raw database
error to the log.Happy to share the exact patch I’m using locally if that’s useful.
Thanks!
You must be logged in to reply to this topic.