summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-11-10 22:21:52 +0100
committermkanat%bugzilla.org <>2009-11-10 22:21:52 +0100
commite4dfffc24ca572965c513356c7c8a19f82a22c64 (patch)
tree4a3718d3a9d18d83f986c0ade9993a5432ac6f15 /Bugzilla
parent4b2c9f0f96242fcd5395c088de4e27bffbfb8085 (diff)
downloadbugzilla-e4dfffc24ca572965c513356c7c8a19f82a22c64.tar.gz
bugzilla-e4dfffc24ca572965c513356c7c8a19f82a22c64.tar.xz
Bug 526165: Make it impossible to set creation_ts via Bugzilla::Bug->create
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm6
-rw-r--r--Bugzilla/Migrate.pm7
-rw-r--r--Bugzilla/WebService/Bug.pm7
3 files changed, 9 insertions, 11 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 1c8b8b965..107b3f6af 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -590,10 +590,10 @@ sub run_create_validators {
$class->_check_qa_contact($params->{qa_contact}, $component);
$params->{cc} = $class->_check_cc($component, $params->{cc});
- # Callers cannot set Reporter, currently.
+ # Callers cannot set reporter, creation_ts, or delta_ts.
$params->{reporter} = $class->_check_reporter();
-
- $params->{creation_ts} ||= Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
+ $params->{creation_ts} =
+ Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
$params->{delta_ts} = $params->{creation_ts};
if ($params->{estimated_time}) {
diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm
index c8f601521..40249bf50 100644
--- a/Bugzilla/Migrate.pm
+++ b/Bugzilla/Migrate.pm
@@ -767,7 +767,12 @@ sub insert_bugs {
my $created = Bugzilla::Bug->create($bug);
$self->debug('Created bug ' . $created->id);
Bugzilla->set_user($super_user);
-
+
+ if (defined $bug->{creation_ts}) {
+ $dbh->do('UPDATE bugs SET creation_ts = ?, delta_ts = ?
+ WHERE bug_id = ?', undef, $bug->{creation_ts},
+ $bug->{creation_ts}, $created->id);
+ }
if (defined $bug->{delta_ts}) {
$dbh->do('UPDATE bugs SET delta_ts = ? WHERE bug_id = ?',
undef, $bug->{delta_ts}, $created->id);
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index aea30cedb..006fa0fee 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -282,17 +282,10 @@ sub search {
sub create {
my ($self, $params) = @_;
-
Bugzilla->login(LOGIN_REQUIRED);
-
$params = _map_fields($params);
- # WebService users can't set the creation date of a bug.
- delete $params->{'creation_ts'};
-
my $bug = Bugzilla::Bug->create($params);
-
Bugzilla::BugMail::Send($bug->bug_id, { changer => $bug->reporter->login });
-
return { id => $self->type('int', $bug->bug_id) };
}