plugin updates

This commit is contained in:
Tony Volpe
2024-11-15 13:53:04 -05:00
parent 1293d604ca
commit 0238f0c4ca
2009 changed files with 163492 additions and 89543 deletions

View File

@@ -0,0 +1,40 @@
<?php
/**
* REST API Brands controller for WC 3.5+
*
* Handles requests to /products/brands endpoint.
*
* Important: For internal use only by the Automattic\WooCommerce\Internal\Brands package.
*
* @package WooCommerce\RestApi
* @since 9.4.0
*/
declare( strict_types = 1);
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* REST API Brands controller class.
*
* @package WooCommerce\RestApi
* @extends WC_REST_Product_Categories_Controller
*/
class WC_REST_Product_Brands_V2_Controller extends WC_REST_Product_Categories_V2_Controller {
/**
* Route base.
*
* @var string
*/
protected $rest_base = 'products/brands';
/**
* Taxonomy.
*
* @var string
*/
protected $taxonomy = 'product_brand';
}

View File

@@ -8,6 +8,9 @@
* @since 3.0.0
*/
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
use Automattic\WooCommerce\Internal\Utilities\DatabaseUtil;
defined( 'ABSPATH' ) || exit;
/**
@@ -217,6 +220,11 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
__( 'This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.', 'woocommerce' )
),
),
'recreate_order_address_fts_index' => array(
'name' => __( 'Re-create Order Address FTS index', 'woocommerce' ),
'button' => __( 'Recreate index', 'woocommerce' ),
'desc' => __( 'This tool will recreate the full text search index for order addresses. If the index does not exist, it will try to create it.', 'woocommerce' ),
),
);
if ( method_exists( 'WC_Install', 'verify_base_tables' ) ) {
$tools['verify_db_tables'] = array(
@@ -598,6 +606,13 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
}
break;
case 'recreate_order_address_fts_index':
$hpos_controller = wc_get_container()->get( CustomOrdersTableController::class );
$results = $hpos_controller->recreate_order_address_fts_index();
$ran = $results['status'];
$message = $results['message'];
break;
default:
$tools = $this->get_tools();
if ( isset( $tools[ $tool ]['callback'] ) ) {

View File

@@ -13,7 +13,7 @@ defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Internal\WCCom\ConnectionHelper;
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Register as Download_Directories;
use Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer as Order_DataSynchronizer;
use Automattic\WooCommerce\Utilities\{ LoggingUtil, OrderUtil };
use Automattic\WooCommerce\Utilities\{ LoggingUtil, OrderUtil, PluginUtil };
/**
* System status controller class.
@@ -373,7 +373,41 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
'context' => array( 'view' ),
'readonly' => true,
'items' => array(
'type' => 'string',
'type' => 'object',
'properties' => array(
'plugin' => array(
'description' => __( 'Plugin basename. The path to the main plugin file relative to the plugins directory.', 'woocommerce' ),
'type' => 'string',
),
'name' => array(
'description' => __( 'Name of the plugin.', 'woocommerce' ),
'type' => 'string',
),
'version' => array(
'description' => __( 'Current plugin version.', 'woocommerce' ),
'type' => 'string',
),
'version_latest' => array(
'description' => __( 'Latest available plugin version.', 'woocommerce' ),
'type' => 'string',
),
'url' => array(
'description' => __( 'Plugin URL.', 'woocommerce' ),
'type' => 'string',
),
'author_name' => array(
'description' => __( 'Plugin author name.', 'woocommerce' ),
'type' => 'string',
),
'author_url' => array(
'description' => __( 'Plugin author URL.', 'woocommerce' ),
'type' => 'string',
),
'network_activated' => array(
'description' => __( 'Whether the plugin can only be activated network-wide.', 'woocommerce' ),
'type' => 'boolean',
),
),
),
),
'inactive_plugins' => array(
@@ -382,7 +416,41 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
'context' => array( 'view' ),
'readonly' => true,
'items' => array(
'type' => 'string',
'type' => 'object',
'properties' => array(
'plugin' => array(
'description' => __( 'Plugin basename. The path to the main plugin file relative to the plugins directory.', 'woocommerce' ),
'type' => 'string',
),
'name' => array(
'description' => __( 'Name of the plugin.', 'woocommerce' ),
'type' => 'string',
),
'version' => array(
'description' => __( 'Current plugin version.', 'woocommerce' ),
'type' => 'string',
),
'version_latest' => array(
'description' => __( 'Latest available plugin version.', 'woocommerce' ),
'type' => 'string',
),
'url' => array(
'description' => __( 'Plugin URL.', 'woocommerce' ),
'type' => 'string',
),
'author_name' => array(
'description' => __( 'Plugin author name.', 'woocommerce' ),
'type' => 'string',
),
'author_url' => array(
'description' => __( 'Plugin author URL.', 'woocommerce' ),
'type' => 'string',
),
'network_activated' => array(
'description' => __( 'Whether the plugin can only be activated network-wide.', 'woocommerce' ),
'type' => 'boolean',
),
),
),
),
'dropins_mu_plugins' => array(
@@ -1044,15 +1112,10 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
return array();
}
$active_plugins = (array) get_option( 'active_plugins', array() );
if ( is_multisite() ) {
$network_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
$active_plugins = array_merge( $active_plugins, $network_activated_plugins );
}
$active_valid_plugins = wc_get_container()->get( PluginUtil::class )->get_all_active_valid_plugins();
$active_plugins_data = array();
$active_plugins_data = array();
foreach ( $active_plugins as $plugin ) {
foreach ( $active_valid_plugins as $plugin ) {
$data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$active_plugins_data[] = $this->format_plugin_data( $plugin, $data );
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* REST API Brands controller.
*
* Handles requests to /products/brands endpoint.
*
* Important: For internal use only by the Automattic\WooCommerce\Internal\Brands package.
*
* @package WooCommerce\RestApi
* @since 9.4.0
*/
declare( strict_types = 1);
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* REST API Brands controller class.
*
* @package WooCommerce\RestApi
* @extends WC_REST_Product_Categories_Controller
*/
class WC_REST_Product_Brands_Controller extends WC_REST_Product_Categories_Controller {
/**
* Route base.
*
* @var string
*/
protected $rest_base = 'products/brands';
/**
* Taxonomy.
*
* @var string
*/
protected $taxonomy = 'product_brand';
}

View File

@@ -1065,7 +1065,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
}
/**
* Get the reivew, if the ID is valid.
* Get the review, if the ID is valid.
*
* @since 3.5.0
* @param int $id Supplied ID.

View File

@@ -53,7 +53,7 @@ class WC_REST_Product_Shipping_Classes_Controller extends WC_REST_Product_Shippi
}
/**
* Callback fuction for the slug-suggestion endpoint.
* Callback function for the slug-suggestion endpoint.
*
* @param WP_REST_Request $request Full details about the request.
* @return string The suggested slug.

View File

@@ -446,7 +446,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V
if ( is_wp_error( $upload ) ) {
/**
* Filter to check if it should supress the image upload error, false by default.
* Filter to check if it should suppress the image upload error, false by default.
*
* @since 4.5.0
* @param bool false If it should suppress.

View File

@@ -232,7 +232,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller {
}
if ( wc_product_sku_enabled() ) {
// Do a partial match for a sku. Supercedes sku parameter that does exact matching.
// Do a partial match for a sku. Supersedes sku parameter that does exact matching.
if ( ! empty( $request['search_sku'] ) ) {
// Store this for use in the query clause filters.
$this->search_sku_in_product_lookup_table = $request['search_sku'];
@@ -259,6 +259,18 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller {
}
}
if ( ! empty( $request['global_unique_id'] ) ) {
$global_unique_ids = array_map( 'trim', explode( ',', $request['global_unique_id'] ) );
$args['meta_query'] = $this->add_meta_query( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
$args,
array(
'key' => '_global_unique_id',
'value' => $global_unique_ids,
'compare' => 'IN',
)
);
}
// Filter by tax class.
if ( ! empty( $request['tax_class'] ) ) {
$args['meta_query'] = $this->add_meta_query( // WPCS: slow query ok.