Move new preferences and DB updates into core
parent
e08278d8c0
commit
e7a124e4b9
|
@ -1046,7 +1046,9 @@ sub populate_field_definitions
|
|||
{
|
||||
my $dbh = Bugzilla->dbh;
|
||||
|
||||
# ADD and UPDATE field definitions
|
||||
my ($has_clone_bug) = $dbh->selectrow_array('SELECT 1 FROM fielddefs WHERE clone_bug AND NOT custom');
|
||||
|
||||
# Add/update field definitions
|
||||
foreach my $def (DEFAULT_FIELDS)
|
||||
{
|
||||
my $field = new Bugzilla::Field({ name => $def->{name} });
|
||||
|
@ -1056,6 +1058,8 @@ sub populate_field_definitions
|
|||
$field->set_in_new_bugmail($def->{in_new_bugmail});
|
||||
$field->set_buglist($def->{buglist});
|
||||
$field->_set_type($def->{type}) if $def->{type};
|
||||
$field->set_clone_bug($def->{clone_bug}) if !$has_clone_bug;
|
||||
$field->set_nullable($def->{nullable}) if !$has_clone_bug;
|
||||
$field->update();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -73,8 +73,18 @@ sub SETTINGS {
|
|||
remind_me_about_worktime_newbug => { options => ['on', 'off'], default => 'off' },
|
||||
# 2009-10-21 vfilippov@custis.ru -- Custis Bug 53697
|
||||
saved_searches_position => { options => ['footer', 'header', 'both'], default => 'footer' },
|
||||
# 2010-01-11 vfilippov@custis.ru -- Custis Bug 58771
|
||||
# 2010-01-11 vfilippov@custis.ru -- Custis Bug 58771 -- FIXME move to hooks (uses external script)
|
||||
email_weekly_worktime => { options => ['on', 'off'], default => 'on' },
|
||||
# CustIS Bug 69766 - Default CSV charset for M1cr0$0ft Excel
|
||||
csv_charset => { options => ['utf-8', 'windows-1251', 'koi8-r'], default => 'utf-8' },
|
||||
# CustIS Bug 72510 - Choose whether Silent affects flags
|
||||
silent_affects_flags => { options => ['send', 'do_not_send'], default => 'send' },
|
||||
# CustIS Bug 87696 - Setting to change comments which are allowed to be marked as collapsed by default ("worktime-only")
|
||||
showhide_comments => { options => ['none', 'worktime', 'all'], default => 'worktime' },
|
||||
# CustIS Bug 125374 - Select whether to show comments in full page width
|
||||
comment_width => { options => ['off', 'on'], default => 'off' },
|
||||
# CustIS Bug 138596 - Choose whether to hide long comments by default
|
||||
preview_long_comments => { options => ['off', 'on'], default => 'off' },
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -104,6 +104,29 @@ sub update_fielddefs_definition {
|
|||
$dbh->do('UPDATE fielddefs SET buglist = 1 WHERE custom = 1 AND type != ' . FIELD_TYPE_MULTI_SELECT);
|
||||
}
|
||||
|
||||
$dbh->bz_add_column('fielddefs', clone_bug => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 1});
|
||||
$dbh->bz_add_column('fielddefs', url => {TYPE => 'VARCHAR(255)'});
|
||||
$dbh->bz_add_column('fielddefs', nullable => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});
|
||||
$dbh->bz_add_column('fielddefs', add_to_deps => {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});
|
||||
|
||||
if (!$dbh->bz_column_info('fielddefs', 'delta_ts'))
|
||||
{
|
||||
$dbh->bz_add_column('fielddefs', delta_ts => {TYPE => 'DATETIME'});
|
||||
$dbh->do('UPDATE fielddefs SET delta_ts=NOW()');
|
||||
}
|
||||
# Refresh field cache on each checksetup.pl run
|
||||
$dbh->do('UPDATE fielddefs SET delta_ts=NOW() WHERE name=\'delta_ts\'');
|
||||
|
||||
if (!$dbh->bz_column_info('fielddefs', 'has_activity'))
|
||||
{
|
||||
$dbh->bz_add_column('fielddefs', has_activity => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
|
||||
$dbh->do(
|
||||
'UPDATE fielddefs SET has_activity=1'.
|
||||
' WHERE id IN (SELECT DISTINCT fieldid FROM bugs_activity)'.
|
||||
' OR name IN (\'longdesc\', \'longdescs.isprivate\', \'commenter\', \'creation_ts\')'
|
||||
);
|
||||
}
|
||||
|
||||
# Remember, this is not the function for adding general table changes.
|
||||
# That is below. Add new changes to the fielddefs table above this
|
||||
# comment.
|
||||
|
@ -578,6 +601,69 @@ sub update_table_definitions {
|
|||
_fix_decimal_types();
|
||||
_fix_series_creator_fk();
|
||||
|
||||
# New product fields
|
||||
$dbh->bz_add_column('products', wiki_url => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"});
|
||||
$dbh->bz_add_column('products', notimetracking => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
|
||||
$dbh->bz_add_column('products', extproduct => {TYPE => 'INT4', REFERENCES => {TABLE => 'products', COLUMN => 'id'}});
|
||||
$dbh->bz_add_column('products', cc_group => {TYPE => 'varchar(255)'});
|
||||
$dbh->bz_alter_column('products', cc_group => {TYPE => 'varchar(255)'});
|
||||
|
||||
# New component fields
|
||||
$dbh->bz_add_column('components', default_version => {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "''"});
|
||||
$dbh->bz_add_column('components', wiki_url => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"});
|
||||
$dbh->bz_add_column('components', is_active => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 1});
|
||||
|
||||
# CustIS Bug 64562 - Redirect to bug page after processing bug
|
||||
$dbh->bz_add_column('logincookies', session_data => {TYPE => 'LONGBLOB'});
|
||||
|
||||
# CustIS Bug 95168 - Support longer TheSchwartz error messages
|
||||
$dbh->bz_alter_column('ts_error', message => {TYPE => 'MEDIUMTEXT', NOTNULL => 1}, '');
|
||||
|
||||
if ($dbh->bz_column_info('checkers', 'message')->{TYPE} ne 'LONGTEXT')
|
||||
{
|
||||
$dbh->bz_alter_column('checkers', message => {TYPE => 'LONGTEXT', NOTNULL => 1});
|
||||
}
|
||||
|
||||
$dbh->bz_add_column('checkers', triggers => {TYPE => 'LONGBLOB'});
|
||||
|
||||
# fieldvaluecontrol table
|
||||
_make_fieldvaluecontrol($dbh);
|
||||
|
||||
# CustIS Bug 100052 - "A blocking bug is reopened or closed" mail event
|
||||
if (!$dbh->selectrow_array('SELECT * FROM email_setting WHERE event=\''.EVT_DEPEND_REOPEN.'\' LIMIT 1'))
|
||||
{
|
||||
print "Adding 'A blocking bug is reopened or closed' mail event, On by default for all users\n";
|
||||
foreach my $rel (grep { $_ != REL_GLOBAL_WATCHER } RELATIONSHIPS)
|
||||
{
|
||||
$dbh->do(
|
||||
'INSERT INTO email_setting (user_id, relationship, event)'.
|
||||
' SELECT p.userid, ?, ? FROM profiles p WHERE p.disable_mail=0', undef, $rel, EVT_DEPEND_REOPEN
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# CustIS Bug 139829 - Move per-product 'strict isolation' setting into attribute
|
||||
if ($dbh->selectrow_array('SELECT id FROM products WHERE description LIKE \'%[CC:%\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('
|
||||
UPDATE products
|
||||
SET
|
||||
cc_group = trim(
|
||||
substr(
|
||||
description,
|
||||
locate(\'[CC:\', description)+4,
|
||||
locate(\']\', description, locate(\'[CC:\', description)+4) - locate(\'[CC:\', description)-4
|
||||
)
|
||||
),
|
||||
description = trim(
|
||||
concat(
|
||||
substr(description, 1, locate(\'[CC:\', description)-1),
|
||||
substr(description, 1 + locate(\']\', description, locate(\'[CC:\', description)+4))
|
||||
)
|
||||
)
|
||||
WHERE description LIKE\'%[CC:%\'');
|
||||
}
|
||||
|
||||
if ($dbh->bz_column_info(bugs_activity => 'added')->{TYPE} ne 'LONGTEXT')
|
||||
{
|
||||
$dbh->bz_drop_index('bugs_activity', 'bugs_activity_added_idx');
|
||||
|
@ -3577,6 +3663,95 @@ sub _fix_series_creator_fk {
|
|||
}
|
||||
}
|
||||
|
||||
# Fill 'fieldvaluecontrol' table when upgrading a stock Bugzilla installation
|
||||
sub _make_fieldvaluecontrol
|
||||
{
|
||||
my ($dbh) = @_;
|
||||
|
||||
# Dependent default values for custom fields (CustIS Bug 91153)
|
||||
$dbh->bz_add_column('fieldvaluecontrol', is_default => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
|
||||
|
||||
if ($dbh->bz_column_info('fielddefs', 'visibility_value_id'))
|
||||
{
|
||||
# FIXME do this in other place
|
||||
$dbh->do("UPDATE fielddefs SET nullable=1 WHERE name IN ('target_milestone', 'priority', 'resolution')");
|
||||
# FIXME delete --- target_milestones and '' resolution, set MOVED resolution disabled
|
||||
|
||||
# Set single select type for standard select fields
|
||||
my @ss = qw(classification product version rep_platform op_sys bug_status resolution bug_severity priority component target_milestone);
|
||||
$dbh->do("UPDATE fielddefs SET type=".FIELD_TYPE_SINGLE_SELECT()." WHERE name IN ('".join('\',\'', @ss)."')");
|
||||
|
||||
# Move visibility_value_id of values of standard fields to fieldvaluecontrol (CustIS Bug 53617)
|
||||
my @standard_fields = qw(bug_status resolution priority bug_severity op_sys rep_platform);
|
||||
my $custom_fields = $dbh->selectall_arrayref(
|
||||
'SELECT * FROM fielddefs WHERE type IN (?, ?) AND (custom=1 OR name IN ('.
|
||||
join(',', ('?') x @standard_fields).'))', {Slice=>{}},
|
||||
FIELD_TYPE_SINGLE_SELECT, FIELD_TYPE_MULTI_SELECT, @standard_fields);
|
||||
foreach my $field (@$custom_fields)
|
||||
{
|
||||
if ($dbh->bz_table_info($field->{name}) &&
|
||||
$dbh->bz_column_info($field->{name}, 'visibility_value_id'))
|
||||
{
|
||||
print "Migrating $field->{name}'s visibility_value_id into fieldvaluecontrol\n";
|
||||
$dbh->do(
|
||||
"REPLACE INTO fieldvaluecontrol (field_id, visibility_value_id, value_id)".
|
||||
" SELECT f.id, v.visibility_value_id, v.id FROM fielddefs f, `$field->{name}` v".
|
||||
" WHERE f.name=? AND v.visibility_value_id IS NOT NULL", undef, $field->{name});
|
||||
print "Making backup of table $field->{name}\n";
|
||||
$dbh->do("CREATE TABLE `backup_$field->{name}_".time."` AS SELECT * FROM `$field->{name}`");
|
||||
print "Dropping column $field->{name}.visibility_value_id\n";
|
||||
$dbh->bz_drop_column($field->{name}, 'visibility_value_id');
|
||||
}
|
||||
}
|
||||
|
||||
# Move visibility_value_id of standard fields to fieldvaluecontrol
|
||||
print "Migrating fielddefs's visibility_value_id into fieldvaluecontrol\n";
|
||||
$dbh->do(
|
||||
"REPLACE INTO fieldvaluecontrol (field_id, visibility_value_id, value_id)".
|
||||
" SELECT id, visibility_value_id, 0 FROM fielddefs WHERE visibility_value_id IS NOT NULL"
|
||||
);
|
||||
print "Making backup of table fielddefs\n";
|
||||
$dbh->do("CREATE TABLE `backup_fielddefs_".time."` AS SELECT * FROM fielddefs");
|
||||
print "Dropping column fielddefs.visibility_value_id\n";
|
||||
$dbh->bz_drop_column('fielddefs', 'visibility_value_id');
|
||||
|
||||
# Copy product_id and classification_id dependencies to fieldvaluecontrol
|
||||
# so query.cgi can show/hide all fields using common code (CustIS Bug 69481)
|
||||
print "Copying standard fields product_id/classification_id to fieldvaluecontrol\n";
|
||||
for([ 'product', 'classification', 'products' ],
|
||||
[ 'component', 'product', 'components' ],
|
||||
[ 'version', 'product', 'versions' ],
|
||||
[ 'target_milestone', 'product', 'milestones' ])
|
||||
{
|
||||
my ($id) = $dbh->selectrow_array('SELECT id FROM fielddefs WHERE name=?', undef, $_->[0]);
|
||||
my ($pid) = $dbh->selectrow_array('SELECT id FROM fielddefs WHERE name=?', undef, $_->[1]);
|
||||
$dbh->do('UPDATE fielddefs SET value_field_id=? WHERE id=?', undef, $pid, $id);
|
||||
$dbh->do('DELETE FROM fieldvaluecontrol WHERE field_id=? AND value_id!=0', undef, $id);
|
||||
$dbh->do(
|
||||
'INSERT INTO fieldvaluecontrol (field_id, value_id, visibility_value_id)'.
|
||||
' SELECT ?, id, '.$_->[1].'_id FROM '.$_->[2], undef, $id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Copy useXXX parameters to fielddefs
|
||||
if (Bugzilla->params->{useclassification})
|
||||
{
|
||||
my ($cl_id) = $dbh->selectrow_array('SELECT id FROM fielddefs WHERE name=\'classification\'');
|
||||
$dbh->do('UPDATE fielddefs SET value_field_id=? WHERE name=\'product\'', undef, $cl_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbh->do('UPDATE fielddefs SET value_field_id=NULL WHERE name=\'product\'');
|
||||
}
|
||||
require Bugzilla::Config::BugFields;
|
||||
my $h = Bugzilla::Config::BugFields->USENAMES;
|
||||
for (keys %$h)
|
||||
{
|
||||
$dbh->do('UPDATE fielddefs SET obsolete=? WHERE name=?', undef, Bugzilla->params->{$_} ? 0 : 1, $h->{$_});
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#!/usr/bin/perl
|
||||
# CustIS-расширения Bugzilla
|
||||
# Разумеется, далеко не все - только часть, отсаженная на Hooks
|
||||
# Раньше (до svn 998) все эти хуки жили в отдельных файлах в extensions/custis/code/*.pl
|
||||
# что было совместимо со стандартной системой хуков Bugzilla, которую убрали в 3.6.
|
||||
# Not really an extension -- can't be disabled, because many core files in our version
|
||||
# depend on features implemented here.
|
||||
# License: Dual-license GPL 3.0+ or MPL 1.1+
|
||||
# Author: Vitaliy Filippov <vitalif@mail.ru>
|
||||
|
||||
# FIXME: Most of these 'non-disableable' features should be moved into core.
|
||||
|
||||
use strict;
|
||||
use Bugzilla;
|
||||
|
@ -51,21 +53,21 @@ required_modules('custis', $REQUIRED_MODULES);
|
|||
optional_modules('custis', $OPTIONAL_MODULES);
|
||||
clear_hooks('custis');
|
||||
|
||||
# Изменения схемы БД
|
||||
# DB schema changes
|
||||
set_hook('custis', 'db_schema_abstract_schema', 'CustisDBHooks::db_schema_abstract_schema');
|
||||
set_hook('custis', 'install_update_db', 'CustisDBHooks::install_update_db');
|
||||
set_hook('custis', 'install_update_fielddefs', 'CustisDBHooks::install_update_fielddefs');
|
||||
|
||||
# Хуки в показ списка багов
|
||||
# Bug list hooks
|
||||
set_hook('custis', 'buglist_static_columns', 'CustisBuglistHooks::buglist_static_columns');
|
||||
set_hook('custis', 'buglist_columns', 'CustisBuglistHooks::buglist_columns');
|
||||
|
||||
# Хуки в обработку почты
|
||||
# Email-related hooks
|
||||
set_hook('custis', 'bugmail_pre_template', 'CustisMailHooks::bugmail_pre_template');
|
||||
set_hook('custis', 'emailin_filter_body', 'CustisMailHooks::emailin_filter_body');
|
||||
set_hook('custis', 'emailin_filter_html', 'CustisMailHooks::emailin_filter_html');
|
||||
|
||||
# Хуки для предоставления View'шек в базе для доступа извне
|
||||
# Hooks allowing to create MySQL Views representing saved searches for users
|
||||
if (!Bugzilla->params->{ext_disable_refresh_views})
|
||||
{
|
||||
set_hook('custis', 'editgroups_post_create', 'FlushViews::refresh_views');
|
||||
|
@ -75,18 +77,18 @@ if (!Bugzilla->params->{ext_disable_refresh_views})
|
|||
set_hook('custis', 'editusersingroup_post_add', 'FlushViews::refresh_views');
|
||||
set_hook('custis', 'editusers_post_delete', 'FlushViews::editusers_post_update_delete');
|
||||
set_hook('custis', 'editusers_post_update', 'FlushViews::editusers_post_update_delete');
|
||||
set_hook('custis', 'savedsearch_post_update', [ 'FlushViews::savedsearch_post_update' ]);
|
||||
set_hook('custis', 'savedsearch_post_update', 'FlushViews::savedsearch_post_update');
|
||||
add_hook('custis', 'install_before_final_checks', 'FlushViews::install_before_final_checks');
|
||||
}
|
||||
|
||||
# Хуки для системы проверки корректности изменений багов
|
||||
# Hooks for bug change correctness checks
|
||||
set_hook('custis', 'bug_pre_update', 'Checkers::bug_pre_update');
|
||||
set_hook('custis', 'bug_end_of_update', 'Checkers::bug_end_of_update');
|
||||
set_hook('custis', 'bug_end_of_create', 'Checkers::bug_end_of_create');
|
||||
add_hook('custis', 'savedsearch_post_update', 'Checkers::savedsearch_post_update');
|
||||
add_hook('custis', 'install_before_final_checks', 'Checkers::install_before_final_checks');
|
||||
|
||||
# Прочие хуки
|
||||
# Other hooks
|
||||
set_hook('custis', 'flag_check_requestee_list', 'CustisMiscHooks::flag_check_requestee_list');
|
||||
set_hook('custis', 'process_bug_after_move', 'CustisMiscHooks::process_bug_after_move');
|
||||
set_hook('custis', 'quote_urls_custom_proto', 'CustisMiscHooks::quote_urls_custom_proto');
|
||||
|
|
|
@ -31,95 +31,6 @@ sub db_schema_abstract_schema
|
|||
return 1;
|
||||
}
|
||||
|
||||
# Fill 'fieldvaluecontrol' table when upgrading a stock Bugzilla installation
|
||||
sub _make_fieldvaluecontrol
|
||||
{
|
||||
my ($dbh) = @_;
|
||||
|
||||
# Dependent default values for custom fields (CustIS Bug 91153)
|
||||
$dbh->bz_add_column('fieldvaluecontrol', is_default => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
|
||||
|
||||
if ($dbh->bz_column_info('fielddefs', 'visibility_value_id'))
|
||||
{
|
||||
# FIXME do this in other place
|
||||
$dbh->do("UPDATE fielddefs SET nullable=1 WHERE name IN ('target_milestone', 'priority', 'resolution')");
|
||||
# FIXME delete --- target_milestones and '' resolution, set MOVED resolution disabled
|
||||
|
||||
# Set single select type for standard select fields
|
||||
my @ss = qw(classification product version rep_platform op_sys bug_status resolution bug_severity priority component target_milestone);
|
||||
$dbh->do("UPDATE fielddefs SET type=".FIELD_TYPE_SINGLE_SELECT()." WHERE name IN ('".join('\',\'', @ss)."')");
|
||||
|
||||
# Move visibility_value_id of values of standard fields to fieldvaluecontrol (CustIS Bug 53617)
|
||||
my @standard_fields = qw(bug_status resolution priority bug_severity op_sys rep_platform);
|
||||
my $custom_fields = $dbh->selectall_arrayref(
|
||||
'SELECT * FROM fielddefs WHERE type IN (?, ?) AND (custom=1 OR name IN ('.
|
||||
join(',', ('?') x @standard_fields).'))', {Slice=>{}},
|
||||
FIELD_TYPE_SINGLE_SELECT, FIELD_TYPE_MULTI_SELECT, @standard_fields);
|
||||
foreach my $field (@$custom_fields)
|
||||
{
|
||||
if ($dbh->bz_table_info($field->{name}) &&
|
||||
$dbh->bz_column_info($field->{name}, 'visibility_value_id'))
|
||||
{
|
||||
print "Migrating $field->{name}'s visibility_value_id into fieldvaluecontrol\n";
|
||||
$dbh->do(
|
||||
"REPLACE INTO fieldvaluecontrol (field_id, visibility_value_id, value_id)".
|
||||
" SELECT f.id, v.visibility_value_id, v.id FROM fielddefs f, `$field->{name}` v".
|
||||
" WHERE f.name=? AND v.visibility_value_id IS NOT NULL", undef, $field->{name});
|
||||
print "Making backup of table $field->{name}\n";
|
||||
$dbh->do("CREATE TABLE `backup_$field->{name}_".time."` AS SELECT * FROM `$field->{name}`");
|
||||
print "Dropping column $field->{name}.visibility_value_id\n";
|
||||
$dbh->bz_drop_column($field->{name}, 'visibility_value_id');
|
||||
}
|
||||
}
|
||||
|
||||
# Move visibility_value_id of standard fields to fieldvaluecontrol
|
||||
print "Migrating fielddefs's visibility_value_id into fieldvaluecontrol\n";
|
||||
$dbh->do(
|
||||
"REPLACE INTO fieldvaluecontrol (field_id, visibility_value_id, value_id)".
|
||||
" SELECT id, visibility_value_id, 0 FROM fielddefs WHERE visibility_value_id IS NOT NULL"
|
||||
);
|
||||
print "Making backup of table fielddefs\n";
|
||||
$dbh->do("CREATE TABLE `backup_fielddefs_".time."` AS SELECT * FROM fielddefs");
|
||||
print "Dropping column fielddefs.visibility_value_id\n";
|
||||
$dbh->bz_drop_column('fielddefs', 'visibility_value_id');
|
||||
|
||||
# Copy product_id and classification_id dependencies to fieldvaluecontrol
|
||||
# so query.cgi can show/hide all fields using common code (CustIS Bug 69481)
|
||||
print "Copying standard fields product_id/classification_id to fieldvaluecontrol\n";
|
||||
for([ 'product', 'classification', 'products' ],
|
||||
[ 'component', 'product', 'components' ],
|
||||
[ 'version', 'product', 'versions' ],
|
||||
[ 'target_milestone', 'product', 'milestones' ])
|
||||
{
|
||||
my ($id) = $dbh->selectrow_array('SELECT id FROM fielddefs WHERE name=?', undef, $_->[0]);
|
||||
my ($pid) = $dbh->selectrow_array('SELECT id FROM fielddefs WHERE name=?', undef, $_->[1]);
|
||||
$dbh->do('UPDATE fielddefs SET value_field_id=? WHERE id=?', undef, $pid, $id);
|
||||
$dbh->do('DELETE FROM fieldvaluecontrol WHERE field_id=? AND value_id!=0', undef, $id);
|
||||
$dbh->do(
|
||||
'INSERT INTO fieldvaluecontrol (field_id, value_id, visibility_value_id)'.
|
||||
' SELECT ?, id, '.$_->[1].'_id FROM '.$_->[2], undef, $id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Copy useXXX to DB config
|
||||
if (Bugzilla->params->{useclassification})
|
||||
{
|
||||
my ($cl_id) = $dbh->selectrow_array('SELECT id FROM fielddefs WHERE name=\'classification\'');
|
||||
$dbh->do('UPDATE fielddefs SET value_field_id=? WHERE name=\'product\'', undef, $cl_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbh->do('UPDATE fielddefs SET value_field_id=NULL WHERE name=\'product\'');
|
||||
}
|
||||
require Bugzilla::Config::BugFields;
|
||||
my $h = Bugzilla::Config::BugFields->USENAMES;
|
||||
for (keys %$h)
|
||||
{
|
||||
$dbh->do('UPDATE fielddefs SET obsolete=? WHERE name=?', undef, Bugzilla->params->{$_} ? 0 : 1, $h->{$_});
|
||||
}
|
||||
}
|
||||
|
||||
# ./checksetup'овые обновления базы
|
||||
sub install_update_db
|
||||
{
|
||||
|
@ -183,169 +94,6 @@ sub install_update_db
|
|||
}
|
||||
}
|
||||
|
||||
# CustIS Bug 13593 - Wiki integration
|
||||
$dbh->bz_add_column('products', wiki_url => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"});
|
||||
$dbh->bz_add_column('components', wiki_url => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"});
|
||||
|
||||
# CustIS Bug 59357 - Prefer no time-tracking in some products
|
||||
$dbh->bz_add_column('products', notimetracking => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
|
||||
|
||||
# CustIS Bug 68921 - Internal/external products
|
||||
$dbh->bz_add_column('products', extproduct => {TYPE => 'INT4', REFERENCES => {TABLE => 'products', COLUMN => 'id'}});
|
||||
|
||||
# CustIS Bug 139829 - Per-product "strict isolation" settings
|
||||
$dbh->bz_add_column('products', cc_group => {TYPE => 'varchar(255)'});
|
||||
$dbh->bz_alter_column('products', cc_group => {TYPE => 'varchar(255)'});
|
||||
|
||||
# CustIS Bug 53725 - Default version
|
||||
$dbh->bz_add_column('components', default_version => {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "''"});
|
||||
|
||||
# CustIS Bug 68921 - Closed components
|
||||
$dbh->bz_add_column('components', is_active => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 1});
|
||||
|
||||
_make_fieldvaluecontrol($dbh);
|
||||
|
||||
# Bug 64562 - Redirect to bug page after processing bug
|
||||
$dbh->bz_add_column('logincookies', session_data => {TYPE => 'LONGBLOB'});
|
||||
|
||||
# Bug 95168 - Support longer TheSchwartz error messages
|
||||
$dbh->bz_alter_column('ts_error', message => {TYPE => 'MEDIUMTEXT', NOTNULL => 1}, '');
|
||||
|
||||
# Bug 69766 - Default CSV charset for M1cr0$0ft Excel
|
||||
if (!$dbh->selectrow_array('SELECT name FROM setting WHERE name=\'csv_charset\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('INSERT INTO setting (name, default_value, is_enabled) VALUES (\'csv_charset\', \'utf-8\', 1)');
|
||||
}
|
||||
if (!$dbh->selectrow_array('SELECT name FROM setting_value WHERE name=\'csv_charset\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('INSERT INTO setting_value (name, value, sortindex) VALUES (\'csv_charset\', \'utf-8\', 10), (\'csv_charset\', \'windows-1251\', 20), (\'csv_charset\', \'koi8-r\', 30)');
|
||||
}
|
||||
|
||||
# Bug 72510 - Настройка действия/недействия Silent на почту о флагах
|
||||
if (!$dbh->selectrow_array('SELECT name FROM setting WHERE name=\'silent_affects_flags\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('INSERT INTO setting (name, default_value, is_enabled) VALUES (\'silent_affects_flags\', \'send\', 1)');
|
||||
}
|
||||
if (!$dbh->selectrow_array('SELECT name FROM setting_value WHERE name=\'silent_affects_flags\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('INSERT INTO setting_value (name, value, sortindex) VALUES (\'silent_affects_flags\', \'send\', 10), (\'silent_affects_flags\', \'do_not_send\', 20)');
|
||||
}
|
||||
|
||||
# Bug 87696 - Setting to change comments which are allowed to be marked as collapsed by default ("worktime-only")
|
||||
if (!$dbh->selectrow_array('SELECT name FROM setting WHERE name=\'showhide_comments\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('INSERT INTO setting (name, default_value, is_enabled) VALUES (\'showhide_comments\', \'worktime\', 1)');
|
||||
}
|
||||
if (!$dbh->selectrow_array('SELECT name FROM setting_value WHERE name=\'showhide_comments\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('INSERT INTO setting_value (name, value, sortindex) VALUES (\'showhide_comments\', \'none\', 10), (\'showhide_comments\', \'worktime\', 20), (\'showhide_comments\', \'all\', 30)');
|
||||
}
|
||||
|
||||
# Bug 100052 - Сообщения от зависимых багов
|
||||
if (!$dbh->selectrow_array('SELECT * FROM email_setting WHERE event=\''.EVT_DEPEND_REOPEN.'\' LIMIT 1'))
|
||||
{
|
||||
print "Adding 'A blocking bug is reopened or closed' mail event, On by default for all users\n";
|
||||
foreach my $rel (grep { $_ != REL_GLOBAL_WATCHER } RELATIONSHIPS)
|
||||
{
|
||||
$dbh->do(
|
||||
'INSERT INTO email_setting (user_id, relationship, event)'.
|
||||
' SELECT p.userid, ?, ? FROM profiles p WHERE p.disable_mail=0', undef, $rel, EVT_DEPEND_REOPEN
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Bug 125374 - Настройки пользователя для управления шириной комментариев
|
||||
if (!$dbh->selectrow_array('SELECT * FROM setting WHERE name=\'comment_width\' LIMIT 1'))
|
||||
{
|
||||
print "Adding 'Show comment with full screen width' user general setting, On by default for all users\n";
|
||||
$dbh->do('INSERT INTO setting (name, default_value, is_enabled) VALUES (\'comment_width\', \'off\', 1)');
|
||||
$dbh->do('INSERT INTO setting_value (name, value, sortindex) VALUES (\'comment_width\', \'off\', \'10\'), (\'comment_width\', \'on\', \'20\')');
|
||||
}
|
||||
|
||||
# Bug 139829 - Ограничение CC продукта: перенос из description в cc_group
|
||||
if ($dbh->selectrow_array('SELECT id FROM products WHERE description LIKE \'%[CC:%\' LIMIT 1'))
|
||||
{
|
||||
$dbh->do('
|
||||
UPDATE products
|
||||
SET
|
||||
cc_group = trim(
|
||||
substr(
|
||||
description,
|
||||
locate(\'[CC:\', description)+4,
|
||||
locate(\']\', description, locate(\'[CC:\', description)+4) - locate(\'[CC:\', description)-4
|
||||
)
|
||||
),
|
||||
description = trim(
|
||||
concat(
|
||||
substr(description, 1, locate(\'[CC:\', description)-1),
|
||||
substr(description, 1 + locate(\']\', description, locate(\'[CC:\', description)+4))
|
||||
)
|
||||
)
|
||||
WHERE description LIKE\'%[CC:%\'');
|
||||
}
|
||||
|
||||
# Bug 138596 - Настройки пользователя для управления длинными комментариями
|
||||
if (!$dbh->selectrow_array('SELECT * FROM setting WHERE name=\'preview_long_comments\' LIMIT 1'))
|
||||
{
|
||||
print "Adding 'Fold long comments' user general setting, Off by default for all users\n";
|
||||
$dbh->do('INSERT INTO setting (name, default_value, is_enabled) VALUES (\'preview_long_comments\', \'off\', 1)');
|
||||
$dbh->do('INSERT INTO setting_value (name, value, sortindex) VALUES (\'preview_long_comments\', \'off\', \'10\'), (\'preview_long_comments\', \'on\', \'20\')');
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub install_update_fielddefs
|
||||
{
|
||||
my $dbh = Bugzilla->dbh;
|
||||
|
||||
# Bug 69325 - Настройка копирования / не копирования значения поля при клонировании бага
|
||||
$dbh->bz_add_column('fielddefs', clone_bug => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 1});
|
||||
|
||||
# Bug 90854 - Тип поля "ссылка во внешнюю систему по ID"
|
||||
$dbh->bz_add_column('fielddefs', url => {TYPE => 'VARCHAR(255)'});
|
||||
|
||||
# Nullable field property
|
||||
$dbh->bz_add_column('fielddefs', nullable => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});
|
||||
|
||||
# Bug 70605 - Кэширование зависимостей полей для поиска и формы бага на клиентской стороне
|
||||
if (!$dbh->bz_column_info('fielddefs', 'delta_ts'))
|
||||
{
|
||||
$dbh->bz_add_column('fielddefs', delta_ts => {TYPE => 'DATETIME'});
|
||||
$dbh->do('UPDATE fielddefs SET delta_ts=NOW()');
|
||||
}
|
||||
|
||||
if (!$dbh->bz_column_info('fielddefs', 'has_activity'))
|
||||
{
|
||||
$dbh->bz_add_column('fielddefs', has_activity => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0});
|
||||
$dbh->do(
|
||||
'UPDATE fielddefs SET has_activity=1'.
|
||||
' WHERE id IN (SELECT DISTINCT fieldid FROM bugs_activity)'.
|
||||
' OR name IN (\'longdesc\', \'longdescs.isprivate\', \'commenter\', \'creation_ts\')'
|
||||
);
|
||||
}
|
||||
|
||||
# Bug 73054 - Возможность автоматического добавления значений полей типа Bug ID в зависимости бага
|
||||
$dbh->bz_add_column('fielddefs', add_to_deps => {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});
|
||||
|
||||
# Bug 70605 - Делаем вид, что изменили какое-то поле, чтобы при checksetup автоматически сбросился кэш
|
||||
$dbh->do('UPDATE fielddefs SET delta_ts=NOW() WHERE name=\'delta_ts\'');
|
||||
|
||||
# Bug 69481 - Длина описания проверок
|
||||
if ($dbh->bz_column_info('checkers', 'message')->{TYPE} ne 'LONGTEXT')
|
||||
{
|
||||
$dbh->bz_alter_column('checkers', message => {TYPE => 'LONGTEXT', NOTNULL => 1});
|
||||
}
|
||||
|
||||
# Bug 108088 - Триггеры (пока поддерживается только 1 триггер: добавление CC)
|
||||
$dbh->bz_add_column('checkers', triggers => {TYPE => 'LONGBLOB'});
|
||||
|
||||
# Устанавливаем значение buglist в правильное
|
||||
my @yes = map { $_->{name} } grep { $_->{buglist} } Bugzilla::Field::DEFAULT_FIELDS;
|
||||
my @no = map { $_->{name} } grep { !$_->{buglist} } Bugzilla::Field::DEFAULT_FIELDS;
|
||||
$dbh->do('UPDATE fielddefs SET buglist=1 WHERE name IN (\''.join("','", @yes).'\')');
|
||||
$dbh->do('UPDATE fielddefs SET buglist=0 WHERE name IN (\''.join("','", @no).'\')');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue