summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Hardison <dylan@mozilla.com>2016-02-10 17:48:45 +0100
committerDylan Hardison <dylan@mozilla.com>2016-02-10 17:48:45 +0100
commit7e8c053b15fa26a6f930adef558044edaca7acf0 (patch)
tree36e25ea0295cc98e9fa3c20de0731e73b4d91713
parent009b23d2ed0213c8fa1bd5a958377b1b4997ff1f (diff)
downloadbugzilla-7e8c053b15fa26a6f930adef558044edaca7acf0.tar.gz
bugzilla-7e8c053b15fa26a6f930adef558044edaca7acf0.tar.xz
Bug 1246413 - Email::Address caches all email addresses
-rw-r--r--extensions/UserProfile/Extension.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/extensions/UserProfile/Extension.pm b/extensions/UserProfile/Extension.pm
index 4fe1436c0..2c17a2d9f 100644
--- a/extensions/UserProfile/Extension.pm
+++ b/extensions/UserProfile/Extension.pm
@@ -19,6 +19,7 @@ use Bugzilla::User;
use Bugzilla::Util qw(datetime_from time_ago);
use Email::Address;
use Scalar::Util qw(blessed);
+use List::MoreUtils qw(any);
our $VERSION = '1';
@@ -36,7 +37,12 @@ BEGIN {
sub _user_last_activity_ts { $_[0]->{last_activity_ts} }
sub _user_last_statistics_ts { $_[0]->{last_statistics_ts} }
-sub _user_address { Email::Address->new(undef, $_[0]->email) }
+sub _user_address {
+ my $mode = Bugzilla->usage_mode;
+
+ Email::Address->disable_cache if any { $mode == $_ } USAGE_MODE_CMDLINE, USAGE_MODE_TEST, USAGE_MODE_EMAIL;
+ return Email::Address->new(undef, $_[0]->email);
+}
sub _user_set_last_activity_ts {
my ($self, $value) = @_;
@@ -66,6 +72,8 @@ sub _user_clear_last_statistics_ts {
# hooks
#
+sub request_cleanup { Email::Address->purge_cache }
+
sub bug_after_create {
my ($self, $args) = @_;
$self->_bug_touched($args);