This PR fixes failing unit tests, updates the way we point users to the view a certain log file and deprecates cleaning up large log files as WC core now handles that functionality.
How to test this PR
Cron job
Install a plugin like WP Crontrol to view cron jobs.
Go to Tools > Cron events
Search for wcs_cleanup_big_logs and notice that job is still queued.
Checkout this branch and that should be updated to have no action attached to it.
Go into your database and search the options table for woocommerce_subscriptions_active_version.
Update that option to be 6.7.0 (minus 1 version).
This will just trigger the upgrade flow.
Notice that wcs_cleanup_big_logs is no longer listed.
Simulate a fatal error during a subscription scheduled action by deleting a subscription from the database and running it's payment action manually or update the scheduled action directly and alter the subscription ID arg so it isn't valid.
You should see the following notice:
On trunk clicking the WooCommerce logs screen link will send you to the logs screen but not to the files directly.
On this branch the logs table will only include failed-scheduled-actions files.
wcs-upgrade
I wasn't able to find a way to get this page to show easily so I verified that my changes in this PR correctly generated valid HTML using WP Console.
// Get the log file URL depending on the log handler (file or database).
$url = admin_url( sprintf( 'admin.php?page=wc-status&tab=logs&log_file=%s-%s-log', WCS_Upgrade_Logger::$handle, sanitize_file_name( wp_hash( WCS_Upgrade_Logger::$handle ) ) ) );
// In WC 8.6 the URL format changed to include the source parameter.
if ( ! wcs_is_woocommerce_pre( '8.6.0' ) ) {
$url = admin_url( sprintf( 'admin.php?page=wc-status&tab=logs&source=%s&paged=1', WCS_Upgrade_Logger::$handle ) );
}
// translators: $1: placeholder is number of weeks, 2$: path to the file
echo wp_kses_post( sprintf( __( 'To record the progress of the update a new log file was created. This file will be automatically deleted in %1$d weeks. If you would like to delete it sooner, you can find it in the %2$sWooCommerce logs screen%3$s.', 'woocommerce-subscriptions' ), esc_html( WCS_Upgrade_Logger::$weeks_until_cleanup ), '<a href="' . esc_url( $url ) . '">', '</a>' ) );
Product impact
[x] Added changelog entry (or does not apply)
[ ] Will this PR affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
[ ] Will this PR affect WooCommerce Payments? yes/no/tbc, add issue ref
[ ] Added deprecated functions, hooks or classes to the spreadsheet
Description
This PR fixes failing unit tests, updates the way we point users to the view a certain log file and deprecates cleaning up large log files as WC core now handles that functionality.
How to test this PR
Cron job
wcs_cleanup_big_logs
and notice that job is still queued.woocommerce_subscriptions_active_version
.6.7.0
(minus 1 version).wcs_cleanup_big_logs
is no longer listed.Scheduled action notice
trunk
clicking the WooCommerce logs screen link will send you to the logs screen but not to the files directly.failed-scheduled-actions
files.wcs-upgrade
Product impact