Skip to content

Commit

Permalink
Merge pull request #3654 from WordImpress/issue/3638
Browse files Browse the repository at this point in the history
fix(db): delete row from give meta table when donation are being deleted #3638
  • Loading branch information
Devin Walker committed Sep 4, 2018
2 parents e1ea6dc + e9f2ad3 commit d56d3b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions includes/admin/tools/data/class-give-tools-reset-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public function get_data() {
$sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)";
$sql[] = "DELETE FROM $wpdb->comments WHERE comment_post_ID IN ($ids)";
$sql[] = "DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_ID FROM $wpdb->comments)";
$sql[] = "DELETE FROM $wpdb->formmeta WHERE form_id IN ($ids)";
$sql[] = "DELETE FROM $wpdb->logmeta WHERE meta_key = '_give_log_form_id' AND meta_value IN ($ids)";
$sql[] = "DELETE FROM {$wpdb->prefix}give_logs WHERE log_parent IN ($ids)";
$sql[] = "DELETE FROM {$wpdb->prefix}give_sequential_ordering WHERE payment_id IN ($ids)";
$sql[] = "DELETE FROM {$wpdb->prefix}give_donationmeta WHERE donation_id IN ($ids)";

$sql[] = $wpdb->prepare(
"
DELETE FROM $wpdb->terms
Expand All @@ -141,6 +147,7 @@ public function get_data() {
",
array( 'give_forms_category', 'give_forms_tag' )
);

$sql[] = $wpdb->prepare(
"
DELETE FROM $wpdb->term_taxonomy
Expand All @@ -149,6 +156,7 @@ public function get_data() {
",
array( 'give_forms_category', 'give_forms_tag' )
);

break;
}

Expand Down

0 comments on commit d56d3b7

Please sign in to comment.