pdate_export_percentage_complete( $report_type, $export_id, $percentage ) { $exports_status = get_option( self::EXPORT_STATUS_OPTION, array() ); $status_key = self::get_status_key( $report_type, $export_id ); $exports_status[ $status_key ] = $percentage; update_option( self::EXPORT_STATUS_OPTION, $exports_status ); } /** * Get the completion percentage of a report export. * * @param string $report_type Report type. E.g. 'customers'. * @param string $export_id Unique ID for report (timestamp expected). * @return bool|int Completion percentage, or false if export not found. */ public static function get_export_percentage_complete( $report_type, $export_id ) { $exports_status = get_option( self::EXPORT_STATUS_OPTION, array() ); $status_key = self::get_status_key( $report_type, $export_id ); if ( isset( $exports_status[ $status_key ] ) ) { return $exports_status[ $status_key ]; } return false; } /** * Serve the export file. */ public static function download_export_file() { // @todo - add nonce? (nonces are good for 24 hours) if ( isset( $_GET['action'] ) && ! empty( $_GET['filename'] ) && self::DOWNLOAD_EXPORT_ACTION === wp_unslash( $_GET['action'] ) && // WPCS: input var ok, sanitization ok. current_user_can( 'view_woocommerce_reports' ) ) { $exporter = new ReportCSVExporter(); $exporter->set_filename( wp_unslash( $_GET['filename'] ) ); // WPCS: input var ok, sanitization ok. $exporter->export(); } } /** * Process a report export email action. * * @param int $user_id User ID that requested the email. * @param string $export_id Unique ID for report (timestamp expected). * @param string $report_type Report type. E.g. 'customers'. * @return void */ public static function email_report_download_link( $user_id, $export_id, $report_type ) { $percent_complete = self::get_export_percentage_complete( $report_type, $export_id ); if ( 100 === $percent_complete ) { $query_args = array( 'action' => self::DOWNLOAD_EXPORT_ACTION, 'filename' => "wc-{$report_type}-report-export-{$export_id}", ); $download_url = add_query_arg( $query_args, admin_url() ); \WC_Emails::instance(); $email = new ReportCSVEmail(); $email->trigger( $user_id, $report_type, $download_url ); } } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Admin\ReportExporter" not found in /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php:169 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php(98): Automattic\WooCommerce\Internal\Admin\FeaturePlugin->includes() #1 /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php(81): Automattic\WooCommerce\Internal\Admin\FeaturePlugin->on_plugins_loaded() #2 /htdocs/wp-content/plugins/woocommerce/src/Admin/Composer/Package.php(65): Automattic\WooCommerce\Internal\Admin\FeaturePlugin->init() #3 [internal function]: Automattic\WooCommerce\Admin\Composer\Package::init() #4 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(128): call_user_func(Array) #5 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(64): Automattic\WooCommerce\Packages::initialize_packages() #6 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Packages::on_init('') #7 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #8 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #9 /htdocs/wp-settings.php(559): do_action('plugins_loaded') #10 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #11 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #12 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #13 /htdocs/index.php(17): require('/htdocs/wp-blog...') #14 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php on line 169