Automattic\WooCommerce\Admin
ReportExporter::queue_report_export()
Queue up actions for a full report export.
Метод класса: ReportExporter{}
Хуков нет.
Возвращает
int
. Number of items to export.
Использование
$result = ReportExporter::queue_report_export( $export_id, $report_type, $report_args, $send_email );
- $export_id(строка) (обязательный)
- Unique ID for report (timestamp expected).
- $report_type(строка) (обязательный)
- Report type. E.g. 'customers'.
- $report_args(массив)
- Report parameters, passed to data query.
По умолчанию: array() - $send_email(true|false)
- Send an email when the export is complete.
По умолчанию: false
Код ReportExporter::queue_report_export() ReportExporter::queue report export WC 9.7.1
public static function queue_report_export( $export_id, $report_type, $report_args = array(), $send_email = false ) { $exporter = new ReportCSVExporter( $report_type, $report_args ); $exporter->prepare_data_to_export(); $total_rows = $exporter->get_total_rows(); $batch_size = $exporter->get_limit(); $num_batches = (int) ceil( $total_rows / $batch_size ); // Create batches, like initial import. $report_batch_args = array( $export_id, $report_type, $report_args ); if ( 0 < $num_batches ) { self::queue_batches( 1, $num_batches, 'export_report', $report_batch_args ); if ( $send_email ) { $email_action_args = array( get_current_user_id(), $export_id, $report_type ); self::schedule_action( 'email_report_download_link', $email_action_args ); } } return $total_rows; }