Disable anon for now
This commit is contained in:
parent
314d949d2c
commit
bce3c7e94c
|
@ -635,7 +635,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
id="<?php echo esc_attr( $value['id'] ); ?>"
|
||||
type="number"
|
||||
style="width: 80px;"
|
||||
value="<?php echo esc_attr( $option_value->number ); ?>"
|
||||
value="<?php echo esc_attr( $option_value['number'] ); ?>"
|
||||
class="<?php echo esc_attr( $value['class'] ); ?>"
|
||||
placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
|
||||
step="1"
|
||||
|
@ -644,7 +644,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
<select name="<?php echo esc_attr( $value['id'] ); ?>[unit]" style="width: auto;">
|
||||
<?php
|
||||
foreach ( $periods as $value => $label ) {
|
||||
echo '<option value="' . esc_attr( $value ) . '"' . selected( $option_value->unit, $value, false ) . '>' . esc_html( $label ) . '</option>';
|
||||
echo '<option value="' . esc_attr( $value ) . '"' . selected( $option_value['unit'], $value, false ) . '>' . esc_html( $label ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select> <?php echo ( $description ) ? $description : ''; // WPCS: XSS ok. ?>
|
||||
|
|
|
@ -37,7 +37,7 @@ class WC_Privacy {
|
|||
* @param array $query Query array to pass to wc_get_orders().
|
||||
* @return int Count of orders that were trashed.
|
||||
*/
|
||||
protected function trash_orders_query( $query ) {
|
||||
protected static function trash_orders_query( $query ) {
|
||||
$orders = wc_get_orders( $query );
|
||||
$count = 0;
|
||||
|
||||
|
@ -58,12 +58,13 @@ class WC_Privacy {
|
|||
* @param array $query Query array to pass to wc_get_orders().
|
||||
* @return int Count of orders that were anonymized.
|
||||
*/
|
||||
protected function anonymize_orders_query( $query ) {
|
||||
protected static function anonymize_orders_query( $query ) {
|
||||
$orders = wc_get_orders( $query );
|
||||
$count = 0;
|
||||
|
||||
if ( $orders ) {
|
||||
foreach ( $orders as $order ) {
|
||||
error_log( 'Anon ' . $order->get_id() ); // @codingStandardsIgnoreLine temp until implemented.
|
||||
// self::remove_order_personal_data( $order ); @todo Integrate with #19330 and set _anonymized meta after complete.
|
||||
$count ++;
|
||||
}
|
||||
|
@ -79,7 +80,8 @@ class WC_Privacy {
|
|||
self::$background_process->push_to_queue( array( 'task' => 'trash_pending_orders' ) );
|
||||
self::$background_process->push_to_queue( array( 'task' => 'trash_failed_orders' ) );
|
||||
self::$background_process->push_to_queue( array( 'task' => 'trash_cancelled_orders' ) );
|
||||
self::$background_process->push_to_queue( array( 'task' => 'anonymize_completed_orders' ) );
|
||||
//self::$background_process->push_to_queue( array( 'task' => 'anonymize_completed_orders' ) );
|
||||
self::$background_process->save()->dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,12 +97,12 @@ class WC_Privacy {
|
|||
'unit' => 'days',
|
||||
) ) );
|
||||
|
||||
if ( empty( $option->number ) ) {
|
||||
if ( empty( $option['number'] ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return self::trash_orders_query( array(
|
||||
'date_created' => '<' . strtotime( '-' . $option->number . ' ' . $option->unit ),
|
||||
'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
|
||||
'limit' => $limit, // Batches of 20.
|
||||
'status' => 'wc-pending',
|
||||
) );
|
||||
|
@ -119,12 +121,12 @@ class WC_Privacy {
|
|||
'unit' => 'days',
|
||||
) ) );
|
||||
|
||||
if ( empty( $option->number ) ) {
|
||||
if ( empty( $option['number'] ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return self::trash_orders_query( array(
|
||||
'date_created' => '<' . strtotime( '-' . $option->number . ' ' . $option->unit ),
|
||||
'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
|
||||
'limit' => $limit, // Batches of 20.
|
||||
'status' => 'wc-failed',
|
||||
) );
|
||||
|
@ -143,12 +145,12 @@ class WC_Privacy {
|
|||
'unit' => 'days',
|
||||
) ) );
|
||||
|
||||
if ( empty( $option->number ) ) {
|
||||
if ( empty( $option['number'] ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return self::trash_orders_query( array(
|
||||
'date_created' => '<' . strtotime( '-' . $option->number . ' ' . $option->unit ),
|
||||
'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
|
||||
'limit' => $limit, // Batches of 20.
|
||||
'status' => 'wc-cancelled',
|
||||
) );
|
||||
|
@ -165,12 +167,12 @@ class WC_Privacy {
|
|||
public static function anonymize_completed_orders( $limit = 20, $page = 1 ) {
|
||||
$option = wc_parse_relative_date_option( get_option( 'woocommerce_anonymize_completed_orders' ) );
|
||||
|
||||
if ( empty( $option->number ) ) {
|
||||
if ( empty( $option['number'] ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return self::anonymize_orders_query( array(
|
||||
'date_created' => '<' . strtotime( '-' . $option->number . ' ' . $option->unit ),
|
||||
'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
|
||||
'limit' => $limit, // Batches of 20.
|
||||
'status' => 'wc-completed',
|
||||
'anonymized' => false,
|
||||
|
|
|
@ -1350,7 +1350,7 @@ function wc_implode_html_attributes( $raw_attributes ) {
|
|||
*
|
||||
* @since 3.4.0
|
||||
* @param mixed $raw_value Value stored in DB.
|
||||
* @return object Nicely formatted value with number and unit values.
|
||||
* @return array Nicely formatted array with number and unit values.
|
||||
*/
|
||||
function wc_parse_relative_date_option( $raw_value ) {
|
||||
$periods = array(
|
||||
|
@ -1371,5 +1371,5 @@ function wc_parse_relative_date_option( $raw_value ) {
|
|||
$value['unit'] = 'days';
|
||||
}
|
||||
|
||||
return (object) $value;
|
||||
return $value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue