diff --git a/admin/Analytics/Rest_API/Conversions/Stats/Controller.php b/admin/Analytics/Rest_API/Conversions/Stats/Controller.php index 50fc290..9b4c863 100644 --- a/admin/Analytics/Rest_API/Conversions/Stats/Controller.php +++ b/admin/Analytics/Rest_API/Conversions/Stats/Controller.php @@ -71,6 +71,6 @@ public function get_item_schema() { $schema = parent::get_item_schema(); $schema['title'] = 'report_conversions_stats'; - return $schema; + return $this->add_additional_fields_schema( $schema ); } } diff --git a/admin/Analytics/Rest_API/Conversions/Stats/Store.php b/admin/Analytics/Rest_API/Conversions/Stats/Store.php index 6ad7fd5..d08323e 100644 --- a/admin/Analytics/Rest_API/Conversions/Stats/Store.php +++ b/admin/Analytics/Rest_API/Conversions/Stats/Store.php @@ -125,7 +125,7 @@ protected function update_sql_query_params( $query_args ) { * @param int $expected_interval_count Number of expected intervals. * @return stdClass|WP_Error Data object `{ totals: *, intervals: array, total: int, pages: int, page_no: int }`, or error. */ - public function get_noncached_data( $query_args, $params, &$data, $expected_interval_count ) { + public function get_noncached_stats_data( $query_args, $params, &$data, $expected_interval_count ) { global $wpdb; $table_name = self::get_db_table_name(); diff --git a/admin/Analytics/Rest_API/Email_Tracking/Stats_Controller.php b/admin/Analytics/Rest_API/Email_Tracking/Stats_Controller.php index 5b9c6f4..bfb7784 100644 --- a/admin/Analytics/Rest_API/Email_Tracking/Stats_Controller.php +++ b/admin/Analytics/Rest_API/Email_Tracking/Stats_Controller.php @@ -73,6 +73,6 @@ public function get_item_schema() { $schema = parent::get_item_schema(); $schema['title'] = 'report_email_tracking_stats'; - return $schema; + return $this->add_additional_fields_schema( $schema ); } } diff --git a/admin/Analytics/Rest_API/Email_Tracking/Stats_Store.php b/admin/Analytics/Rest_API/Email_Tracking/Stats_Store.php index 2c9f88a..60c4dd2 100644 --- a/admin/Analytics/Rest_API/Email_Tracking/Stats_Store.php +++ b/admin/Analytics/Rest_API/Email_Tracking/Stats_Store.php @@ -97,7 +97,7 @@ protected function selected_totals( $query_args, $totals ) { * Returns the report data based on normalized parameters. * Will be called by `get_data` if there is no data in cache. * - * @overwrites Log_Stats_Store::get_noncached_data + * @overwrites Log_Stats_Store::get_noncached_stats_data * @see get_data * @param array $query_args Query parameters. * @param array $params Query limit parameters. @@ -105,7 +105,7 @@ protected function selected_totals( $query_args, $totals ) { * @param int $expected_interval_count Number of expected intervals. * @return stdClass|WP_Error Data object `{ totals: *, intervals: array, total: int, pages: int, page_no: int }`, or error. */ - public function get_noncached_data( $query_args, $params, &$data, $expected_interval_count ) { + public function get_noncached_stats_data( $query_args, $params, &$data, $expected_interval_count ) { global $wpdb; $table_name = self::get_db_table_name(); diff --git a/admin/Analytics/Rest_API/Log_Stats_Controller.php b/admin/Analytics/Rest_API/Log_Stats_Controller.php index 42545f6..585f02b 100644 --- a/admin/Analytics/Rest_API/Log_Stats_Controller.php +++ b/admin/Analytics/Rest_API/Log_Stats_Controller.php @@ -44,4 +44,14 @@ public function get_collection_params() { return $params; } + + /** + * Get the report's item properties schema. + * Will be used by `get_item_schema` as `totals` and `subtotals`. + * + * @return array + */ + public function get_item_properties_schema() { + return array(); + } } diff --git a/admin/Analytics/Rest_API/Unsubscribers/Stats_Controller.php b/admin/Analytics/Rest_API/Unsubscribers/Stats_Controller.php index 242230a..de6aa48 100644 --- a/admin/Analytics/Rest_API/Unsubscribers/Stats_Controller.php +++ b/admin/Analytics/Rest_API/Unsubscribers/Stats_Controller.php @@ -55,6 +55,6 @@ public function get_item_schema() { $schema = parent::get_item_schema(); $schema['title'] = 'report_unsubscribers_stats'; - return $schema; + return $this->add_additional_fields_schema( $schema ); } } diff --git a/admin/Analytics/Rest_API/Unsubscribers/Stats_Store.php b/admin/Analytics/Rest_API/Unsubscribers/Stats_Store.php index e5dedd6..88fea02 100644 --- a/admin/Analytics/Rest_API/Unsubscribers/Stats_Store.php +++ b/admin/Analytics/Rest_API/Unsubscribers/Stats_Store.php @@ -79,7 +79,7 @@ protected function assign_report_columns() { * @param int $expected_interval_count Number of expected intervals. * @return stdClass|WP_Error Data object `{ totals: *, intervals: array, total: int, pages: int, page_no: int }`, or error. */ - public function get_noncached_data( $query_args, $params, &$data, $expected_interval_count ) { + public function get_noncached_stats_data( $query_args, $params, &$data, $expected_interval_count ) { global $wpdb; $table_name = self::get_db_table_name(); diff --git a/admin/Analytics/Rest_API/Upstream/Generic_Controller.php b/admin/Analytics/Rest_API/Upstream/Generic_Controller.php index 89e7845..448dc38 100644 --- a/admin/Analytics/Rest_API/Upstream/Generic_Controller.php +++ b/admin/Analytics/Rest_API/Upstream/Generic_Controller.php @@ -3,42 +3,31 @@ defined( 'ABSPATH' ) || exit; -use Automattic\WooCommerce\Admin\API\Reports\Query; +use Automattic\WooCommerce\Admin\API\Reports\GenericController as WCGenericController; use stdClass; -use WC_REST_Reports_Controller; use WP_REST_Request; use WP_REST_Response; /** * This is a generic class, to cover bits shared by all reports. * Discovered in https://github.com/woocommerce/automatewoo/pull/1226#pullrequestreview-1210449142 - * We may consider moving it eventually to `WC_REST_Reports_Controller`, + * We may consider moving it eventually to `Automattic\WooCommerce\Admin\API\Reports\GenericController`, * so the other extensions and WC itself could make use of it, and get DRYier. * https://github.com/woocommerce/automatewoo/issues/1238 * - * @extends WC_REST_Reports_Controller + * @extends WCGenericController */ -class Generic_Controller extends WC_REST_Reports_Controller { - - /** - * Endpoint namespace. - * - * Compatibility-code "WC <= 7.8" - * Once WC > 7.8 is out and covers our L-2, we can inherit this from `GenericController`. - * - * @var string - */ - protected $namespace = 'wc-analytics'; +class Generic_Controller extends WCGenericController { /** * Forwards a Query constructor, * to be able to customize Query class for a specific report. * * @param array $query_args Set of args to be forwarded to the constructor. - * @return Query + * @return Generic_Query */ protected function construct_query( $query_args ) { - return new Query( $query_args ); + return new Generic_Query( $query_args, $this->rest_base ); } /** @@ -51,7 +40,7 @@ protected function construct_query( $query_args ) { * @param WP_REST_Request $request Full request object. * @return array Simplified array of params. */ - protected function prepare_reports_query( $request ) { + public function prepare_reports_query( $request ) { $args = wp_parse_args( array_intersect_key( $request->get_query_params(), @@ -63,61 +52,9 @@ protected function prepare_reports_query( $request ) { return $args; } - /** - * Add pagination headers and links. - * - * Compatibility-code "WC <= 7.8" - * Once WC > 7.8 is out and covers our L-2, we can inherit this from `GenericController`. - * - * @param WP_REST_Request $request Request data. - * @param WP_REST_Response|array $response Response data. - * @param int $total Total results. - * @param int $page Current page. - * @param int $max_pages Total amount of pages. - * @return WP_REST_Response - */ - public function add_pagination_headers( $request, $response, int $total, int $page, int $max_pages ) { - $response = rest_ensure_response( $response ); - $response->header( 'X-WP-Total', $total ); - $response->header( 'X-WP-TotalPages', $max_pages ); - - // SEMGREP WARNING EXPLANATION - // URL is escaped. However, Semgrep only considers esc_url as valid. - $base = esc_url_raw( - add_query_arg( - $request->get_query_params(), - rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ) - ) - ); - - if ( $page > 1 ) { - $prev_page = $page - 1; - if ( $prev_page > $max_pages ) { - $prev_page = $max_pages; - } - // SEMGREP WARNING EXPLANATION - // URL is escaped. However, Semgrep only considers esc_url as valid. - $prev_link = esc_url_raw( add_query_arg( 'page', $prev_page, $base ) ); - $response->link_header( 'prev', $prev_link ); - } - - if ( $max_pages > $page ) { - $next_page = $page + 1; - // SEMGREP WARNING EXPLANATION - // URL is escaped. However, Semgrep only considers esc_url as valid. - $next_link = esc_url_raw( add_query_arg( 'page', $next_page, $base ) ); - $response->link_header( 'next', $next_link ); - } - - return $response; - } - /** * Prepare a report object for serialization. * - * Compatibility-code "WC <= 7.8" - * Once WC > 7.8 is out and covers our L-2, we can inherit this from `GenericController`. - * * @param stdClass $report Report data. * @param WP_REST_Request $request Request object. * @return WP_REST_Response @@ -125,14 +62,7 @@ public function add_pagination_headers( $request, $response, int $total, int $pa public function prepare_item_for_response( $report, $request ) { $data = get_object_vars( $report ); - $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; - $data = $this->add_additional_fields_to_object( $data, $request ); - $data = $this->filter_response_by_context( $data, $context ); - - // Wrap the data in a response object. - $response = rest_ensure_response( $data ); - - return $response; + return parent::prepare_item_for_response( $data, $request ); } /** @@ -141,9 +71,6 @@ public function prepare_item_for_response( $report, $request ) { * * To be extended by specific report properites. * - * Compatibility-code "WC <= 7.8" - * Once WC > 7.8 is out and covers our L-2, we can inherit this from `GenericController`. - * * @return array */ public function get_item_properties_schema() { @@ -160,70 +87,4 @@ public function get_item_properties_schema() { public function get_item_schema() { return $this->add_additional_fields_schema( array() ); } - - /** - * Get the query params for collections. - * - * Compatibility-code "WC <= 7.8" - * Once WC > 7.8 is out and covers our L-2, we can inherit this from `GenericController`. - * - * @return array - */ - public function get_collection_params() { - $params = array(); - $params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); - $params['page'] = array( - 'description' => __( 'Current page of the collection.', 'automatewoo' ), - 'type' => 'integer', - 'default' => 1, - 'sanitize_callback' => 'absint', - 'validate_callback' => 'rest_validate_request_arg', - 'minimum' => 1, - ); - $params['per_page'] = array( - 'description' => __( 'Maximum number of items to be returned in result set.', 'automatewoo' ), - 'type' => 'integer', - 'default' => 10, - 'minimum' => 1, - 'maximum' => 100, - 'sanitize_callback' => 'absint', - 'validate_callback' => 'rest_validate_request_arg', - ); - $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'automatewoo' ), - 'type' => 'string', - 'format' => 'date-time', - 'validate_callback' => 'rest_validate_request_arg', - ); - $params['before'] = array( - 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'automatewoo' ), - 'type' => 'string', - 'format' => 'date-time', - 'validate_callback' => 'rest_validate_request_arg', - ); - $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'automatewoo' ), - 'type' => 'string', - 'default' => 'desc', - 'enum' => array( 'asc', 'desc' ), - 'validate_callback' => 'rest_validate_request_arg', - ); - $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'automatewoo' ), - 'type' => 'string', - 'default' => 'date', - 'enum' => array( - 'date', - ), - 'validate_callback' => 'rest_validate_request_arg', - ); - $params['force_cache_refresh'] = array( - 'description' => __( 'Force retrieval of fresh data instead of from the cache.', 'automatewoo' ), - 'type' => 'boolean', - 'sanitize_callback' => 'wp_validate_boolean', - 'validate_callback' => 'rest_validate_request_arg', - ); - - return $params; - } } diff --git a/admin/Analytics/Rest_API/Upstream/Generic_Query.php b/admin/Analytics/Rest_API/Upstream/Generic_Query.php index d1f6f5e..8978bba 100644 --- a/admin/Analytics/Rest_API/Upstream/Generic_Query.php +++ b/admin/Analytics/Rest_API/Upstream/Generic_Query.php @@ -26,7 +26,7 @@ * @see Automattic\WooCommerce\Admin\API\Reports\Query * @since 5.6.9 */ -class Generic_Query extends WooReportsQuery { +class Generic_Query extends \WC_Object_Query { /** * Store name @@ -45,7 +45,7 @@ class Generic_Query extends WooReportsQuery { public function __construct( $args, $store_name ) { $this->store_name = $store_name; - return parent::__construct( $args ); // phpcs:ignore Universal.CodeAnalysis.ConstructorDestructorReturn.ReturnValueFound + parent::__construct( $args ); } /** * Valid fields for Products report. diff --git a/admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php b/admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php index 6d83cda..88925a1 100644 --- a/admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php +++ b/admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php @@ -3,6 +3,8 @@ defined( 'ABSPATH' ) || exit; + +use Automattic\WooCommerce\Admin\API\Reports\GenericStatsController as WCGenericStatsController; use Automattic\WooCommerce\Admin\API\Reports\ParameterException; use WP_Error; use WP_REST_Request; @@ -11,11 +13,11 @@ /** * This is a generic class, to cover bits shared by all reports. * Discovered in https://github.com/woocommerce/automatewoo/pull/1226#pullrequestreview-1210449142 - * We may consider moving it eventually to `WC_REST_Reports_Controller`, + * We may consider moving it eventually to `Automattic\WooCommerce\Admin\API\Reports\GenericStatsController`, * so the other extensions and WC itself could make use of it, and get DRYier. * https://github.com/woocommerce/automatewoo/issues/1238 */ -class Generic_Stats_Controller extends Generic_Controller { +abstract class Generic_Stats_Controller extends WCGenericStatsController { /** * Get all reports. @@ -51,117 +53,6 @@ public function get_items( $request ) { ); } - /** - * Get the Report's schema, conforming to JSON Schema. - * - * Compatibility-code "WC<=7.8" - * Once WC > 7.8 is out and covers our L-2, we can inherit this from `GenericController`. - * - * @return array - */ - public function get_item_schema() { - $data_values = $this->get_item_properties_schema(); - - $segments = array( - 'segments' => array( - 'description' => __( 'Reports data grouped by segment condition.', 'automatewoo' ), - 'type' => 'array', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - 'items' => array( - 'type' => 'object', - 'properties' => array( - 'segment_id' => array( - 'description' => __( 'Segment identificator.', 'automatewoo' ), - 'type' => 'integer', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - ), - 'subtotals' => array( - 'description' => __( 'Interval subtotals.', 'automatewoo' ), - 'type' => 'object', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - 'properties' => $data_values, - ), - ), - ), - ), - ); - - $totals = array_merge( $data_values, $segments ); - - $schema = array( - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'report_stats', - 'type' => 'object', - 'properties' => array( - 'totals' => array( - 'description' => __( 'Totals data.', 'automatewoo' ), - 'type' => 'object', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - 'properties' => $totals, - ), - 'intervals' => array( - 'description' => __( 'Reports data grouped by intervals.', 'automatewoo' ), - 'type' => 'array', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - 'items' => array( - 'type' => 'object', - 'properties' => array( - 'interval' => array( - 'description' => __( 'Type of interval.', 'automatewoo' ), - 'type' => 'string', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - 'enum' => array( 'day', 'week', 'month', 'year' ), - ), - 'date_start' => array( - 'description' => __( "The date the report start, in the site's timezone.", 'automatewoo' ), - 'type' => 'string', - 'format' => 'date-time', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - ), - 'date_start_gmt' => array( - 'description' => __( 'The date the report start, as GMT.', 'automatewoo' ), - 'type' => 'string', - 'format' => 'date-time', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - ), - 'date_end' => array( - 'description' => __( "The date the report end, in the site's timezone.", 'automatewoo' ), - 'type' => 'string', - 'format' => 'date-time', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - ), - 'date_end_gmt' => array( - 'description' => __( 'The date the report end, as GMT.', 'automatewoo' ), - 'type' => 'string', - 'format' => 'date-time', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - ), - 'subtotals' => array( - 'description' => __( 'Interval subtotals.', 'automatewoo' ), - 'type' => 'object', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - 'properties' => $totals, - ), - ), - ), - ), - ), - ); - - return $this->add_additional_fields_schema( $schema ); - } - /** * Get the query params for collections. * @@ -178,29 +69,12 @@ public function get_item_schema() { * ); * ``` * - * Compatibility-code "WC< - * Once WC > 7.8 is out and covers our L-2, we can inherit this from `GenericController`. - * * @return array */ public function get_collection_params() { $params = parent::get_collection_params(); - $params['interval'] = array( - 'description' => __( 'Time interval to use for buckets in the returned data.', 'automatewoo' ), - 'type' => 'string', - 'default' => 'week', - 'enum' => array( - 'hour', - 'day', - 'week', - 'month', - 'quarter', - 'year', - ), - 'validate_callback' => 'rest_validate_request_arg', - ); - $params['fields'] = array( + $params['fields'] = array( 'description' => __( 'Limit stats fields to the specified items.', 'automatewoo' ), 'type' => 'array', 'sanitize_callback' => 'wp_parse_slug_list', @@ -212,4 +86,50 @@ public function get_collection_params() { return $params; } + + /** + * Forwards a Query constructor, + * to be able to customize Query class for a specific report. + * + * @param array $query_args Set of args to be forwarded to the constructor. + * @return Generic_Query + */ + protected function construct_query( $query_args ) { + return new Generic_Query( $query_args, $this->rest_base ); + } + + /** + * Maps query arguments from the REST request. + * + * `WP_REST_Request` does not expose a method to return all params covering defaults, + * as it does for `$request['param']` accessor. + * Therefore, we re-implement defaults resolution. + * + * @param WP_REST_Request $request Full request object. + * @return array Simplified array of params. + */ + public function prepare_reports_query( $request ) { + $args = wp_parse_args( + array_intersect_key( + $request->get_query_params(), + $this->get_collection_params() + ), + $request->get_default_params() + ); + + return $args; + } + + /** + * Prepare a report object for serialization. + * + * @param stdClass $report Report data. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response + */ + public function prepare_item_for_response( $report, $request ) { + $data = get_object_vars( $report ); + + return parent::prepare_item_for_response( $data, $request ); + } } diff --git a/admin/Analytics/Rest_API/Upstream/Generic_Stats_Store.php b/admin/Analytics/Rest_API/Upstream/Generic_Stats_Store.php index 020b76a..1cc68c0 100644 --- a/admin/Analytics/Rest_API/Upstream/Generic_Stats_Store.php +++ b/admin/Analytics/Rest_API/Upstream/Generic_Stats_Store.php @@ -25,7 +25,7 @@ * @extends Reports_Data_Store * @version 5.6.8 */ -abstract class Generic_Stats_Store extends Reports_Data_Store { +class Generic_Stats_Store extends Reports_Data_Store { /** * Report columns. @@ -50,9 +50,9 @@ protected function update_sql_query_params( $query_args ) { /** * Returns the report data based on parameters supplied by the user. - * Fetches it from cache or returns `get_noncached_data` result. + * Fetches it from cache or returns `get_noncached_stats_data` result. * - * @see get_noncached_data + * @see get_noncached_stats_data * @param array $query_args Query parameters. * @return stdClass|WP_Error Data object `{ totals: *, intervals: array, total: int, pages: int, page_no: int }`, or error. */ @@ -94,7 +94,7 @@ public function get_data( $query_args ) { // If the requested page is out off range, return the deault empty object. if ( $query_args['page'] >= 1 && $query_args['page'] <= $total_pages ) { // Fetch the actual data. - $data = $this->get_noncached_data( $query_args, $params, $data, $expected_interval_count ); + $data = $this->get_noncached_stats_data( $query_args, $params, $data, $expected_interval_count ); } $this->set_cached_data( $cache_key, $data ); } @@ -113,22 +113,12 @@ public function get_data( $query_args ) { * @param int $expected_interval_count Number of expected intervals. * @return stdClass|WP_Error Data object `{ totals: *, intervals: array, total: int, pages: int, page_no: int }`, or error. */ - abstract public function get_noncached_data( $query_args, $params, &$data, $expected_interval_count ); - - /** - * Normalizes order_by clause to match to SQL query. - * - * @param string $order_by Order by option requested by user. - * @return string - */ - protected function normalize_order_by( $order_by ) { - if ( 'date' === $order_by ) { - return 'time_interval'; - } - - return $order_by; + public function get_noncached_stats_data( $query_args, $params, &$data, $expected_interval_count ) { + /* translators: %s: Method name */ + return new \WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'automatewoo' ), __METHOD__ ), array( 'status' => 405 ) ); } + /** * Initialize query objects. */ diff --git a/admin/Analytics/Rest_API/Workflow_Runs/Stats_Controller.php b/admin/Analytics/Rest_API/Workflow_Runs/Stats_Controller.php index 517dad4..f48aade 100644 --- a/admin/Analytics/Rest_API/Workflow_Runs/Stats_Controller.php +++ b/admin/Analytics/Rest_API/Workflow_Runs/Stats_Controller.php @@ -57,6 +57,6 @@ public function get_item_schema() { $schema = parent::get_item_schema(); $schema['title'] = 'report_workflow_runs_stats'; - return $schema; + return $this->add_additional_fields_schema( $schema ); } } diff --git a/admin/Analytics/Rest_API/Workflow_Runs/Stats_Store.php b/admin/Analytics/Rest_API/Workflow_Runs/Stats_Store.php index 7549a3a..c1a195a 100644 --- a/admin/Analytics/Rest_API/Workflow_Runs/Stats_Store.php +++ b/admin/Analytics/Rest_API/Workflow_Runs/Stats_Store.php @@ -66,7 +66,7 @@ protected function assign_report_columns() { * @param int $expected_interval_count Number of expected intervals. * @return stdClass|WP_Error Data object `{ totals: *, intervals: array, total: int, pages: int, page_no: int }`, or error. */ - public function get_noncached_data( $query_args, $params, &$data, $expected_interval_count ) { + public function get_noncached_stats_data( $query_args, $params, &$data, $expected_interval_count ) { global $wpdb; $table_name = self::get_db_table_name(); diff --git a/automatewoo.php b/automatewoo.php index 02f05c0..9076ade 100644 --- a/automatewoo.php +++ b/automatewoo.php @@ -3,7 +3,7 @@ * Plugin Name: AutomateWoo * Plugin URI: https://automatewoo.com * Description: Powerful marketing automation for your WooCommerce store. - * Version: 6.0.32 + * Version: 6.0.33 * Author: WooCommerce * Author URI: https://woocommerce.com * License: GPLv3 @@ -12,7 +12,7 @@ * Domain Path: /languages * Tested up to: 6.6 * Requires Plugins: woocommerce - * WC requires at least: 6.7 + * WC requires at least: 7.9 * WC tested up to: 9.2.0 * Woo: 4652610:f6f1f8a56a16a3715b30b21fb557e78f * @@ -37,14 +37,12 @@ defined( 'ABSPATH' ) || exit; define( 'AUTOMATEWOO_SLUG', 'automatewoo' ); -define( 'AUTOMATEWOO_VERSION', '6.0.32' ); // WRCS: DEFINED_VERSION. +define( 'AUTOMATEWOO_VERSION', '6.0.33' ); // WRCS: DEFINED_VERSION. define( 'AUTOMATEWOO_FILE', __FILE__ ); define( 'AUTOMATEWOO_PATH', __DIR__ ); define( 'AUTOMATEWOO_MIN_PHP_VER', '7.4.0' ); define( 'AUTOMATEWOO_MIN_WP_VER', '5.9' ); -// IMPORTANT: If AUTOMATEWOO_MIN_WC_VER is updated, AW Refer a friend (PHP Unit Tests) should be updated accordingly -// See https://github.com/woocommerce/automatewoo-referrals/blob/684a6d7f1e33359553b3b681b32cb4bad8d53089/.github/workflows/php-unit-tests.yml#L34-L40 -define( 'AUTOMATEWOO_MIN_WC_VER', '6.7.0' ); +define( 'AUTOMATEWOO_MIN_WC_VER', '7.9.0' ); /** * AutomateWoo loader. diff --git a/changelog.txt b/changelog.txt index 9879b76..4d15c8c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** AutomateWoo Changelog *** +2024-08-28 - version 6.0.33 +* Bump min WC version to 7.9, reuse upstreamed classes. + 2024-08-14 - version 6.0.32 * Tweak - WC 9.2.0 compatibility. diff --git a/languages/automatewoo.pot b/languages/automatewoo.pot index 714d864..a00e926 100644 --- a/languages/automatewoo.pot +++ b/languages/automatewoo.pot @@ -2,14 +2,14 @@ # This file is distributed under the GPLv3. msgid "" msgstr "" -"Project-Id-Version: AutomateWoo 6.0.32\n" +"Project-Id-Version: AutomateWoo 6.0.33\n" "Report-Msgid-Bugs-To: https://woocommerce.com/my-account/contact-support/\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-08-14T09:48:05+00:00\n" +"POT-Creation-Date: 2024-08-28T01:06:16+02:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.7.1\n" "X-Domain: automatewoo\n" @@ -22,7 +22,7 @@ msgstr "" #: admin/admin.php:825 #: admin/coupons-list.php:42 #: admin/WCAdminConnectPages.php:74 -#: automatewoo.php:131 +#: automatewoo.php:129 #: includes/Actions/Change_Workflow_Status.php:18 #: includes/Actions/Clear_Queued_Events.php:17 #: includes/Installer.php:248 @@ -325,83 +325,13 @@ msgstr "" msgid "Sorry, fetching unsubscribers data failed." msgstr "" -#: admin/Analytics/Rest_API/Upstream/Generic_Controller.php:176 -msgid "Current page of the collection." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Controller.php:184 -msgid "Maximum number of items to be returned in result set." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Controller.php:193 -#: includes/Rest_Api/Controllers/LogsController.php:120 -msgid "Limit response to resources published after a given ISO8601 compliant date." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Controller.php:199 -#: includes/Rest_Api/Controllers/LogsController.php:113 -msgid "Limit response to resources published before a given ISO8601 compliant date." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Controller.php:205 -msgid "Order sort attribute ascending or descending." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Controller.php:212 -msgid "Sort collection by object attribute." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Controller.php:221 -msgid "Force retrieval of fresh data instead of from the cache." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:67 -msgid "Reports data grouped by segment condition." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:75 -msgid "Segment identificator." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:81 -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:150 -msgid "Interval subtotals." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:100 -msgid "Totals data." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:107 -msgid "Reports data grouped by intervals." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:115 -msgid "Type of interval." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:122 -msgid "The date the report start, in the site's timezone." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:129 -msgid "The date the report start, as GMT." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:136 -msgid "The date the report end, in the site's timezone." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:143 -msgid "The date the report end, as GMT." -msgstr "" - -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:190 -msgid "Time interval to use for buckets in the returned data." +#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:78 +msgid "Limit stats fields to the specified items." msgstr "" -#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Controller.php:204 -msgid "Limit stats fields to the specified items." +#. translators: %s: Method name +#: admin/Analytics/Rest_API/Upstream/Generic_Stats_Store.php:118 +msgid "Method '%s' not implemented. Must be overridden in subclass." msgstr "" #: admin/Analytics/Rest_API/Workflow_Runs/Stats_Controller.php:44 @@ -2085,22 +2015,22 @@ msgid "Manual" msgstr "" #. translators: Plugin name. -#: automatewoo.php:131 +#: automatewoo.php:129 msgid "%s is inactive." msgstr "" #. translators: %1$s inactive plugin text, %2$s minimum PHP version -#: automatewoo.php:135 +#: automatewoo.php:133 msgid "%1$s The plugin requires PHP version %2$s or newer." msgstr "" #. translators: %1$s inactive plugin text, %2$s minimum WooCommerce version -#: automatewoo.php:139 +#: automatewoo.php:137 msgid "%1$s The plugin requires WooCommerce version %2$s or newer." msgstr "" #. translators: %1$s inactive plugin text, %2$s minimum WordPress version -#: automatewoo.php:143 +#: automatewoo.php:141 msgid "%1$s The plugin requires WordPress version %2$s or newer." msgstr "" @@ -4374,6 +4304,14 @@ msgstr "" msgid "Invalid order ID %d." msgstr "" +#: includes/Rest_Api/Controllers/LogsController.php:113 +msgid "Limit response to resources published before a given ISO8601 compliant date." +msgstr "" + +#: includes/Rest_Api/Controllers/LogsController.php:120 +msgid "Limit response to resources published after a given ISO8601 compliant date." +msgstr "" + #: includes/Rest_Api/Controllers/LogsController.php:127 msgid "Limit response to one or more customers." msgstr "" diff --git a/vendor/autoload.php b/vendor/autoload.php index 493831c..694a8b8 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitb21582d5c8d1591b02e040be331e600e::getLoader(); +return ComposerAutoloaderInit8627a5ab3f8a9ea83312cde1e87c7f42::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index c8dac72..6ee87e6 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitb21582d5c8d1591b02e040be331e600e +class ComposerAutoloaderInit8627a5ab3f8a9ea83312cde1e87c7f42 { private static $loader; @@ -24,12 +24,12 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitb21582d5c8d1591b02e040be331e600e', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit8627a5ab3f8a9ea83312cde1e87c7f42', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitb21582d5c8d1591b02e040be331e600e', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit8627a5ab3f8a9ea83312cde1e87c7f42', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitb21582d5c8d1591b02e040be331e600e::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit8627a5ab3f8a9ea83312cde1e87c7f42::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 75b03cc..2aa84bf 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitb21582d5c8d1591b02e040be331e600e +class ComposerStaticInit8627a5ab3f8a9ea83312cde1e87c7f42 { public static $prefixLengthsPsr4 = array ( 'A' => @@ -995,9 +995,9 @@ class ComposerStaticInitb21582d5c8d1591b02e040be331e600e public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitb21582d5c8d1591b02e040be331e600e::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitb21582d5c8d1591b02e040be331e600e::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitb21582d5c8d1591b02e040be331e600e::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit8627a5ab3f8a9ea83312cde1e87c7f42::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8627a5ab3f8a9ea83312cde1e87c7f42::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8627a5ab3f8a9ea83312cde1e87c7f42::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 4c46b00..bfc451c 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'woocommerce/automatewoo', - 'pretty_version' => 'dev-release/6.0.32', - 'version' => 'dev-release/6.0.32', - 'reference' => 'e165cf236d51f3c4e5ccc8e73141b5863e45b6c1', + 'pretty_version' => 'dev-release/6.0.33', + 'version' => 'dev-release/6.0.33', + 'reference' => '616d2c3f3a2864abb672a968723f45bcb15813b0', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,9 +11,9 @@ ), 'versions' => array( 'woocommerce/automatewoo' => array( - 'pretty_version' => 'dev-release/6.0.32', - 'version' => 'dev-release/6.0.32', - 'reference' => 'e165cf236d51f3c4e5ccc8e73141b5863e45b6c1', + 'pretty_version' => 'dev-release/6.0.33', + 'version' => 'dev-release/6.0.33', + 'reference' => '616d2c3f3a2864abb672a968723f45bcb15813b0', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(),