/home/techb158/l2hypotheques.com/wp-content/plugins/woocommerce/src/Admin
Edit: /home/techb158/l2hypotheques.com/wp-content/plugins/woocommerce/src/Admin/ReportsSync.php (6853B)
new \DateTime( $current_import_date ) ) {
$import_stats['imported_from'] = $current_import_date;
}
update_option( ImportScheduler::IMPORT_STATS_OPTION, $import_stats );
}
/**
* Get stats for current import.
*
* @return array
*/
public static function get_import_stats() {
$import_stats = get_option( ImportScheduler::IMPORT_STATS_OPTION, array() );
$import_stats['is_importing'] = self::is_importing();
return $import_stats;
}
/**
* Get the import totals for all syncs.
*
* @param int|bool $days Number of days to import.
* @param bool $skip_existing Skip existing records.
* @return array
*/
public static function get_import_totals( $days, $skip_existing ) {
$totals = array();
foreach ( self::get_schedulers() as $scheduler ) {
$items = $scheduler::get_items( 1, 1, $days, $skip_existing );
$totals[ $scheduler::$name ] = $items->total;
}
return $totals;
}
/**
* Clears all queued actions.
*/
public static function clear_queued_actions() {
foreach ( self::get_schedulers() as $scheduler ) {
$scheduler::clear_queued_actions();
}
}
/**
* Delete all data for reports.
*
* @return string
*/
public static function delete_report_data() {
// Cancel all pending import jobs.
self::clear_queued_actions();
foreach ( self::get_schedulers() as $scheduler ) {
$scheduler::schedule_action( 'delete_batch_init', array() );
}
// Delete import options.
delete_option( ImportScheduler::IMPORT_STATS_OPTION );
return __( 'Report table data is being deleted.', 'woocommerce' );
}
/**
* Clear the stock count cache for a post if it's a product or product variation.
*
* Handles trashed_post, untrashed_post, and delete_post hooks.
*
* @internal
*
* @param int $post_id The post ID.
*/
public static function maybe_clear_stock_count_cache_for_post( $post_id ): void {
$post = get_post( $post_id );
if ( $post && in_array( $post->post_type, array( 'product', 'product_variation' ), true ) ) {
self::clear_stock_count_cache( $post_id );
}
}
/**
* Clear the count cache when products are added or updated, or when
* the no/low stock options are changed.
*
* @param int $id Post/product ID.
*/
public static function clear_stock_count_cache( $id ) {
delete_transient( 'wc_admin_stock_count_lowstock' );
delete_transient( 'wc_admin_product_count' );
$status_options = wc_get_product_stock_status_options();
foreach ( $status_options as $status => $label ) {
delete_transient( 'wc_admin_stock_count_' . $status );
}
}
}