Commit Graph

27 Commits

Author SHA1 Message Date
Mike Jolley d990b5192f Switch to action scheduler 2019-02-28 11:11:08 +00:00
Rodrigo Primo b39b419e5b Pass an instance of the background updater to the db update callbacks
This commit changes the way that WC_Background_Updater::task() calls the database update callbacks and adds the WC_Background_Updater instance as the first parameter to the callbacks. This is used in wc_update_350_order_customer_id() (36b6bd79c0/includes/wc-update-functions.php (L1870)) to monitor memory usage while the function is running. This change was intended to ship with PR #17895 (see commit c77b2f20f4) but was accidentaly removed when merging commit 083c994732 from another PR.

Fixes #20718
2018-07-16 14:24:42 -03:00
Rodrigo Primo 7f70c6372c Fix some code untitentional code changes added during the last merge from master 2018-06-11 10:48:28 -03:00
Rodrigo Primo dd8bf8b522 Merge branch 'master' into update/use-post-author-for-customer-id 2018-06-11 10:44:14 -03:00
Mike Jolley 048b95e135 Correct code to run again 2018-05-25 16:36:07 +01:00
Mike Jolley 083c994732 Break up update routine and allow it run to multuple times 2018-05-25 14:18:19 +01:00
Rodrigo Primo 923eeb2e43 Monitor only memory limit while running the data migration
Turns out WP_Background_Process uses an arbitrary value of 20 seconds of wall clock time to measure PHP "time limit" (b0617a13c4/includes/libraries/wp-background-process.php (L385)) instead of cpu time which apparently it is not easy to measure in PHP. Since system calls (like database calls) are not included in the PHP maximum execution time, 20 seconds of wall clock is often way less than PHP time limit.

Thus, this commit removes the call to WP_Background_Process::time_exceeded() while running the function to migrate the post meta _customer_user to the field post_author. If the script times out, WP_Background_Process will restart it.
2018-04-17 16:07:18 -03:00
Rodrigo Primo c77b2f20f4 Change WC_Background_Updater to allow in-task resource monitoring
This change makes it possible to monitor resource usage inside each of the database update functions. Useful when doing resource intensive updates to stop the execution and requeue before the execution is aborted.
2018-04-16 10:40:00 -03:00
Claudio Sanches 820426a4d0 Short ASBPATH check in includes/class-wc-background-updater.php 2018-03-15 18:14:36 -03:00
Claudio Sanches b811dbbaec Applied new WC_Background_Process class 2018-02-01 11:42:34 -02:00
Mike Jolley 39b947e1ee Prefix per site 2017-12-08 16:53:51 +00:00
Claudio Sanches a13158a75a Apply wc_maybe_define_constant() in all places 2017-09-05 16:52:39 -03:00
Mike Jolley bbf8e750ce Tidy up includes 2017-02-16 11:46:01 +00:00
Jon Surrell e4d5886427 Replace log `tag` with log `source` 2016-12-29 11:58:43 +01:00
Jon Surrell 691c35e97b Update logger calls 2016-12-29 11:58:42 +01:00
Mike Jolley cfe28c9b25 Made WC_Logger pluggable via wc_get_logger function.
Closes #11474
2016-08-08 13:59:23 +01:00
Mike Jolley 66c61eebc8 Define full path for includes
Closes #11087
2016-07-27 11:58:43 +01:00
Mike Jolley 2f255ad52e 10 seconds for update cron 2016-06-16 15:28:53 +01:00
Mike Jolley 36c4b6334b No need to store error in bg updater 2016-06-16 15:27:49 +01:00
Mike Jolley 6fc6e07c46 Added link to force DB update if cron is disabled.
@claudiosmweb
2016-06-15 11:07:12 +01:00
Mike Jolley 3d207c6bae Move update error to log 2016-06-15 10:50:43 +01:00
Mike Jolley 34f2bd683e Prevent update notice appearing twice
@claudiosmweb
2016-06-13 12:44:19 +01:00
Mike Jolley 9c8ad2e304 Schedule cron in the future 2016-06-09 11:54:29 +01:00
Shiva Poudel 00cc3711ac Minor tweaks and JSHint ignore for update notice script 2016-06-06 23:05:10 +05:45
Mike Jolley 21db8d4824 Show error when cannot dispatch updater 2016-06-02 23:41:22 +01:00
Mike Jolley 9cf0758d3f Add logging and notices 2016-05-11 14:22:31 +01:00
Mike Jolley f896d7a040 Background updater class 2016-05-11 12:44:00 +01:00