Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 43a02e7

Browse files
brucealdridgemattallanwjrosa
authored
Deprecate upgrade scripts for versions before version 3 (#163)
* Deprecate upgrad scripts for versions before subscriptions version 3 * fix missing deprecation * Add changelog entry * Replace x.x.x with correct deprecated versions * Show notice based on the DB subscriptions version not the installed version * Update changelog entry * Move all deprecated functions to the bottom of the file * Move all deprecated variables into a group * Fix whitespace --------- Co-authored-by: mattallan <[email protected]> Co-authored-by: Wesley Rosa <[email protected]>
1 parent b7228b5 commit 43a02e7

18 files changed

+308
-297
lines changed

assets/js/wcs-upgrade.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @deprecated subscriptions-core 7.7.0 This file is no longer in use and can be removed in future.
3+
*/
14
jQuery( function ( $ ) {
25
var upgrade_start_time = null,
36
total_subscriptions = wcs_update_script_data.subscription_count;

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
*** WooCommerce Subscriptions Core Changelog ***
22

33
= 7.7.0 - xxxx-xx-xx =
4-
* Dev - Update `get_post_meta()` calls to fetch product meta using CRUD getters.
54
* Fix - Prevent adding products to the cart if a subscription renewal is already present.
65
* Update - Improved performance of wcs_get_subscription() when querying by product and customer or order.
76
* Update - Improved performance when checking limited subscription product availability.
7+
* Update - Deprecate upgrading from versions of WooCommerce Subscriptions prior to 3.0.0 (released Jan 2020).
88
* Dev - Minor refactoring of `init` method in `WC_Subscriptions_Upgrader` class.
99
* Dev - Introduce the filter `woocommerce_subscriptions_synced_first_renewal_payment_timestamp` to enable plugins to modify the first renewal date of synced subscriptions.
10+
* Dev - Update `get_post_meta()` calls to fetch product meta using CRUD getters.
1011

1112
= 7.6.0 - 2024-10-14 =
1213
* Fix - Correctly updates a subscription status to `cancelled` during a payment failure call when the current status is `pending-cancel`.

includes/upgrades/class-wc-subscriptions-upgrader.php

Lines changed: 254 additions & 292 deletions
Large diffs are not rendered by default.

includes/upgrades/class-wcs-repair-2-0-2.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
exit; // Exit if accessed directly
1313
}
1414

15+
/**
16+
* @deprecated
17+
*/
1518
class WCS_Repair_2_0_2 {
1619

1720
/**

includes/upgrades/class-wcs-repair-2-0.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
exit; // Exit if accessed directly
1313
}
1414

15+
/**
16+
* @deprecated
17+
*/
1518
class WCS_Repair_2_0 {
1619

1720
/**

includes/upgrades/class-wcs-repair-line-item-has-trial-meta.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
exit;
2323
}
2424

25+
/**
26+
* @deprecated
27+
*/
2528
class WCS_Repair_Line_Item_Has_Trial_Meta extends WCS_Background_Repairer {
2629

2730
/**

includes/upgrades/class-wcs-repair-start-date-metadata.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
exit;
1414
}
1515

16+
/**
17+
* @deprecated
18+
*/
1619
class WCS_Repair_Start_Date_Metadata extends WCS_Background_Upgrader {
1720

1821
/**

includes/upgrades/class-wcs-repair-subscription-address-indexes.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
exit;
1717
}
1818

19+
/**
20+
* @deprecated
21+
*/
1922
class WCS_Repair_Subscription_Address_Indexes extends WCS_Background_Upgrader {
2023

2124
/**

includes/upgrades/class-wcs-repair-suspended-paypal-subscriptions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
exit;
2020
}
2121

22+
/**
23+
* @deprecated
24+
*/
2225
class WCS_Repair_Suspended_PayPal_Subscriptions extends WCS_Background_Upgrader {
2326

2427
/**

includes/upgrades/class-wcs-upgrade-1-2.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
exit; // Exit if accessed directly
2121
}
2222

23+
/**
24+
* @deprecated subscriptions-core 7.7.0
25+
*/
2326
class WCS_Upgrade_1_2 {
2427

2528
public static function init() {
2629
global $wpdb;
30+
wcs_deprecated_function( __METHOD__, 'subscriptions-core 7.7.0' );
2731

2832
// Get IDs only and use a direct DB query for efficiency
2933
$orders_to_upgrade = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type = 'shop_order' AND post_parent = 0" );

includes/upgrades/class-wcs-upgrade-1-3.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
if ( ! defined( 'ABSPATH' ) ) {
1515
exit; // Exit if accessed directly
1616
}
17-
17+
/**
18+
* @deprecated subscription-core 7.7.0
19+
*/
1820
class WCS_Upgrade_1_3 {
1921

2022
public static function init() {
23+
wcs_deprecated_function( __METHOD__, 'subscriptions-core 7.7.0' );
2124
global $wpdb;
2225

2326
// Change transient timeout entries to be a vanilla option

includes/upgrades/class-wcs-upgrade-1-4.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
exit; // Exit if accessed directly
1515
}
1616

17+
/**
18+
* @deprecated subscriptions-core 7.7.0
19+
*/
1720
class WCS_Upgrade_1_4 {
1821

1922
private static $last_upgraded_user_id = false;
2023

2124
public static function init() {
22-
25+
wcs_deprecated_function( __METHOD__, 'subscriptions-core 7.7.0' );
2326
global $wpdb;
2427

2528
$subscriptions_meta_key = $wpdb->get_blog_prefix() . 'woocommerce_subscriptions';
@@ -166,11 +169,11 @@ public static function init() {
166169
*
167170
* Needs to be a separate function so that it can use a static variable (and therefore avoid calling get_option() thousands
168171
* of times when iterating over thousands of users).
169-
*
170172
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4
173+
* @deprecated subscriptions-core 7.7.0
171174
*/
172175
public static function is_user_upgraded( $user_id ) {
173-
176+
wcs_deprecated_function( __METHOD__, 'subscriptions-core 7.7.0' );
174177
if ( false === self::$last_upgraded_user_id ) {
175178
self::$last_upgraded_user_id = get_option( 'wcs_1_4_last_upgraded_user_id', 0 );
176179
}

includes/upgrades/class-wcs-upgrade-1-5.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class WCS_Upgrade_1_5 {
2020
* Subscriptions 1.5 made it possible for a product to be sold individually or in multiple quantities, whereas
2121
* previously it was possible only to buy a subscription product in a single quantity.
2222
*
23+
* @deprecated
2324
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0
2425
*/
2526
public static function upgrade_products() {
@@ -54,6 +55,7 @@ public static function upgrade_products() {
5455
/**
5556
* Update subscription WP-Cron tasks to Action Scheduler.
5657
*
58+
* @deprecated
5759
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0
5860
*/
5961
public static function upgrade_hooks( $number_hooks_to_upgrade ) {

includes/upgrades/class-wcs-upgrade-2-0.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
exit; // Exit if accessed directly
1313
}
1414

15+
/**
16+
* @deprecated
17+
*/
1518
class WCS_Upgrade_2_0 {
1619

1720
/* Cache of order item meta keys that were used to store subscription data in v1.5 */

includes/upgrades/class-wcs-upgrade-2-1.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
exit; // Exit if accessed directly
1313
}
1414

15+
/**
16+
* @deprecated
17+
*/
1518
class WCS_Upgrade_2_1 {
1619

1720
/**

includes/upgrades/class-wcs-upgrade-2-2-7.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
exit; // Exit if accessed directly
1313
}
1414

15+
/**
16+
* @deprecated
17+
*/
1518
class WCS_Upgrade_2_2_7 {
1619

1720
private static $cron_hook = 'wcs_repair_end_of_prepaid_term_actions';

includes/upgrades/class-wcs-upgrade-2-2-9.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
exit; // Exit if accessed directly
1414
}
1515

16+
/**
17+
* @deprecated
18+
*/
1619
class WCS_Upgrade_2_2_9 {
1720

1821
private static $cron_hook = 'wcs_repair_subscriptions_containing_synced_variations';

includes/upgrades/class-wcs-upgrade-subscription-post-author.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
exit; // Exit if accessed directly
1414
}
1515

16+
/**
17+
* @deprecated
18+
*/
1619
class WCS_Upgrade_Subscription_Post_Author extends WCS_Background_Upgrader {
1720

1821
/**

0 commit comments

Comments
 (0)