Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upgrade script to fix missing Pronamic subscription IDs in WooCommerce subscription meta #12

Merged
merged 41 commits into from
Sep 19, 2022

Conversation

rvdsteege
Copy link
Member

This PR aims to resolve issue #11, by adding an upgrade script which adds the pronamic_subscription_id meta to WooCommerce subscriptions not having this meta.

@rvdsteege rvdsteege requested a review from remcotolsma August 22, 2022 12:19
@rvdsteege rvdsteege self-assigned this Aug 22, 2022
@rvdsteege rvdsteege added the bug label Aug 22, 2022
@rvdsteege rvdsteege linked an issue Aug 22, 2022 that may be closed by this pull request
@remcotolsma
Copy link
Member

@rvdsteege I reverted pronamic/wp-pay-core@9a75a8d in pronamic/wp-pay-core@3512f88, because we can't use the class QueryActionsScheduler more widely for now, it is a bit of a YAGNI case. I tried to marge this back in 4f1f491, but have not tested this yet. We also spoke about this code:

/**
* On admin initialize we mark the upgrades as executable. This needs to run before
* the `wp-pay/core` admin init install routine (priority 5).
*
* @link https://github.com/wp-pay/core/blob/2.2.0/src/Admin/Install.php#L65
*/
add_action( 'admin_init', [ $this, 'admin_init_upgrades_executable' ], 4 );

/**
* Upgrades are only executable when no Restrict Content Pro upgrade is needed.
*
* @return void
*/
public function admin_init_upgrades_executable() {
$executable = function_exists( '\wcs_get_subscription' );
$this->get_upgrades()->set_executable( $executable );
}

That requires some adjustments?

And this:

public function process_action( string $post_id ) : void {
// Delete action ID post meta.
$action_id_meta_key = sprintf( 'pronamic_pay_scheduler_%s_action_id', 'woocommerce_upgrade_4_2_0' );
\delete_post_meta( (int) $post_id, $action_id_meta_key );

Delete action ID should be done afterwards?

@rvdsteege
Copy link
Member Author

That (upgrades executable) requires some adjustments?

Updated in 4a4a689.

Delete action ID should be done afterwards?

Updated in ae4a27f.

@rvdsteege rvdsteege merged commit 6e6b3cc into develop Sep 19, 2022
@rvdsteege rvdsteege deleted the 11-upgrade-420-subscription-id-meta branch September 19, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WooCommerce subscriptions missing _pronamic_subscription_id meta
2 participants