web/modules/dobby/Dobby/Env.pm | 19
web/modules/grail/Grail/Application.pm | 20
web/modules/pxt/PXT/Lint.pm | 48 --
web/modules/rhn/RHN/AppInstall/Process/Step/Requirements/Requirement.pm | 108 -----
web/modules/rhn/RHN/DB/Inspector.pm | 124 -----
web/modules/rhn/RHN/DataSource/ContactGroup.pm | 24 -
web/modules/rhn/RHN/ErrataMailer.pm | 208
----------
web/spacewalk-web.spec | 1
8 files changed, 552 deletions(-)
New commits:
commit 751457e17194686d30996c174c03f775ada24cb0
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 15 10:28:50 2009 +0100
Package RHN::ErrataMailer is not used anywhere, removing as dead code.
diff --git a/web/modules/rhn/RHN/ErrataMailer.pm b/web/modules/rhn/RHN/ErrataMailer.pm
deleted file mode 100644
index 4e24ac4..0000000
--- a/web/modules/rhn/RHN/ErrataMailer.pm
+++ /dev/null
@@ -1,208 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::ErrataMailer;
-use strict;
-
-use Params::Validate;
-
-use RHN::DB;
-use RHN::Errata;
-use RHN::Postal;
-
-sub new {
- my $class = shift;
- my %params = validate(@_, { -errata_id => 1, -org_id => 1 });
-
- my $self = bless { users => {}, servers => {} }, $class;
- $self->{errata_id} = $params{-errata_id};
- $self->{org_id} = $params{-org_id};
-
- return $self;
-}
-
-sub prepare_work_queue {
- my $self = shift;
- my %params = validate(@_, { -dbh => 1 });
- my $dbh = $params{-dbh};
- my $errata_id = $self->{errata_id};
-
- my @query_params = (errata_id => $errata_id, org_id => $self->{org_id});
- my $query = <<" EOS";
- INSERT INTO rhnPaidErrataTempCache
- (user_id, server_id, errata_id)
- SELECT DISTINCT user_id, server_id, :errata_id
- FROM rhnPrivateErrataMail
- WHERE errata_id = :errata_id
- AND org_id = :org_id
- EOS
-
- my $sth = $dbh->prepare($query);
- $sth->execute_h(@query_params);
-}
-
-sub prepare_users {
- my $self = shift;
- my %params = validate(@_, { -dbh => 1 });
- my $dbh = $params{-dbh};
-
- my $user_sth = $dbh->prepare(<<" EOS");
- SELECT WC.id, WC.org_id, WC.login, WUPI.email
- FROM web_user_personal_info WUPI,
- web_contact WC,
- rhnPaidErrataTempCache PETC
- WHERE WC.id = PETC.user_id
- AND WUPI.web_user_id = WC.id
- EOS
- $user_sth->execute;
- while (my $user = $user_sth->fetchrow_hashref_copy) {
- $self->{users}->{$user->{ID}} = $user;
- }
-}
-
-sub prepare_systems {
- my $self = shift;
- my %params = validate(@_, { -dbh => 1 });
- my $dbh = $params{-dbh};
-
- my $system_sth = $dbh->prepare(<<" EOS");
- SELECT S.id, S.name, C.name base_channel
- FROM rhnChannel C,
- rhnServerChannel SC,
- rhnServer S,
- rhnServerArch SA,
- rhnPaidErrataTempCache PETC
- WHERE S.server_arch_id = SA.id
- AND S.id = PETC.server_id
- AND S.id = SC.server_id
- AND SC.channel_id = C.id
- AND C.parent_channel IS NULL
- EOS
- $system_sth->execute;
- while (my $system = $system_sth->fetchrow_hashref_copy) {
- $self->{servers}->{$system->{ID}} = $system;
- }
-}
-
-sub prepare_batch {
- my $self = shift;
- my %params = validate(@_, { -dbh => 1 });
- my $dbh = $params{-dbh};
-
- my $batch_sth = $dbh->prepare(<<" EOS");
- SELECT user_id, server_id
- FROM rhnPaidErrataTempCache PETC
- EOS
- $batch_sth->execute;
- while (my ($user_id, $server_id) = $batch_sth->fetchrow) {
- push @{$self->{batch}->{$user_id}}, $server_id;
- }
-}
-
-sub prepare_errata {
- my $self = shift;
-
- my $e = RHN::Errata->lookup(-id => $self->{errata_id});
- my $errata_subst =
- {
- 'errata-id' => $e->id,
- 'errata-advisory' => $e->advisory,
- 'errata-advisory-type' => $e->advisory_type,
- 'errata-topic' => $e->topic,
- 'errata-synopsis' => $e->synopsis,
- 'errata-description' => $e->description,
- 'errata-notes' => $e->notes,
- 'errata-references' => $e->refers_to,
- };
-
- $self->{errata} = $e;
- $self->{errata_substitutions} = $errata_subst;
-}
-
-sub prepare_postal {
- my $self = shift;
-
- my $letter = new RHN::Postal;
- my $filename = "errata_mail/paid_errata_notice.xml";
- $letter->template($filename);
-
- $self->{letter} = $letter;
- $letter->set_tag($_, $self->{errata_substitutions}->{$_}) for keys
%{$self->{errata_substitutions}};
-}
-
-sub send_user_email {
- my $self = shift;
- my %params = validate(@_, { -user_id => 1 });
- my $user_id = $params{-user_id};
-
- my $letter = $self->{letter};
- $letter->set_tag("login" =>
$self->{users}->{$user_id}->{LOGIN});
- $letter->set_tag("email-address" =>
$self->{users}->{$user_id}->{EMAIL});
-
- my @systems = sort { $self->{servers}->{$a}->{NAME} cmp
$self->{servers}->{$b}->{NAME} } @{$self->{batch}->{$user_id}};
- $letter->set_tag("system-count" => scalar @systems);
- if (@systems > 1) {
- $letter->set_tag("system-count-verb", "are");
- $letter->set_tag("system-count-plural", "s");
- }
- else {
- $letter->set_tag("system-count-verb", "is");
- $letter->set_tag("system-count-plural", "");
- }
-
- my $affected_list_string;
- for my $system (@systems) {
- $affected_list_string .=
- sprintf("%-32s%s\n", $self->{servers}->{$system}->{NAME},
$self->{servers}->{$system}->{BASE_CHANNEL});
- }
-
- $letter->set_tag("system-affected-list" => $affected_list_string);
- $letter->render;
- $letter->to($self->{users}->{$user_id}->{EMAIL});
- $letter->set_header("X-RHN-Info" => "Autogenerated mail for
$self->{users}->{$user_id}->{LOGIN}");
- $letter->set_header("Precedence" => "first-class");
- $letter->set_header("Errors-To" =>
sprintf('rhn-bounce+%d-%d(a)rhn.redhat.com',
- $user_id,
- $self->{users}->{$user_id}->{ORG_ID}));
- $letter->send;
-}
-
-sub prepare_job {
- my $self = shift;
- my %params = validate(@_, { -dbh => 1 });
- my $dbh = $params{-dbh};
-
- $self->prepare_errata();
- $self->prepare_work_queue(-dbh => $dbh);
- $self->prepare_users(-dbh => $dbh);
- $self->prepare_systems(-dbh => $dbh);
- $self->prepare_batch(-dbh => $dbh);
- $self->prepare_postal();
-}
-
-sub send_all_emails {
- my $self = shift;
- use Time::HiRes qw/time/;
- my $dbh = RHN::DB->connect;
- $self->prepare_job(-dbh => $dbh);
-
- for my $user_id (sort keys %{$self->{batch}}) {
- $self->send_user_email(-user_id => $user_id);
- }
-
- $dbh->do("DELETE FROM rhnPaidErrataTempCache");
-}
-
-1;
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 7fc11e3..7af3df9 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -188,7 +188,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/Entitlements.pm
%{perl_vendorlib}/RHN/Errata.pm
%{perl_vendorlib}/RHN/ErrataEditor.pm
-%{perl_vendorlib}/RHN/ErrataMailer.pm
%{perl_vendorlib}/RHN/ErrataTmp.pm
%{perl_vendorlib}/RHN/FileList.pm
%{perl_vendorlib}/RHN/Form.pm
commit f2929c185ec28e70edb981219c957764b77d56e0
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 15 10:27:26 2009 +0100
Package RHN::DB::Inspector is not used anywhere, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Inspector.pm b/web/modules/rhn/RHN/DB/Inspector.pm
deleted file mode 100644
index 96e6845..0000000
--- a/web/modules/rhn/RHN/DB/Inspector.pm
+++ /dev/null
@@ -1,124 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use strict;
-
-package RHN::DB::Inspector;
-
-use RHN::DB;
-
-use Data::Dumper;
-
-
-# returns [ org_id, org_name, user_id, first_names, last_name, login, email ]
-sub find_org_by_user {
- my $class = shift;
- my %params = @_;
-# my $search_str = shift;
-
- my ($lower, $upper, $total_ref, $search_str) =
- map { $params{"-" . $_} } qw/lower upper total_rows search_str/;
-
-
- my $dbh = RHN::DB->connect();
- my $query;
- my $sth;
- my $where_clause;
-
- if ($search_str =~ /[*%]/g) {
- $search_str =~ s/\*/%/g;
-# $where_clause = "UPPER(S.name) LIKE UPPER(?)";
- }
-# else {
-# $where_clause = "S.name = ?";
-# }
-
- $query = <<EOQ;
-SELECT WC.org_id, WC.login, WC.id, PI.email
- FROM web_user_personal_info PI, web_contact WC
- WHERE (WC.login_uc LIKE UPPER(?) OR PI.email LIKE UPPER(?))
- AND WC.id = PI.web_user_id
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($search_str, $search_str);
-
- my @ret;
- $$total_ref = 0;
- my $i = 1;
- while( my @row = $sth->fetchrow) {
- $$total_ref = $i;
- if ($i >= $lower and $i <= $upper) {
- push @ret, [ @row ];
- }
- $i++;
- }
- $sth->finish;
-
- return @ret;
-}
-
-# returns [ org_id, org_name, server_id, server_name ]
-# based on search for server name
-# NOTE: SLOW!
-sub find_org_by_server_name {
- my $class = shift;
- my %params = @_;
-# my $search_str = shift;
-
- my ($lower, $upper, $total_ref, $search_str) =
- map { $params{"-" . $_} } qw/lower upper total_rows search_str/;
-
-
- my $dbh = RHN::DB->connect();
- my $query;
- my $sth;
- my $where_clause;
-
- if ($search_str =~ /[*%]/g) {
- $search_str =~ s/\*/%/g;
- $where_clause = "UPPER(S.name) LIKE UPPER(?)";
- }
- else {
- $where_clause = "S.name = ?";
- }
-
- $query = <<EOQ;
-SELECT O.id, O.name, S.id, S.name
- FROM web_customer O, rhnServer S
- WHERE $where_clause
- AND S.org_id = O.id
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($search_str);
-
- my @ret;
- $$total_ref = 0;
- my $i = 1;
- while( my @row = $sth->fetchrow) {
- $$total_ref = $i;
- if ($i >= $lower and $i <= $upper) {
- push @ret, [ @row ];
- }
- $i++;
- }
-
- $sth->finish;
-
- return @ret;
-}
-
-1;
commit 1cfd0c47b66c953145d3e4306d29c0fb9808abe3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 15 10:26:12 2009 +0100
Package RHN::DataSource::ContactGroup is not used anywhere, removing as dead code.
diff --git a/web/modules/rhn/RHN/DataSource/ContactGroup.pm
b/web/modules/rhn/RHN/DataSource/ContactGroup.pm
deleted file mode 100644
index 772ef37..0000000
--- a/web/modules/rhn/RHN/DataSource/ContactGroup.pm
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use strict;
-package RHN::DataSource::ContactGroup;
-
-use RHN::DataSource;
-
-our @ISA = qw/RHN::DataSource/;
-
-sub data_file { 'contact_group_queries.xml' }
-1;
commit 965ae43d44be481123e2c3dfa32e47629dbd6c0e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 15 10:22:19 2009 +0100
Package RHN::AppInstall::Process::Step::Requirements::Requirement is not used
anywhere, removing as dead code.
diff --git a/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements/Requirement.pm
b/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements/Requirement.pm
deleted file mode 100644
index 168b68b..0000000
--- a/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements/Requirement.pm
+++ /dev/null
@@ -1,108 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::AppInstall::Process::Step::Requirements::Requirement;
-
-use strict;
-
-use RHN::Exception qw/throw/;
-use Params::Validate qw/:all/;
-Params::Validate::validation_options(strip_leading => "-");
-
-my %valid_fields = (acl => 0,
- argument => 0,
- name => 1,
- );
-
-sub valid_fields {
- return %valid_fields;
-}
-
-sub new {
- my $class = shift;
- my %fields = $class->valid_fields();
- my %attr = validate(@_, \%fields);
-
- my $self = bless { map { ( $_, undef ) } keys(%fields),
- }, $class;
-
- foreach (keys %attr) {
- my $func = "set_${_}";
- throw "Invalid function: $func"
- unless $self->can($func);
-
- $self->$func($attr{$_});
- }
-
- return $self;
-}
-
-# A requirement is really just an ACL by another name.
-# Turn this requirement into an ACL
-sub as_acl {
- my $self = shift;
-
- my $name = $self->get_name();
- $name =~ s/-/_/g;
-
- return sprintf("%s(%s)", $name, $self->get_argument());
-}
-
-sub get_acl {
- my $self = shift;
-
- return $self->{acl};
-}
-
-sub set_acl {
- my $self = shift;
- my $acl = shift;
-
- $self->{acl} = $acl;
-
- return;
-}
-
-sub get_argument {
- my $self = shift;
-
- return $self->{argument};
-}
-
-sub set_argument {
- my $self = shift;
- my $argument = shift;
-
- $self->{argument} = $argument;
-
- return;
-}
-
-sub get_name {
- my $self = shift;
-
- return $self->{name};
-}
-
-sub set_name {
- my $self = shift;
- my $name = shift;
-
- $self->{name} = $name;
-
- return;
-}
-
-1;
commit 31bc1934d865aab9a769d4ddd121ce491a80d5db
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 15 10:15:38 2009 +0100
Package PXT::Lint is not used anywhere, removing as dead code.
diff --git a/web/modules/pxt/PXT/Lint.pm b/web/modules/pxt/PXT/Lint.pm
deleted file mode 100644
index 3226c0f..0000000
--- a/web/modules/pxt/PXT/Lint.pm
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use strict;
-package PXT::Lint;
-
-use Data::Dumper;
-
-my %calls;
-sub swaddle_package {
- my $class = shift;
- my $package = shift;
-
- my $chash = eval "\\%${package}::";
-
- for my $func (grep { *{$chash->{$_}}{CODE} } keys %$chash) {
- my ($package, $name, $cref) = map { *{$chash->{$func}}{$_} } qw/PACKAGE NAME
CODE/;
-
- # prevent warning of subroutine redefinition
- local $^W = 0;
- $calls{"${package}::${name}"} = 0;
- $chash->{$func} = sub { $calls{"${package}::${name}"}++; goto &$cref
};
- }
-
- warn "Swaddled package: $package";
-}
-
-sub dump_empty_calls {
- my $class = shift;
-
- for my $func (sort grep { $calls{$_} == 0 } keys %calls) {
- warn "$func: $calls{$func}";
- }
-}
-
-1;
commit 61689fa154499faea88786c2bb64da8ee749b804
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 15 10:14:26 2009 +0100
Package Grail::Application is not used anywhere (and not very useful either), removing
as dead code.
diff --git a/web/modules/grail/Grail/Application.pm
b/web/modules/grail/Grail/Application.pm
deleted file mode 100644
index 6233004..0000000
--- a/web/modules/grail/Grail/Application.pm
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use strict;
-
-package Grail::Application;
-
-1;
commit 4462fefab0149e59bc75c1e74dee13773a249311
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 15 10:13:58 2009 +0100
Package Dobby::Env is not used anywhere (and not very useful either), removing as dead
code.
diff --git a/web/modules/dobby/Dobby/Env.pm b/web/modules/dobby/Dobby/Env.pm
deleted file mode 100644
index b678c46..0000000
--- a/web/modules/dobby/Dobby/Env.pm
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use strict;
-package Dobby::Env;
-
-1;