From 72e6a203547667b442c876f9cbfa9cce72e8f814 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 1 Apr 2014 13:53:47 +0800 Subject: Bug 774198: "Undefined subroutine Fh::slice" when logging in with browserid while attaching a file --- .../template/en/default/hook/global/header-additional_header.html.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/Persona/template/en/default/hook/global/header-additional_header.html.tmpl b/extensions/Persona/template/en/default/hook/global/header-additional_header.html.tmpl index f6d68a5af..786010a34 100644 --- a/extensions/Persona/template/en/default/hook/global/header-additional_header.html.tmpl +++ b/extensions/Persona/template/en/default/hook/global/header-additional_header.html.tmpl @@ -54,6 +54,7 @@ function persona_onlogin(assertion) { [% FOREACH field = cgi.param() %] [% NEXT IF field.search("^(Bugzilla_(login|password|restrictlogin)|token|persona_assertion)$") %] + [% NEXT UNLESS cgi.param(field).can('slice') %] [% FOREACH mvalue = cgi.param(field).slice(0) %] createHidden('[% field FILTER js %]', '[% mvalue FILTER html_linebreak FILTER js %]', form); [% END %] -- cgit v1.2.3-24-g4f1b From b42469e3632fe96b0475fa00f07d6ca5abc0e2dc Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 1 Apr 2014 16:13:16 +0800 Subject: Bug 981756: add support for "bigint unsigned" to db/schema and update bz_schema to reflect the current state --- Bugzilla/DB/Schema.pm | 10 +++++----- Bugzilla/DB/Schema/Mysql.pm | 2 ++ Bugzilla/Install/DB.pm | 30 +++++++++++++++++++++++++++--- extensions/Review/Extension.pm | 2 +- extensions/TryAutoLand/Extension.pm | 2 +- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index d8f3e175a..e2a7e138e 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -342,13 +342,13 @@ use constant ABSTRACT_SCHEMA => { bugs_activity => { FIELDS => [ - id => {TYPE => 'INTSERIAL', NOTNULL => 1, + id => {TYPE => 'BIGSERIAL', NOTNULL => 1, PRIMARYKEY => 1}, bug_id => {TYPE => 'INT3', NOTNULL => 1, REFERENCES => {TABLE => 'bugs', COLUMN => 'bug_id', DELETE => 'CASCADE'}}, - attach_id => {TYPE => 'INT3', + attach_id => {TYPE => 'INT5', REFERENCES => {TABLE => 'attachments', COLUMN => 'attach_id', DELETE => 'CASCADE'}}, @@ -492,7 +492,7 @@ use constant ABSTRACT_SCHEMA => { attachments => { FIELDS => [ - attach_id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, + attach_id => {TYPE => 'BIGSERIAL', NOTNULL => 1, PRIMARYKEY => 1}, bug_id => {TYPE => 'INT3', NOTNULL => 1, REFERENCES => {TABLE => 'bugs', @@ -523,7 +523,7 @@ use constant ABSTRACT_SCHEMA => { }, attach_data => { FIELDS => [ - id => {TYPE => 'INT3', NOTNULL => 1, + id => {TYPE => 'INT5', NOTNULL => 1, PRIMARYKEY => 1, REFERENCES => {TABLE => 'attachments', COLUMN => 'attach_id', @@ -636,7 +636,7 @@ use constant ABSTRACT_SCHEMA => { REFERENCES => {TABLE => 'bugs', COLUMN => 'bug_id', DELETE => 'CASCADE'}}, - attach_id => {TYPE => 'INT3', + attach_id => {TYPE => 'INT5', REFERENCES => {TABLE => 'attachments', COLUMN => 'attach_id', DELETE => 'CASCADE'}}, diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm index 5fc50a986..f2450abf1 100644 --- a/Bugzilla/DB/Schema/Mysql.pm +++ b/Bugzilla/DB/Schema/Mysql.pm @@ -108,10 +108,12 @@ sub _initialize { INT2 => 'smallint', INT3 => 'mediumint', INT4 => 'integer', + INT5 => 'bigint unsigned', SMALLSERIAL => 'smallint auto_increment', MEDIUMSERIAL => 'mediumint auto_increment', INTSERIAL => 'integer auto_increment', + BIGSERIAL => 'bigint unsigned auto_increment', TINYTEXT => 'tinytext', MEDIUMTEXT => 'mediumtext', diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index ad68e94c4..a217e0753 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -261,7 +261,7 @@ sub update_table_definitions { $dbh->bz_add_column("bugs", "cclist_accessible", {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'}); - $dbh->bz_add_column("bugs_activity", "attach_id", {TYPE => 'INT3'}); + $dbh->bz_add_column("bugs_activity", "attach_id", {TYPE => 'INT5'}); _delete_logincookies_cryptpassword_and_handle_invalid_cookies(); @@ -686,8 +686,9 @@ sub update_table_definitions { {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1}); # 2012-07-24 dkl@mozilla.com - Bug 776972 - $dbh->bz_alter_column('bugs_activity', 'id', - {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1}); + # BMO - we change this to BIGSERIAL further down + #$dbh->bz_alter_column('bugs_activity', 'id', + # {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1}); # 2012-07-24 dkl@mozilla.com - Bug 776982 @@ -705,6 +706,14 @@ sub update_table_definitions { # 2013-08-16 glob@mozilla.com - Bug 905925 $dbh->bz_add_index('attachments', 'attachments_ispatch_idx', ['ispatch']); + # 2014-03-11 glob@mozilla.com - Bug 981756 (BMO only) + _fix_attachments_primary_key(); + if ($dbh->bz_column_info('bugs_activity', 'id')->{TYPE} ne 'BIGSERIAL') { + $dbh->bz_drop_related_fks('bugs_activity', 'id'); + $dbh->bz_alter_column('bugs_activity', 'id', + {TYPE => 'BIGSERIAL', NOTNULL => 1, PRIMARYKEY => 1}); + } + ################################################################ # New --TABLE-- changes should go *** A B O V E *** this point # ################################################################ @@ -3736,6 +3745,21 @@ sub _fix_longdescs_primary_key { } } +sub _fix_attachments_primary_key { + my $dbh = Bugzilla->dbh; + if ($dbh->bz_column_info('attachments', 'attach_id')->{TYPE} ne 'BIGSERIAL') { + $dbh->bz_drop_related_fks('attachments', 'attach_id'); + $dbh->bz_alter_column('attach_data', 'id', {TYPE => 'INT5'}); + $dbh->bz_alter_column('bugs_activity', 'attach_id', {TYPE => 'INT5'}); + $dbh->bz_alter_column('flags', 'attach_id', {TYPE => 'INT5'}); + # the following two are bmo extensions + $dbh->bz_alter_column('flag_state_activity', 'attachment_id', {TYPE => 'INT5'}); + $dbh->bz_alter_column('autoland_attachments', 'attach_id', {TYPE => 'INT5'}); + $dbh->bz_alter_column('attachments', 'attach_id', + {TYPE => 'BIGSERIAL', NOTNULL => 1, PRIMARYKEY => 1}); + } +} + sub _fix_dependencies_dupes { my $dbh = Bugzilla->dbh; my $blocked_idx = $dbh->bz_index_info('dependencies', 'dependencies_blocked_idx'); diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index 8d069e8e6..634e7c9cd 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -646,7 +646,7 @@ sub db_schema_abstract_schema { }, attachment_id => { - TYPE => 'INT3', + TYPE => 'INT5', REFERENCES => { TABLE => 'attachments', COLUMN => 'attach_id', diff --git a/extensions/TryAutoLand/Extension.pm b/extensions/TryAutoLand/Extension.pm index 40dbb70d9..8aaadff95 100644 --- a/extensions/TryAutoLand/Extension.pm +++ b/extensions/TryAutoLand/Extension.pm @@ -61,7 +61,7 @@ sub db_schema_abstract_schema { $args->{'schema'}->{'autoland_attachments'} = { FIELDS => [ attach_id => { - TYPE => 'INT3', + TYPE => 'INT5', NOTNULL => 1, PRIMARYKEY => 1, REFERENCES => { -- cgit v1.2.3-24-g4f1b