diff --git a/htdocs/wp-content/themes/hollandskroon/src/Commands/PronamicIdealCleanupCommand.php b/htdocs/wp-content/themes/hollandskroon/src/Commands/PronamicIdealCleanupCommand.php new file mode 100644 index 0000000..31095ad --- /dev/null +++ b/htdocs/wp-content/themes/hollandskroon/src/Commands/PronamicIdealCleanupCommand.php @@ -0,0 +1,46 @@ + 'pronamic_payment', + 'post_status' => 'payment_completed', + 'posts_per_page' => $postsPerPage, + 'paged' => $paged, + 'date_query' => [ + 'before' => '5 days ago', + ], + ]); + + if (!$payments->have_posts()) { + WP_CLI::success('No fulfilled payments found to clean up.'); + } + + foreach ($payments->posts as $payment) { + if (!wp_delete_post($payment->ID, true)) { + WP_CLI::warning('Failed to delete post with ID: ' . $payment->ID); + } + } + + $paged++; + } while ($payments->have_posts()); + + WP_CLI::success('Pronamic fulfilled payments cleaned up successfully.'); + } +} \ No newline at end of file diff --git a/htdocs/wp-content/themes/hollandskroon/src/Providers/CommandServiceProvider.php b/htdocs/wp-content/themes/hollandskroon/src/Providers/CommandServiceProvider.php new file mode 100644 index 0000000..737d7ed --- /dev/null +++ b/htdocs/wp-content/themes/hollandskroon/src/Providers/CommandServiceProvider.php @@ -0,0 +1,20 @@ +