wp-e-commerce/WP-e-Commerce — pull request #1089 by JeffPyeBrook (2014-04-14 19:57:39+00:00)
Title: Visitor Meta Cleanup Hardening

**Fixes**
Visitor meta cleanup determines the list of expired visitor IDs, then for each ID uses AJAX to request that the visitor is deleted. This fixes several issues.
* Any hooks attached to deleting a visitor while is_admin() is true will now run when a visitor is deleted
* Memory usage is no longer excessive. Because each visitor is deleted in it's own envelope of HTTP processing slow memory growth is no longer an issue when deleting hundreds or thousands of users
* If the time allotted for deleting users is reached, or the memory used while deleting users reaches a threshold, the delete user processed is stopped. Prior to the process being stopped a cron task is scheduled to delete the remaining users. This cron will run a small after a short delay but will not wait for the next hourly delete visitor cron cleanup. This addresses the issue where more visitor are created in an hour than can be deleted in a single pass of the visitor cleanup routine.
* If an some type of severe error occurs deleting a visitor it does not stop the processing for other users. The single request to delete the visitor will fail, but other continue because they are being processed in a different HTTP context.

**Other enhancements**
To help diagnose visitor cleanup cron issues a non-autoload option is saved every time visitor cleanup runs. The option contains the last run time as a string. Our TBD WPeC health check plugin or dashboard widget can grab this value.

Closes issue #982