You are here

function services_security_update_reset_users_with_password_one in Services 7.3

1 call to services_security_update_reset_users_with_password_one()
services_security_setup_batch in ./services.module
3 string references to 'services_security_update_reset_users_with_password_one'
drush_services_security_update_1 in ./services.drush.inc
services_security_get_update_options in ./services.module
services_security_setup_batch in ./services.module

File

./services.module, line 92
Provides a generic but powerful API for web services.

Code

function services_security_update_reset_users_with_password_one() {
  $users = array();

  // Query the database to get all user ID
  $query = db_select('users', 'u')
    ->fields('u', array(
    'uid',
  ));
  $users = $query
    ->execute()
    ->fetchAll();
  $num_of_users = count($users);
  $progress = 0;

  // where to start
  $limit = variable_get('services_security_reset_limit_per_batch', 10);

  // how many to process for each run
  $max = $num_of_users;

  // how many records to process until stop

  //Set up our batch operations
  while ($progress < $max) {
    $operations[] = array(
      'services_security_update_reset_users_with_password_one_op',
      array(
        $progress,
        $limit,
        $max,
      ),
    );
    $progress = $progress + $limit;
  }

  // build the batch instructions
  $batch = array(
    'operations' => $operations,
    'finished' => 'services_security_user_update_finished',
    'file' => drupal_get_path('module', 'services') . '/services.admin.inc',
    'progress_message' => t('Processed batch #@current out of @total.'),
  );
  return $batch;
}