function blog_pathauto_bulkupdate in Pathauto 6
Same name and namespace in other branches
- 5.2 pathauto_user.inc \blog_pathauto_bulkupdate()
- 5 pathauto_user.inc \blog_pathauto_bulkupdate()
Bulk generate aliases for all blogs without aliases.
File
- ./
pathauto_user.inc, line 139 - Hook implementations for user module integration.
Code
function blog_pathauto_bulkupdate() {
$concat = _pathauto_sql_concat("'blog/'", 'u.uid');
$sql = "SELECT u.uid FROM {users} u LEFT JOIN {url_alias} ua ON {$concat} = ua.src WHERE u.uid > 0 AND ua.src IS NULL";
$query = db_query_range($sql, 0, variable_get('pathauto_max_bulk_update', 50));
$count = 0;
$placeholders = array();
while ($uid = db_result($query)) {
$account = user_load($uid);
$placeholders = pathauto_get_placeholders('user', $account);
$source = 'blog/' . $account->uid;
if (pathauto_create_alias('blog', 'bulkupdate', $placeholders, $source, $account->uid)) {
$count++;
}
}
drupal_set_message(format_plural($count, 'Bulk generation of user blogs completed, one alias generated.', 'Bulk generation of user blogs completed, @count aliases generated.'));
}