diff options
Diffstat (limited to 'Bugzilla/Install/DB.pm')
-rw-r--r-- | Bugzilla/Install/DB.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 86edf8a30..8b3d4b8cc 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -773,6 +773,7 @@ sub update_table_definitions { $dbh->bz_add_index('profiles', 'profiles_realname_ft_idx', {TYPE => 'FULLTEXT', FIELDS => ['realname']}); + _migrate_nicknames(); ################################################################ # New --TABLE-- changes should go *** A B O V E *** this point # @@ -3920,6 +3921,17 @@ sub _migrate_group_owners { $dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id); } +sub _migrate_nicknames { + my $dbh = Bugzilla->dbh; + my $sth = $dbh->prepare('SELECT userid FROM profiles WHERE realname LIKE "%:%" AND is_enabled = 1 AND NOT nickname'); + $sth->execute(); + while (my ($user_id) = $sth->fetchrow_array) { + my $user = Bugzilla::User->new($user_id); + $user->set_name($user->name); + $user->update(); + } +} + sub _migrate_preference_categories { my $dbh = Bugzilla->dbh; return if $dbh->bz_column_info('setting', 'category'); |