@@ 56-75 (lines=20) @@ | ||
53 | } |
|
54 | ||
55 | ||
56 | public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
|
57 | $csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size ); |
|
58 | \EE_Registry::instance()->load_helper( 'Export' ); |
|
59 | \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
60 | $units_processed = count( $csv_data ); |
|
61 | $job_parameters->mark_processed( $units_processed ); |
|
62 | $extra_response_data = array( |
|
63 | 'file_url' => '' |
|
64 | ); |
|
65 | if( $units_processed < $batch_size ) { |
|
66 | $job_parameters->set_status( JobParameters::status_complete ); |
|
67 | $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
68 | } |
|
69 | return new JobStepResponse( |
|
70 | $job_parameters, |
|
71 | sprintf( |
|
72 | __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
73 | count( $csv_data ) ), |
|
74 | $extra_response_data ); |
|
75 | } |
|
76 | ||
77 | ||
78 | public function cleanup_job(JobParameters $job_parameters) { |
@@ 97-116 (lines=20) @@ | ||
94 | * } and anything more we want to add |
|
95 | * @throws |
|
96 | */ |
|
97 | public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) { |
|
98 | $csv_data = $this->get_csv_data_for( $job_parameters->request_datum( 'EVT_ID', '0'), $job_parameters->units_processed(), $batch_size ); |
|
99 | \EE_Registry::instance()->load_helper( 'Export' ); |
|
100 | \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
101 | $units_processed = count( $csv_data ); |
|
102 | $job_parameters->mark_processed( $units_processed ); |
|
103 | $extra_response_data = array( |
|
104 | 'file_url' => '' |
|
105 | ); |
|
106 | if( $units_processed < $batch_size ) { |
|
107 | $job_parameters->set_status( JobParameters::status_complete ); |
|
108 | $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
109 | } |
|
110 | return new JobStepResponse( |
|
111 | $job_parameters, |
|
112 | sprintf( |
|
113 | __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
114 | count( $csv_data ) ), |
|
115 | $extra_response_data ); |
|
116 | } |
|
117 | ||
118 | function get_csv_data_for( $event_id, $offset, $limit ) { |
|
119 | \EE_Registry::instance()->load_helper( 'Export' ); |