function scald_enable_batch in Scald: Media Management made easy 6
Batch addition of all Users as Scald Authors.
1 call to scald_enable_batch()
- scald_enable in ./
scald.install - Implementation of hook_enable().
1 string reference to 'scald_enable_batch'
- scald_enable in ./
scald.install - Implementation of hook_enable().
File
- ./
scald.install, line 684
Code
function scald_enable_batch(&$context) {
if (!isset($context['sandbox']['last_uid'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['last_uid'] = 0;
$context['sandbox']['total'] = db_result(db_query("\n SELECT\n COUNT(uid)\n FROM\n {users}\n WHERE\n uid > 0\n ORDER BY\n uid\n "));
}
$users_results = db_query_range("\n SELECT\n uid,\n name\n FROM\n {users}\n WHERE\n uid > %d\n ORDER BY\n uid\n ", $context['sandbox']['last_uid'], 0, SCALD_ENABLE_BATCH_LIMIT);
while ($user_raw = db_fetch_array($users_results)) {
scald_register_author($user_raw);
$context['sandbox']['last_uid'] = $user_raw['uid'];
$context['sandbox']['progress']++;
}
$context['message'] = t('Updated @current of @total users.', array(
'@current' => $context['sandbox']['progress'],
'@total' => $context['sandbox']['total'],
));
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['total'];
}