static-html-output icon indicating copy to clipboard operation
static-html-output copied to clipboard

Fix DB table creation on update;check deactivation, deletion and attempted install on < PHP 7.3

Open crstauf opened this issue 4 years ago • 5 comments

WordPress database error Table 'local.wp_statichtmloutput_urls' doesn't exist for query TRUNCATE TABLE wp_statichtmloutput_urls made by do_action('toplevel_page_statichtmloutput'), WP_Hook->do_action, WP_Hook->apply_filters, StaticHTMLOutput\Controller::renderOptionsPage, StaticHTMLOutput\Controller->detect_urls, StaticHTMLOutput\CrawlQueue::truncate, QM_DB->query
WordPress database error Table 'local.wp_statichtmloutput_urls' doesn't exist for query SELECT COUNT(*) FROM wp_statichtmloutput_urls made by do_action('toplevel_page_statichtmloutput'), WP_Hook->do_action, WP_Hook->apply_filters, StaticHTMLOutput\Controller::renderOptionsPage, StaticHTMLOutput\Controller->detect_urls, StaticHTMLOutput\CrawlQueue::truncate, StaticHTMLOutput\CrawlQueue::getTotalCrawlableURLs, QM_DB->query
PHP Fatal error:  Uncaught TypeError: Return value of StaticHTMLOutput\CrawlQueue::getTotalCrawlableURLs() must be of the type int, null returned in /app/public/wp-content/plugins/static-html-output-plugin/src/CrawlQueue.php:86
Stack trace:
#0 /app/public/wp-content/plugins/static-html-output-plugin/src/CrawlQueue.php(99): StaticHTMLOutput\CrawlQueue::getTotalCrawlableURLs()
#1 /app/public/wp-content/plugins/static-html-output-plugin/src/Controller.php(189): StaticHTMLOutput\CrawlQueue::truncate()
#2 /app/public/wp-content/plugins/static-html-output-plugin/src/Controller.php(218): StaticHTMLOutput\Controller->detect_urls()
#3 /app/public/wp-includes/class-wp-hook.php(287): StaticHTMLOutput\Controller::renderOptionsPage('')
#4 /app/public/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#5 /app/public/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#6 /app/public/wp-admin/admin.php(254): do_action('toplevel_page_s...')
#7 {main}
  thrown in /app/public/wp-content/plugins/static-html-output-plugin/src/CrawlQueue.php on line 86

crstauf avatar Jun 15 '20 20:06 crstauf

@leonstafford Critical errors with 6.6.19 (after upgrading from 6.6.17).

crstauf avatar Jun 15 '20 20:06 crstauf

Confirmed in local WordPress of portfolio site, and in my plugin development environment: upgrading from 6.6.17 to 6.6.19 results in the above errors.

crstauf avatar Jun 15 '20 20:06 crstauf

It seems that the tables are only created on plugin activation, which a plugin update it seems does not fire the activation hook.

Deactivating and reactivating the plugin seems to fix the problem.

crstauf avatar Jun 15 '20 20:06 crstauf

@crstauf ah, thanks! I had hoped it was for update, too. I'll need to do some comprehensive testing before release to ensure smooth updates and deactivation, uninstall all work

leonstafford avatar Jun 15 '20 20:06 leonstafford

tracking in https://github.com/WP2Static/static-html-output-plugin/pull/105

leonstafford avatar Jun 16 '20 17:06 leonstafford