rankmath / seo-by-rank-math

Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
https://rankmath.com
107 stars 52 forks source link

Add check if WC is installed or enabled. #47

Closed dkvadratu closed 3 years ago

dkvadratu commented 3 years ago

Now i'm getting E_ERROR, because I don't use WC and my wordpress project and there is no _actionschedule tables.

An error of type E_ERROR was caused in line 44 of the file /home/***/domains/****.com/public_html/wp-content/plugins/seo-by-rank-math/vendor/woocommerce/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php. Error message: Uncaught RuntimeException: Error saving action: Error saving action: Table '****.wp_actionscheduler_actions' doesn't exist in /home/***/domains/****.com/public_html/wp-content/plugins/seo-by-rank-math/vendor/woocommerce/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44 Stack trace: #0 /home/***/domains/****.com/public_html/wp-content/plugins/seo-by-rank-math/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(242): ActionScheduler_DBStoreMigrator->save_action(Object(ActionScheduler_Action), NULL) #1 /home/***/domains/****.com/public_html/wp-content/plugins/seo-by-rank-math/vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionFactory.php(177): ActionScheduler_HybridStore->save_action(Object(ActionScheduler_Action)) #2 /home/***/domains/****.com/public_html/wp-content/plugins/seo-by-rank-math/vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionFactory.php

https://github.com/rankmath/seo-by-rank-math/blob/afc4b971eb41a585e594cf464a31e72977447313/vendor/woocommerce/action-scheduler/action-scheduler.php#L48

surajv commented 3 years ago

It looks like Action Scheduler related tables are missing on your site, please install and activate this plugin to fix that https://github.com/rankmath/_repair-action-scheduler

dkvadratu commented 3 years ago

Thanks. Is it necessary to use these tables? For what are they used? I wrote this notice because my client's website was Down for this error, so consider to add some check ;)

Default WordPress doesn't provide those tables.

surajv commented 3 years ago

This is the custom Cron Job management library written by WooCommerce team, which we use for our Cron Jobs, to schedule Analytics Data import from Google and some other tasks.

This is the rare issue, happens on those setups where Action Schedular was installed in the past along with some other old plugin and that plugin left traces of Action Scheduler in the Database, which causes this conflict.

That's why we have created this small plugin, which takes care of the issue; and you will not face it again.

I hope this helps.

dkvadratu commented 3 years ago

Yes this helped. Thank you.