|
| 1 | +From 18e9b1c13a274ad16c85e0584fc85f8b6a474cc8 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Daniel Kudwien <daniel@netzstrategen.com> |
| 3 | +Date: Mon, 28 Apr 2025 14:54:03 +0200 |
| 4 | +Subject: [PATCH] Fixed auctions-for-woocommerce cron event callbacks cannot be |
| 5 | + invoked from WordPress cron. |
| 6 | + |
| 7 | +--- |
| 8 | + includes/class-auctions-for-woocommerce-cronjobs.php | 10 +++------- |
| 9 | + 1 file changed, 3 insertions(+), 7 deletions(-) |
| 10 | + |
| 11 | +diff --git a/includes/class-auctions-for-woocommerce-cronjobs.php b/includes/class-auctions-for-woocommerce-cronjobs.php |
| 12 | +index 2f8c4ef7..fbfba011 100644 |
| 13 | +--- a/includes/class-auctions-for-woocommerce-cronjobs.php |
| 14 | ++++ b/includes/class-auctions-for-woocommerce-cronjobs.php |
| 15 | +@@ -92,7 +92,6 @@ class Auctions_For_Woocommerce_Cronjobs { |
| 16 | + |
| 17 | + ); |
| 18 | + for ( $i = 0; $i < 3; $i++ ) { |
| 19 | +- $time = microtime( 1 ); |
| 20 | + $the_query = new WP_Query( $args ); |
| 21 | + $posts_ids = $the_query->posts; |
| 22 | + |
| 23 | +@@ -106,10 +105,7 @@ class Auctions_For_Woocommerce_Cronjobs { |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | +- $time = microtime( 1 ) - $time; |
| 28 | +- if ( $i < 3 ) { |
| 29 | +- sleep( 20 - $time ); |
| 30 | +- } |
| 31 | ++ usleep( 150 * 1000 ); |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | +@@ -121,7 +117,7 @@ class Auctions_For_Woocommerce_Cronjobs { |
| 36 | + |
| 37 | + $remind_to_pay_settings = get_option( 'woocommerce_remind_to_pay_settings' ); |
| 38 | + if ( 'yes' !== $remind_to_pay_settings['enabled'] ) { |
| 39 | +- exit(); |
| 40 | ++ return; |
| 41 | + } |
| 42 | + |
| 43 | + $interval = ( ! empty( $remind_to_pay_settings['interval'] ) ) ? (int) $remind_to_pay_settings['interval'] : 7; |
| 44 | +@@ -361,7 +357,7 @@ class Auctions_For_Woocommerce_Cronjobs { |
| 45 | + $remind_to_pay_settings = get_option( 'woocommerce_remind_to_pay_settings' ); |
| 46 | + |
| 47 | + if ( 'yes' !== $remind_to_pay_settings['enabled'] ) { |
| 48 | +- exit(); |
| 49 | ++ return; |
| 50 | + } |
| 51 | + |
| 52 | + $interval = ( isset( $remind_to_pay_settings['interval'] ) && ! empty( $remind_to_pay_settings['interval'] ) ) ? (int) $remind_to_pay_settings['interval'] : 7; |
| 53 | +-- |
| 54 | +2.41.0 |
| 55 | + |
0 commit comments