mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Refactor batch action scheduling for account status updates (#1692)
Updated batch action logic to utilize correct constants and ensure proper scheduling. Added fallback scheduling logic in admin notices to address unscheduled batch actions and improve reliability.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
use um\common\actions\Users;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
@@ -261,6 +263,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Alternative method of checking and maybe schedule a batch action if it has not been scheduled previously.
|
||||
// Avoid case when the option with the empty user statuses isn't empty.
|
||||
// We need to recalculate option value and re-schedule the Batch action.
|
||||
if ( ! UM()->maybe_action_scheduler()->has_scheduled_action( Users::BATCH_ACTION ) ) {
|
||||
do_action( Users::SCHEDULE_ACTION );
|
||||
}
|
||||
|
||||
$allowed_html = array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
|
||||
@@ -316,9 +316,9 @@ KEY meta_value_indx (um_value(191))
|
||||
}
|
||||
|
||||
// If there are some users without `account_status` then run the first async batch for update.
|
||||
$batch_size = 50; // See the class constant value `\um\common\actions\Users::BATCH_ACTION`.
|
||||
$batch_size = 50; // See the class constant value `\um\common\actions\Users::BATCH_SIZE`.
|
||||
UM()->maybe_action_scheduler()->enqueue_async_action(
|
||||
$batch_size,
|
||||
'um_set_default_account_status', // See the class constant value `\um\common\actions\Users::BATCH_ACTION`.
|
||||
array(
|
||||
'page' => 1,
|
||||
'total' => $total_users,
|
||||
|
||||
Reference in New Issue
Block a user