web/modules/rhn/RHN/DB/EmailAddress.pm | 104 ---------------------------------
web/modules/rhn/RHN/DB/SatInstall.pm | 33 ----------
web/modules/rhn/RHN/DB/User.pm | 55 -----------------
3 files changed, 192 deletions(-)
New commits:
commit 1b6b6e80b1d649f3f7f82e17dbacec55c258b93c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 16:33:56 2009 +0100
Removing functions that were dead code, or obsoleted by previous removal.
diff --git a/web/modules/rhn/RHN/DB/EmailAddress.pm
b/web/modules/rhn/RHN/DB/EmailAddress.pm
index 73ab0fc..740b9de 100644
--- a/web/modules/rhn/RHN/DB/EmailAddress.pm
+++ b/web/modules/rhn/RHN/DB/EmailAddress.pm
@@ -152,19 +152,6 @@ sub commit {
delete $self->{":modified:"};
}
-sub next_action_seconds {
- my $self = shift;
- my $delay = shift;
-
- if (not defined $delay) {
- $self->next_action(undef);
- }
- else {
- my $when = time + $delay;
- $self->next_action(strftime("%Y-%m-%d %H:%M:%S", localtime $when));
- }
-}
-
sub state {
my $self = shift;
return $self->mail_state_label if not @_;
@@ -182,95 +169,4 @@ sub state {
$self->state_id($id);
}
-sub email_address_states {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query = <<EOQ;
-SELECT label
- FROM rhnEmailAddressState
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute;
-
- my $labels = [ ];
-
- while (my ($label) = $sth->fetchrow) {
- push @{$labels}, $label;
- }
-
- return $labels;
-}
-
-sub delete_self {
- my $self = shift;
- my %params = validate(@_, {-transaction => 0});
- my $dbh = $params{-transaction} || RHN::DB->connect;
-
- my $query = <<EOQ;
-DELETE
- FROM rhnEmailAddress
- WHERE id = :id
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute_h(id => $self->id);
-
- $dbh->commit unless $params{-transaction};
-}
-
-sub delete_other_addresses {
- my $self = shift;
- my %params = validate(@_, {-transaction => 0});
- my $dbh = $params{-transaction} || RHN::DB->connect;
-
- my $query = <<EOQ;
-DELETE
- FROM rhnEmailAddress
- WHERE id <> :id
- AND user_id = :user_id
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute_h(id => $self->id, user_id => $self->user_id);
-
- $dbh->commit unless $params{-transaction};
-}
-
-sub reset_email {
- my $class = shift;
- my $user = shift;
- my $state = shift || 'unverified';
-
- throw "No user." unless (ref $user and
$user->isa('RHN::DB::User'));
-
- my $new_address = $user->email;
- my @addresses = $user->email_addresses;
- $_->delete_self foreach (@addresses);
- my $email = $class->create;
- $email->address($new_address);
- $email->user_id($user->id);
- $email->state($state);
- $email->commit;
-
- return $email;
-}
-
-sub log_sent_email {
- my $class = shift;
- my %params = validate(@_, {-reason => 1, -address => 1, -user_id => 1});
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-INSERT INTO rhnEmailAddressLog
- (user_id, address, reason, created)
-VALUES
- (:user_id, :address, :reason, sysdate)
-EOS
- $sth->execute_h(user_id => $params{-user_id}, address => $params{-address},
reason => $params{-reason});
- $dbh->commit;
-}
-
1;
commit 69dcc234775e817220c887967214bf7b981a1fc8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 16:32:45 2009 +0100
Previous removal made email_addresses_by_types obsolate, removing.
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index 76c400f..b92f1c8 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -2563,44 +2563,6 @@ EOQ
return @sids;
}
-# give it one or more types and it will give you objects of those
-# types. in multiple, it returns in order of the types specified, so
-# you can cascade through preferred choices, etc
-sub email_addresses_by_types {
- my $self_or_class = shift;
- my $id;
-
- if (ref $self_or_class) {
- $id = $self_or_class->id;
- }
- else {
- $id = shift;
- }
-
- my @types = @_;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT id
- FROM rhnEmailAddress
- WHERE user_id = :user_id
- AND state_id = rhn_bel.lookup_email_state(:type)
-ORDER BY MODIFIED DESC
-EOQ
-
- my @ret;
-
- for my $type (@types) {
- $sth->execute_h(user_id => $id, type => $type);
-
- while (my ($id) = $sth->fetchrow) {
- push @ret, RHN::EmailAddress->lookup(-id => $id);
- }
- }
-
- return @ret;
-}
-
sub email_addresses {
my $self_or_class = shift;
my $id;
commit ec1c93714ee9afc1e5439b3a46a02f721af5f225
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 16:30:09 2009 +0100
Previous removal make find_mailable_address obsolete.
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index 0b7bb46..76c400f 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -2631,23 +2631,6 @@ EOQ
return @ret;
}
-sub find_mailable_address {
- my $self = shift;
-
- my ($address) = $self->email_addresses_by_types(qw/verified unverified pending
pending_warned needs_verifying/);
-
- if (not $address and $self->email) {
- $address = RHN::EmailAddress->create();
- $address->user_id($self->id);
- $address->state('unverified');
- $address->next_action_seconds(undef);
- $address->address($self->email);
- $address->commit;
- }
-
- return $address;
-}
-
sub delete_nonverified_addresses {
my $self = shift;
my %params = validate(@_, {transaction => 0});
commit a0a729a0945f0e7d5925ad8870e3d38244ae1cc1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 16:28:39 2009 +0100
Removal of create_gritch_destination makes set_first_gritch_destination obsolete,
removing.
diff --git a/web/modules/rhn/RHN/DB/SatInstall.pm b/web/modules/rhn/RHN/DB/SatInstall.pm
index aa30940..cee1b95 100644
--- a/web/modules/rhn/RHN/DB/SatInstall.pm
+++ b/web/modules/rhn/RHN/DB/SatInstall.pm
@@ -389,37 +389,4 @@ EOQ
return @rows;
}
-sub set_first_gritch_destination {
- my $class = shift;
- my $uid = shift;
-
- throw "No user id" unless $uid;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
- SELECT CM.recid,
- CM.method_name,
- WC.org_id
- FROM web_contact WC, rhn_contact_methods CM
- WHERE CM.contact_id = WC.id
- AND WC.id = :user_id
-ORDER BY CM.recid
-EOQ
-
- $sth->execute_h(user_id => $uid);
-
- my $row = $sth->fetchrow_hashref;
- $sth->finish;
-
- my %gritch_conf =
- (GRITCH_TARGETDESTNAME => $row->{METHOD_NAME},
- GRITCH_TARGETDESTID => $row->{RECID},
- GRITCH_TARGETCUST => $row->{ORG_ID},
- );
-
- $class->update_monitoring_config(\%gritch_conf);
-
- return;
-}
-
1;
Show replies by date