plugin updates

This commit is contained in:
Tony Volpe
2024-09-17 10:43:54 -04:00
parent 44b413346f
commit b7c8882c8c
1359 changed files with 58219 additions and 11364 deletions

View File

@@ -123,42 +123,42 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
*/
public function get_tools() {
$tools = array(
'clear_transients' => array(
'clear_transients' => array(
'name' => __( 'WooCommerce transients', 'woocommerce' ),
'button' => __( 'Clear transients', 'woocommerce' ),
'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce' ),
),
'clear_expired_transients' => array(
'clear_expired_transients' => array(
'name' => __( 'Expired transients', 'woocommerce' ),
'button' => __( 'Clear transients', 'woocommerce' ),
'desc' => __( 'This tool will clear ALL expired transients from WordPress.', 'woocommerce' ),
),
'delete_orphaned_variations' => array(
'delete_orphaned_variations' => array(
'name' => __( 'Orphaned variations', 'woocommerce' ),
'button' => __( 'Delete orphaned variations', 'woocommerce' ),
'desc' => __( 'This tool will delete all variations which have no parent.', 'woocommerce' ),
),
'clear_expired_download_permissions' => array(
'clear_expired_download_permissions' => array(
'name' => __( 'Used-up download permissions', 'woocommerce' ),
'button' => __( 'Clean up download permissions', 'woocommerce' ),
'desc' => __( 'This tool will delete expired download permissions and permissions with 0 remaining downloads.', 'woocommerce' ),
),
'regenerate_product_lookup_tables' => array(
'regenerate_product_lookup_tables' => array(
'name' => __( 'Product lookup tables', 'woocommerce' ),
'button' => __( 'Regenerate', 'woocommerce' ),
'desc' => __( 'This tool will regenerate product lookup table data. This process may take a while.', 'woocommerce' ),
),
'recount_terms' => array(
'recount_terms' => array(
'name' => __( 'Term counts', 'woocommerce' ),
'button' => __( 'Recount terms', 'woocommerce' ),
'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce' ),
),
'reset_roles' => array(
'reset_roles' => array(
'name' => __( 'Capabilities', 'woocommerce' ),
'button' => __( 'Reset capabilities', 'woocommerce' ),
'desc' => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce' ),
),
'clear_sessions' => array(
'clear_sessions' => array(
'name' => __( 'Clear customer sessions', 'woocommerce' ),
'button' => __( 'Clear', 'woocommerce' ),
'desc' => sprintf(
@@ -167,7 +167,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
__( 'This tool will delete all customer session data from the database, including current carts and saved carts in the database.', 'woocommerce' )
),
),
'clear_template_cache' => array(
'clear_template_cache' => array(
'name' => __( 'Clear template cache', 'woocommerce' ),
'button' => __( 'Clear', 'woocommerce' ),
'desc' => sprintf(
@@ -176,7 +176,16 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
__( 'This tool will empty the template cache.', 'woocommerce' )
),
),
'install_pages' => array(
'clear_system_status_theme_info_cache' => array(
'name' => __( 'Clear system status theme info cache', 'woocommerce' ),
'button' => __( 'Clear', 'woocommerce' ),
'desc' => sprintf(
'<strong class="red">%1$s</strong> %2$s',
__( 'Note:', 'woocommerce' ),
__( 'This tool will empty the system status theme info cache.', 'woocommerce' )
),
),
'install_pages' => array(
'name' => __( 'Create default WooCommerce pages', 'woocommerce' ),
'button' => __( 'Create pages', 'woocommerce' ),
'desc' => sprintf(
@@ -185,7 +194,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
__( 'This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.', 'woocommerce' )
),
),
'delete_taxes' => array(
'delete_taxes' => array(
'name' => __( 'Delete WooCommerce tax rates', 'woocommerce' ),
'button' => __( 'Delete tax rates', 'woocommerce' ),
'desc' => sprintf(
@@ -194,12 +203,12 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
__( 'This option will delete ALL of your tax rates, use with caution. This action cannot be reversed.', 'woocommerce' )
),
),
'regenerate_thumbnails' => array(
'regenerate_thumbnails' => array(
'name' => __( 'Regenerate shop thumbnails', 'woocommerce' ),
'button' => __( 'Regenerate', 'woocommerce' ),
'desc' => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce' ),
),
'db_update_routine' => array(
'db_update_routine' => array(
'name' => __( 'Update database', 'woocommerce' ),
'button' => __( 'Update database', 'woocommerce' ),
'desc' => sprintf(
@@ -567,6 +576,11 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
}
break;
case 'clear_system_status_theme_info_cache':
wc_clear_system_status_theme_info_cache();
$message = __( 'System status theme info cache cleared.', 'woocommerce' );
break;
case 'verify_db_tables':
if ( ! method_exists( 'WC_Install', 'verify_base_tables' ) ) {
$message = __( 'You need WooCommerce 4.2 or newer to run this tool.', 'woocommerce' );

View File

@@ -864,7 +864,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
}
$database_version = wc_get_server_database_version();
$log_directory = LoggingUtil::get_log_directory();
$log_directory = LoggingUtil::get_log_directory( false );
// Return all environment info. Described by JSON Schema.
return array(

View File

@@ -131,7 +131,7 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller {
foreach ( $value as $item ) {
if ( is_array( $item ) ) {
if ( $this->item_is_null( $item ) || ( isset( $item['quantity'] ) && 0 === $item['quantity'] ) ) {
$order->remove_item( $item['id'] );
$this->remove_item( $order, $key, $item['id'] );
} else {
$this->set_item( $order, $key, $item );
}
@@ -170,6 +170,46 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller {
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $order, $request, $creating );
}
/**
* Wrapper method to remove order items.
* When updating, the item ID provided is checked to ensure it is associated
* with the order.
*
* @param WC_Order $order The order to remove the item from.
* @param string $item_type The item type (from the request, not from the item, e.g. 'line_items' rather than 'line_item').
* @param int $item_id The ID of the item to remove.
*
* @return void
* @throws WC_REST_Exception If item ID is not associated with order.
*/
protected function remove_item( WC_Order $order, string $item_type, int $item_id ): void {
$item = $order->get_item( $item_id );
if ( ! $item ) {
throw new WC_REST_Exception(
'woocommerce_rest_invalid_item_id',
esc_html__( 'Order item ID provided is not associated with order.', 'woocommerce' ),
400
);
}
if ( 'line_items' === $item_type ) {
require_once WC_ABSPATH . 'includes/admin/wc-admin-functions.php';
wc_maybe_adjust_line_item_product_stock( $item, 0 );
}
/**
* Allow extensions be notified before the item is removed.
*
* @param WC_Order_Item $item The item object.
*
* @since 9.3.0.
*/
do_action( 'woocommerce_rest_remove_order_item', $item );
$order->remove_item( $item_id );
}
/**
* Save an object data.
*

View File

@@ -472,6 +472,10 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
update_comment_meta( $review_id, 'rating', ! empty( $request['rating'] ) ? $request['rating'] : '0' );
if ( isset( $request['verified'] ) && ! empty( $request['verified'] ) ) {
update_comment_meta( $review_id, 'verified', $request['verified'] );
}
$review = get_comment( $review_id );
/**
@@ -586,6 +590,10 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
update_comment_meta( $id, 'rating', $request['rating'] );
}
if ( isset( $request['verified'] ) && ! empty( $request['verified'] ) ) {
update_comment_meta( $id, 'verified', $request['verified'] );
}
$review = get_comment( $id );
/** This action is documented in includes/api/class-wc-rest-product-reviews-controller.php */