rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -39,7 +39,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
/**
* Duration to milisecond mapping.
*
* @var string
* @var array
*/
protected $duration_to_ms = array(
'day' => DAY_IN_SECONDS * 1000,
@@ -295,10 +295,14 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
/**
* Check if a given request has access to manage woocommerce.
*
* @deprecated 7.8.0 snooze task is deprecated.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function snooze_task_permissions_check( $request ) {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.8.0' );
if ( ! current_user_can( 'manage_woocommerce' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to snooze onboarding tasks.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
}
@@ -355,7 +359,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
* @return WP_REST_Response|WP_Error
*/
public static function create_product_from_template( $request ) {
$template_name = $request->get_param( 'template_name' );
$template_name = basename( $request->get_param( 'template_name' ) );
$template_path = __DIR__ . '/Templates/' . $template_name . '_product.csv';
$template_path = apply_filters( 'woocommerce_product_template_csv_file_path', $template_path, $template_name );
@@ -758,6 +762,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task && $id ) {
$task = new DeprecatedExtendedTask(
null,
array(
'id' => $id,
'is_dismissable' => true,
@@ -791,6 +796,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task && $id ) {
$task = new DeprecatedExtendedTask(
null,
array(
'id' => $id,
'is_dismissable' => true,
@@ -816,11 +822,15 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
/**
* Snooze an onboarding task.
*
* @deprecated 7.8.0 snooze task is deprecated.
*
* @param WP_REST_Request $request Request data.
*
* @return WP_REST_Response|WP_Error
*/
public function snooze_task( $request ) {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.8.0' );
$task_id = $request->get_param( 'id' );
$task_list_id = $request->get_param( 'task_list_id' );
$duration = $request->get_param( 'duration' );
@@ -829,6 +839,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task && $task_id ) {
$task = new DeprecatedExtendedTask(
null,
array(
'id' => $task_id,
'is_snoozeable' => true,
@@ -853,15 +864,20 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
/**
* Undo snooze of a single task.
*
* @deprecated 7.8.0 undo snooze task is deprecated.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Request|WP_Error
*/
public function undo_snooze_task( $request ) {
wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.8.0' );
$id = $request->get_param( 'id' );
$task = TaskLists::get_task( $id );
if ( ! $task && $id ) {
$task = new DeprecatedExtendedTask(
null,
array(
'id' => $id,
'is_snoozeable' => true,
@@ -949,6 +965,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task && $id ) {
$task = new DeprecatedExtendedTask(
null,
array(
'id' => $id,
)