From b21167f4de2d29d7ce4a7cd07266783032099568 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 15 Oct 2015 20:52:27 +0000 Subject: Bug 1209599 - group general preferences by category (schema only) --- Bugzilla/DB/Schema.pm | 1 + Bugzilla/Install.pm | 151 ++++++++++++++++++++++++++++++++++++++----------- Bugzilla/Install/DB.pm | 14 +++++ 3 files changed, 132 insertions(+), 34 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 3f49d5026..2c8b4a284 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -1618,6 +1618,7 @@ use constant ABSTRACT_SCHEMA => { is_enabled => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'}, subclass => {TYPE => 'varchar(32)'}, + category => {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "'General'"} ], }, diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm index 8a1113741..9950b222a 100644 --- a/Bugzilla/Install.pm +++ b/Bugzilla/Install.pm @@ -56,51 +56,133 @@ use constant STATUS_WORKFLOW => ( ); sub SETTINGS { - return { + return [ # 2005-03-03 travis@sedsystems.ca -- Bug 41972 - display_quips => { options => ["on", "off"], default => "on" }, + { + name => 'display_quips', + options => ["on", "off"], + default => "on", + category => 'Searching' + }, # 2005-03-10 travis@sedsystems.ca -- Bug 199048 - comment_sort_order => { options => ["oldest_to_newest", "newest_to_oldest", - "newest_to_oldest_desc_first"], - default => "oldest_to_newest" }, + { + name => 'comment_sort_order', + options => ["oldest_to_newest", "newest_to_oldest", "newest_to_oldest_desc_first"], + default => "oldest_to_newest", + category => 'Bug Editing' + }, # 2005-05-12 bugzilla@glob.com.au -- Bug 63536 - post_bug_submit_action => { options => ["next_bug", "same_bug", "nothing"], - default => "next_bug" }, + { + name => 'post_bug_submit_action', + options => ["next_bug", "same_bug", "nothing"], + default => "next_bug", + category => 'Bug Editing' + }, # 2005-06-29 wurblzap@gmail.com -- Bug 257767 - csv_colsepchar => { options => [',',';'], default => ',' }, + { + name => 'csv_colsepchar', + options => [',',';'], + default => ',', + category => 'Searching' + }, # 2005-10-26 wurblzap@gmail.com -- Bug 291459 - zoom_textareas => { options => ["on", "off"], default => "on" }, + { + name => 'zoom_textareas', + options => ["on", "off"], + default => "on", + category => 'Bug Editing' + }, # 2005-10-21 LpSolit@gmail.com -- Bug 313020 - per_bug_queries => { options => ['on', 'off'], default => 'off' }, + { + name => 'per_bug_queries', + options => ['on', 'off'], + default => 'off', + category => 'Searching' + }, # 2006-05-01 olav@bkor.dhs.org -- Bug 7710 - state_addselfcc => { options => ['always', 'never', 'cc_unless_role'], - default => 'cc_unless_role' }, + { + name => 'state_addselfcc', + options => ['always', 'never', 'cc_unless_role'], + default => 'cc_unless_role', + category => 'Bug Editing' + }, # 2006-08-04 wurblzap@gmail.com -- Bug 322693 - skin => { subclass => 'Skin', default => 'Dusk' }, + { + name => 'skin', + subclass => 'Skin', + default => 'Dusk', + category => 'User Interface' + }, # 2006-12-10 LpSolit@gmail.com -- Bug 297186 - lang => { subclass => 'Lang', - default => ${Bugzilla->languages}[0] }, + { + name => 'lang', + subclass => 'Lang', + default => ${Bugzilla->languages}[0], + category => 'User Interface' + }, # 2007-07-02 altlist@gmail.com -- Bug 225731 - quote_replies => { options => ['quoted_reply', 'simple_reply', 'off'], - default => "quoted_reply" }, + { + name => 'quote_replies', + options => ['quoted_reply', 'simple_reply', 'off'], + default => "quoted_reply", + category => 'Bug Editing' + }, # 2009-02-01 mozilla@matt.mchenryfamily.org -- Bug 398473 - comment_box_position => { options => ['before_comments', 'after_comments'], - default => 'before_comments' }, + { + name => 'comment_box_position', + options => ['before_comments', 'after_comments'], + default => 'before_comments', + category => 'Bug Editing' + }, # 2008-08-27 LpSolit@gmail.com -- Bug 182238 - timezone => { subclass => 'Timezone', default => 'local' }, + { + name => 'timezone', + subclass => 'Timezone', + default => 'local', + category => 'User Interface' + }, # 2011-02-07 dkl@mozilla.com -- Bug 580490 - quicksearch_fulltext => { options => ['on', 'off'], default => 'on' }, + { + name => 'quicksearch_fulltext', + options => ['on', 'off'], + default => 'on', + category => 'Searching' + }, # 2011-06-21 glob@mozilla.com -- Bug 589128 - email_format => { options => ['html', 'text_only'], - default => 'html' }, + { + name => 'email_format', + options => ['html', 'text_only'], + default => 'html', + category => 'Email Notifications' + }, # 2011-06-16 glob@mozilla.com -- Bug 663747 - bugmail_new_prefix => { options => ['on', 'off'], default => 'on' }, + { + name => 'bugmail_new_prefix', + options => ['on', 'off'], + default => 'on', + category => 'Email Notifications' + }, # 2013-07-26 joshi_sunil@in.com -- Bug 669535 - possible_duplicates => { options => ['on', 'off'], default => 'on' }, + { + name => 'possible_duplicates', + options => ['on', 'off'], + default => 'on', + category => 'User Interface' + }, # 2011-10-11 glob@mozilla.com -- Bug 301656 - requestee_cc => { options => ['on', 'off'], default => 'on' }, - api_key_only => { options => ['on', 'off'], default => 'off' }, - } + { + name => 'requestee_cc', + options => ['on', 'off'], + default => 'on', + category => 'Reviews and Needinfo' + }, + { + name => 'api_key_only', + options => ['on', 'off'], + default => 'off', + category => 'API' + }, + ]; }; use constant SYSTEM_GROUPS => ( @@ -198,12 +280,13 @@ sub update_settings { print get_text('install_setting_setup'), "\n"; } - my %settings = %{SETTINGS()}; - foreach my $setting (keys %settings) { - add_setting($setting, - $settings{$setting}->{options}, - $settings{$setting}->{default}, - $settings{$setting}->{subclass}, undef, + my @settings = @{SETTINGS()}; + foreach my $setting (@settings) { + add_setting($setting->{name}, + $setting->{options}, + $setting->{default}, + $setting->{subclass}, + undef, !$any_settings); } } diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 794b7e6e7..705cf3e37 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -759,6 +759,8 @@ sub update_table_definitions { $dbh->bz_add_column('groups', 'idle_member_removal', {TYPE => 'INT2', NOTNULL => 1, DEFAULT => '0'}); + _migrate_preference_categories(); + ################################################################ # New --TABLE-- changes should go *** A B O V E *** this point # ################################################################ @@ -3896,6 +3898,18 @@ sub _migrate_group_owners { $dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id); } +sub _migrate_preference_categories { + my $dbh = Bugzilla->dbh; + return if $dbh->bz_column_info('setting', 'category'); + $dbh->bz_add_column('setting', 'category', + {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "'General'"}); + my @settings = @{ Bugzilla::Install::SETTINGS() }; + foreach my $params (@settings) { + $dbh->do('UPDATE setting SET category = ? WHERE name = ?', + undef, $params->{category}, $params->{name}); + } +} + 1; __END__ -- cgit v1.2.3-24-g4f1b