function _email_verify_batch_display_process_batch in Email Verify 8.2
Same name and namespace in other branches
- 7.2 email_verify.check.inc \_email_verify_batch_display_process_batch()
The batch process for checking the users.
Parameters
int $current_uid: The user ID of the user to start the verification on.
int $max: The maximum number of records to process.
bool $disabled_users: Indicates whether to include disabled users or not. A value of TRUE (or 1) includes them, where a value of FALSE (or 0) does not.
array $context: Used by the Batch API to keep track of and pass data from one operation to the next.
1 string reference to '_email_verify_batch_display_process_batch'
- email_verify_user_check_form_submit in ./
email_verify.check.inc - Submit handler for the user check form.
File
- ./
email_verify.check.inc, line 288 - User email check menu callback file for email_verify module.
Code
function _email_verify_batch_display_process_batch($current_uid, $max, $disabled_users, array &$context) {
// Used to store information to track progression between successive calls.
if (empty($context['sandbox'])) {
$context['sandbox'] = array();
$context['sandbox']['progress'] = 0;
$context['sandbox']['current_uid'] = $current_uid;
$context['sandbox']['max'] = $max;
}
$query_limit = 5;
// Make sure no more records are processed than specified.
if ($context['sandbox']['max'] - $context['sandbox']['progress'] < $query_limit) {
$query_limit = $context['sandbox']['max'] - $context['sandbox']['progress'];
}
// Create and execute the query for selecting the user data.
$query = 'SELECT uid, name, mail FROM {users} WHERE uid > :uid';
// Check for whether to include blocked users.
if (empty($disabled_users)) {
$query .= ' AND status = 1';
}
$query .= ' ORDER BY uid ASC LIMIT ' . $query_limit;
$users = db_query($query, array(
':uid' => $context['sandbox']['current_uid'],
))
->fetchAll();
// If there are no more user email addresses to verify, set 'progress' to
// 'max'.
if (empty($users)) {
$context['sandbox']['progress'] = $context['sandbox']['max'] = $max;
}
else {
// Process the user list.
foreach ($users as $user) {
// Check the user account.
$check_results = email_verify_check($user->mail);
if (!empty($check_results['verification_message'])) {
// Add the user to the list.
$context['results']['users_to_display'][$user->uid] = array(
'uid' => $user->uid,
'name' => $user->name,
'mail' => $user->mail,
'reason' => $check_results['verification_message'],
'link' => l(t('account'), 'user/' . $user->uid),
);
}
if (!empty($check_results['debugging_text'])) {
// Log and/or display the debugging information.
email_verify_process_debug_information($check_results['debugging_text']);
}
// Update the progress information.
$context['sandbox']['progress']++;
$context['sandbox']['current_uid'] = $user->uid;
$context['message'] = t('Processed email address @email (user ID @uid)', array(
'@email' => $user->mail,
'@uid' => $user->uid,
));
}
}
// Inform the batch engine the operations have not been completed, and provide
// an estimation of the current completion level.
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] >= $context['sandbox']['max'];
}
}