$this->per_step, 'offset' => $this->per_step * ( $this->step - 1 ), 'orderby' => 'id', 'order' => 'DESC', ); $customers = edd_get_customers( $args ); if ( $customers ) { foreach ( $customers as $customer ) { $customer->recalculate_stats(); } return true; } return false; } /** * Return the calculated completion percentage * * @since 2.5 * @return int */ public function get_percentage_complete() { $total = edd_count_customers(); $percentage = 100; if( $total > 0 ) { $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; } if( $percentage > 100 ) { $percentage = 100; } return $percentage; } /** * Set the properties specific to the payments export * * @since 2.5 * @param array $request The Form Data passed into the batch processing */ public function set_properties( $request ) { } /** * Process a step * * @since 2.5 * @return bool */ public function process_step() { if ( ! $this->can_export() ) { wp_die( __( 'You do not have permission to export data.', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) ); } $had_data = $this->get_data(); if( $had_data ) { $this->done = false; return true; } else { $this->done = true; $this->message = __( 'Customer stats successfully recounted.', 'easy-digital-downloads' ); return false; } } public function headers() { edd_set_time_limit(); } /** * Perform the export * * @since 2.5 * @return void */ public function export() { // Set headers $this->headers(); edd_die(); } }