Skip to content

Commit

Permalink
Merge pull request #131 from a8cteam51/fix/check-aw-tables
Browse files Browse the repository at this point in the history
Check for existence of AutomateWoo and Action Scheduler tables
  • Loading branch information
GeoJunkie authored Sep 12, 2024
2 parents 6fe540b + 2561aad commit 8f5ecc1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions includes/scrub-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,17 @@ function( $v ) use ( $modules_to_disable ) {

// Disable AutomateWoo workflows, clear the queue, and set scheduled actions to "done"
$wpdb->query( "UPDATE $wpdb->posts SET post_status = 'aw-disabled' WHERE post_type = 'aw_workflow' AND post_status = 'publish'" );
$wpdb->query( "DELETE FROM {$wpdb->prefix}automatewoo_queue" );
$wpdb->query( "DELETE FROM {$wpdb->prefix}automatewoo_queue_meta" );
$wpdb->query( "UPDATE {$wpdb->prefix}actionscheduler_actions SET status = 'done' WHERE status = 'pending' AND hook LIKE '%automatewoo%'" );

$table_name = $wpdb->prefix . 'automatewoo_queue';
if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) === $table_name ) {
$wpdb->query( "DELETE FROM {$wpdb->prefix}automatewoo_queue" );
$wpdb->query( "DELETE FROM {$wpdb->prefix}automatewoo_queue_meta" );
}

$table_name = $wpdb->prefix . 'actionscheduler_actions';
if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) === $table_name ) {
$wpdb->query( "UPDATE {$wpdb->prefix}actionscheduler_actions SET status = 'done' WHERE status = 'pending' AND hook LIKE '%automatewoo%'" );
}

update_option( 'safety_net_options_scrubbed', true );

Expand Down

0 comments on commit 8f5ecc1

Please sign in to comment.