function blog_pathauto_bulkupdate in Pathauto 5.2
Same name and namespace in other branches
- 5 pathauto_user.inc \blog_pathauto_bulkupdate()
- 6 pathauto_user.inc \blog_pathauto_bulkupdate()
Bulk generate aliases for all blogs without aliases.
File
- ./
pathauto_user.inc, line 114 - Hook implementations for user module integration.
Code
function blog_pathauto_bulkupdate() {
$query = "SELECT uid, name, src, dst FROM {users} LEFT JOIN {url_alias} ON CONCAT('blog/', CAST(uid AS CHAR)) = src WHERE uid > 0 AND src IS NULL";
$result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50));
$count = 0;
$placeholders = array();
while ($user = db_fetch_object($result)) {
$placeholders = pathauto_get_placeholders('user', $user);
$src = 'blog/' . $user->uid;
if (pathauto_create_alias('blog', 'bulkupdate', $placeholders, $src, $user->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.'));
}