You appear to be a bot. Output may be restricted
Description
Get the Export Data
Usage
$array = EDD_Tools_Reset_Stats::get_data();
Parameters
Returns
array $data The data for the CSV file
Source
File name: easy-digital-downloads/includes/admin/tools/class-edd-tools-reset-stats.php
Lines:
1 to 85 of 85
public function get_data() { global $wpdb; $items = $this->get_stored_data( 'edd_temp_reset_ids' ); if ( ! is_array( $items ) ) { return false; } $offset = ( $this->step - 1 ) * $this->per_step; $step_items = array_slice( $items, $offset, $this->per_step ); if ( $step_items ) { $step_ids = array( 'customers' => array(), 'downloads' => array(), 'other' => array(), ); foreach ( $step_items as $item ) { switch( $item['type'] ) { case 'customer': $step_ids['customers'][] = $item['id']; break; case 'download': $step_ids['downloads'][] = $item['id']; break; default: $item_type = apply_filters( 'edd_reset_item_type', 'other', $item ); $step_ids[ $item_type ][] = $item['id']; break; } } $sql = array(); foreach ( $step_ids as $type => $ids ) { if ( empty( $ids ) ) { continue; } $ids = implode( ',', $ids ); switch( $type ) { case 'customers': $table_name = $wpdb->prefix . 'edd_customers'; $sql[] = "DELETE FROM $table_name WHERE id IN ($ids)"; break; case 'downloads': $sql[] = "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_edd_download_sales' AND post_id IN ($ids)"; $sql[] = "UPDATE $wpdb->postmeta SET meta_value = 0.00 WHERE meta_key = '_edd_download_earnings' AND post_id IN ($ids)"; break; case 'other': $sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)"; $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)"; break; } if ( ! in_array( $type, array( 'customers', 'downloads', 'other' ) ) ) { // Allows other types of custom post types to filter on their own post_type // and add items to the query list, for the IDs found in their post type. $sql = apply_filters( 'edd_reset_add_queries_' . $type, $sql, $ids ); } } if ( ! empty( $sql ) ) { foreach ( $sql as $query ) { $wpdb->query( $query ); } } return true; } return false; }