web/modules/grail/Grail/Component.pm | 26 -
web/modules/pxt/PXT/ApacheHandler.pm | 11
web/modules/pxt/PXT/Request.pm | 98 ------
web/modules/pxt/PXT/Trace.pm | 9
web/modules/pxt/PXT/Utils.pm | 176 ------------
web/modules/rhn/RHN/AppInstall/ACL.pm | 6
web/modules/rhn/RHN/AppInstall/ActionHandler.pm | 22 -
web/modules/rhn/RHN/AppInstall/Process.pm | 18 -
web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm | 7
web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm | 15 -
web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm | 19 -
web/modules/rhn/RHN/AppInstall/RequirementHandler.pm | 33 --
web/modules/rhn/RHN/AppInstall/Session.pm | 48 ---
13 files changed, 488 deletions(-)
New commits:
commit d860a77a2bb4a1cb90781914b1bbd226d98d20d8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:25:16 2010 +0100
current_step, import_session, and _check_stored_data are not referenced in the code,
removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Session.pm
b/web/modules/rhn/RHN/AppInstall/Session.pm
index 5c88e92..8abe2a4 100644
--- a/web/modules/rhn/RHN/AppInstall/Session.pm
+++ b/web/modules/rhn/RHN/AppInstall/Session.pm
@@ -119,13 +119,6 @@ sub current_process {
}
-# returns the step object for the step we are on.
-sub current_step {
- my $self = shift;
-
- $self->_lookup_step($self->get_step_number);
-}
-
# return the next step, or undef if none exists.
# does not advance the step counter.
sub next_step {
@@ -271,47 +264,6 @@ sub export {
return $state;
}
-# import the state for the given app; returns a new session object.
-sub import_session {
- my $class = shift;
- my %attr = validate(@_, {
- app_instance => { isa => 'RHN::AppInstall::Instance' },
- stored_data => { type => HASHREF },
- });
-
- my $app = $attr{app_instance};
- my $data = $attr{stored_data};
-
- _check_stored_data($app, $data);
-
- my $user = RHN::User->lookup(-id => $data->{user_id});
- my $server = RHN::Server->lookup(-id => $data->{server_id});
-
- my $session = $class->new(-app_instance => $app,
- -process_name => $data->{process_name},
- -step_number => $data->{step_number},
- -session_data => $data->{session_data},
- -user => $user,
- -server => $server,
- );
-
- return $session;
-}
-
-# verify that the stored data matches the app, user, and server
-sub _check_stored_data {
- my ($app, $data) = @_;
-
- throw "(invalid_session) The target application label does not match the stored
session"
- unless ($app->get_label eq $data->{app_label});
- throw "(invalid_session) The target application version does not match the stored
session"
- unless ($app->get_version eq $data->{app_version});
- throw "(invalid_session) The target application md5sum does not match the stored
session"
- unless ($app->get_md5 eq $data->{app_md5sum});
-
- return;
-}
-
# Run an action.
# Returns 0 if the action succeeded
commit af72e8417e23c576b5cdc667c6675c20223eb80f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:23:36 2010 +0100
remove_requirement, get_requirement_registry, and set_requirement_registry are not
called anywhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm
b/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm
index 05798cb..40e099f 100644
--- a/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm
+++ b/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm
@@ -85,17 +85,6 @@ sub add_requirement {
return;
}
-sub remove_requirement {
- my $self = shift;
- my $requirement_name = shift;
-
- if (not delete $self->{requirement_registry}->{$requirement_name}) {
- throw "(requirement_not_found) There is no '$requirement_name'
requirement registered";
- }
-
- return;
-}
-
sub check_requirement {
my $self = shift;
my $requirement = shift;
@@ -131,26 +120,4 @@ sub make_param_pretty {
return $param_subs{$param} || $param;
}
-sub get_requirement_registry {
- my $self = shift;
-
- return %{$self->{requirement_registry}};
-}
-
-sub set_requirement_registry {
- my $self = shift;
- my %data;
-
- if (ref $_[0] eq 'HASH') {
- %data = %{$_[0]};
- }
- else {
- %data = @_;
- }
-
- $self->{requirement_registry} = \%data;
-
- return;
-}
-
1;
commit 431fd7788853528e25e6ea6d3ca1056af20b9df7
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:21:57 2010 +0100
get_requirements and set_requirements do not appear elsewhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm
b/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm
index 85ead7c..912d03c 100644
--- a/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm
@@ -34,25 +34,6 @@ sub valid_fields {
return ($class->SUPER::valid_fields(), %valid_fields);
}
-sub get_requirements {
- my $self = shift;
-
- return @{$self->{requirements} || []};
-}
-
-sub set_requirements {
- my $self = shift;
- my @requirements = @_;
-
- if (ref $requirements[0] eq 'ARRAY') {
- @requirements = @{$requirements[0]};
- }
-
- $self->push_requirement(@requirements);
-
- return;
-}
-
sub push_requirement {
my $self = shift;
my @requirements = @_;
commit 89892bd09bf0ace1d47daec040f7139b255fefc3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:21:00 2010 +0100
set_url and get_save_session do not appear elsewhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm
b/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm
index c693b96..ba8cb51 100644
--- a/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm
@@ -42,21 +42,6 @@ sub get_url {
return $self->{url};
}
-sub set_url {
- my $self = shift;
- my $url = shift;
-
- $self->{url} = $url;
-
- return;
-}
-
-sub get_save_session {
- my $self = shift;
-
- return $self->{save_session};
-}
-
sub set_save_session {
my $self = shift;
my $save_session = shift;
commit f013a7dc25ed2a472cd940d441eb90cb1a29527b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:19:32 2010 +0100
pop_argument does not seem to be used, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm
b/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm
index ab9c0e8..4037eda 100644
--- a/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm
@@ -124,11 +124,4 @@ sub push_argument {
return;
}
-sub pop_argument {
- my $self = shift;
-
- return if (not @{$self->{arguments}});
- return pop @{$self->{arguments}};
-}
-
1;
commit 2efacec52aac4b889c2efe83137e1eeaa96299bc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:18:58 2010 +0100
get_steps and set_steps are not called anywhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process.pm
b/web/modules/rhn/RHN/AppInstall/Process.pm
index 62b08f0..188c238 100644
--- a/web/modules/rhn/RHN/AppInstall/Process.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process.pm
@@ -63,24 +63,6 @@ sub lookup_step {
return $step;
}
-sub get_steps {
- my $self = shift;
- return @{$self->{steps} || []};
-}
-
-sub set_steps {
- my $self = shift;
- my @steps = @_;
-
- if (ref $steps[0] eq 'ARRAY') {
- @steps = @{$steps[0]};
- }
-
- $self->push_step(@steps);
-
- return;
-}
-
sub push_step {
my $self = shift;
my @steps = @_;
commit 5588363e1e1cafc57a6353fbeb9a20e703a9ff02
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:17:34 2010 +0100
get_action_registry and set_action_registry are not called anywhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/ActionHandler.pm
b/web/modules/rhn/RHN/AppInstall/ActionHandler.pm
index 9d46392..52d0d2b 100644
--- a/web/modules/rhn/RHN/AppInstall/ActionHandler.pm
+++ b/web/modules/rhn/RHN/AppInstall/ActionHandler.pm
@@ -171,26 +171,4 @@ sub export_arguments {
}
}
-sub get_action_registry {
- my $self = shift;
-
- return %{$self->{action_registry}};
-}
-
-sub set_action_registry {
- my $self = shift;
- my %data;
-
- if (ref $_[0] eq 'HASH') {
- %data = %{$_[0]};
- }
- else {
- %data = @_;
- }
-
- $self->{action_registry} = \%data;
-
- return;
-}
-
1;
commit 638d9ea91056b9eb715cd49bf821923f59140ad6
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:16:46 2010 +0100
get_failed_message is not used, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/ACL.pm
b/web/modules/rhn/RHN/AppInstall/ACL.pm
index e44cf87..de85089 100644
--- a/web/modules/rhn/RHN/AppInstall/ACL.pm
+++ b/web/modules/rhn/RHN/AppInstall/ACL.pm
@@ -85,12 +85,6 @@ sub set_argument {
return;
}
-sub get_failed_message {
- my $self = shift;
-
- return $self->{failed_message};
-}
-
sub set_failed_message {
my $self = shift;
my $failed_message = shift;
commit 1dc59b4a601e847a8d5c59fd51ef068d175fb342
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:15:34 2010 +0100
Removing bunch of unused methods from PXT::Request:
positive_numeric_param
encode_rpc_fault
rpc_fault
exception_message_map
current_stage
set_stage
form_builder_query_string
form_builder_hidden_vars
pagination_bounds
diff --git a/web/modules/pxt/PXT/Request.pm b/web/modules/pxt/PXT/Request.pm
index 06c516b..18a674a 100644
--- a/web/modules/pxt/PXT/Request.pm
+++ b/web/modules/pxt/PXT/Request.pm
@@ -353,26 +353,6 @@ sub passthrough_param {
}
}
-sub numeric_param {
- my $self = shift;
- my $name = shift;
-
- my $n = $self->param($name) || 0;
-
- $n = int(0 + $n);
-
- return $n;
-}
-
-sub positive_numeric_param {
- my $self = shift;
- my $name = shift;
-
- my $n = $self->numeric_param($name);
-
- return $n < 0 ? -$n : $n;
-}
-
sub prefill_form_values {
my $self = shift;
my $block = shift;
@@ -550,12 +530,6 @@ sub encode_rpc_result {
return $self->xml_request->encode_rpc_result(@_);
}
-sub encode_rpc_fault {
- my $self = shift;
-
- return $self->xml_request->encode_rpc_fault(@_);
-}
-
my %fault_messages =
( unknown_error => 'Unknown internal error',
server_security => 'No server perms/server does not exist',
@@ -569,40 +543,6 @@ my %fault_messages =
insufficient_channel_entitlements => 'All entitlements to the required channel
are currently in use.',
);
-sub rpc_fault {
- my $self = shift;
- my $fault_string = shift;
- my $fault_code = -2; # later we'll assign numbers; for now, -2 means
- # "not in fault list" and -1 means "in list"
-
- if (exists $fault_messages{$fault_string}) {
- $fault_code = -1;
- $fault_string = $fault_messages{$fault_string};
- }
-
- die bless { fault_text => $fault_string, fault_code => $fault_code },
"PXT::RPCFault";
-}
-
-sub exception_message_map {
- my $self = shift;
- my $exception = shift;
- my %map = @_;
-
- for my $key (%map) {
- if (ref $exception and $exception->is_rhn_exception($key)) {
- $self->push_message(local_alert => $map{$key});
- return 1;
- }
- }
-
- if (exists $map{__default__}) {
- $self->push_message(local_alert => $map{__default__});
- return 1;
- }
-
- return 0;
-}
-
sub touch_session {
$_[0]->{session_touched} = 1;
}
@@ -671,40 +611,12 @@ sub user {
return $self->{__user__};
}
-sub current_stage {
- my $self = shift;
-
- return $self->{stage};
-}
-
-sub set_stage {
- my $self = shift;
-
- $self->{stage} = shift;
-
- return $self->current_stage;
-}
-
sub form_builder_variables {
my $self = shift;
push @{$self->{form_builder_variables}}, @_;
}
-sub form_builder_query_string {
- my $self = shift;
-
- return join("&", map { "$_=" . $self->pnotes($_) }
@{$self->{form_builder_variables}});
-}
-
-sub form_builder_hidden_vars {
- my $self = shift;
-
- return join("\n",
- map { sprintf(q{<input type="hidden" name="%s"
value="%s">}, $_, $self->pnotes($_)) }
- @{$self->{form_builder_variables}});
-}
-
sub parse {
my $self = shift;
my $str = shift;
@@ -795,16 +707,6 @@ sub derelative_url {
return $url;
}
-sub pagination_bounds {
- my $self = shift;
- my $prefix = shift;
-
- my $lower = $self->param('lower') ||
$self->pnotes("${prefix}_lower") || 1;
- my $upper = $self->param('upper') ||
$self->pnotes("${prefix}_upper") || $self->user->preferred_page_size;
-
- return ($lower, $upper);
-}
-
sub route_marker {
my $self = shift;
my $href = shift;
commit d0721eb75c02ca8255674917c68fb0930fb83dc8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:09:38 2010 +0100
clear_traces is nowhere used, removing.
diff --git a/web/modules/pxt/PXT/Trace.pm b/web/modules/pxt/PXT/Trace.pm
index f40e3f1..3a0c46c 100644
--- a/web/modules/pxt/PXT/Trace.pm
+++ b/web/modules/pxt/PXT/Trace.pm
@@ -130,15 +130,6 @@ sub active {
return $cache->get('tracing_active') || 0;
}
-sub clear_traces {
- my $self = shift;
-
- my $cache = $self->get_cache;
- my $tracing = $cache->get('tracing_active');
- $cache->clear;
- $cache->set('tracing_active', $tracing);
-}
-
sub get_cache {
return new Cache::FileCache({namespace => 'pxt_trace'});
}
commit 92566dd77369cd141845a7e82e694bfaea7953d2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:08:36 2010 +0100
Removing bunch of unused functions from PXT::Utils:
get_timezones
relative_time_diff
pretty_relative_time
country_selectbox
prefix_selectbox
humanify
get_subtag_body
replace_subtag
diff --git a/web/modules/pxt/PXT/Utils.pm b/web/modules/pxt/PXT/Utils.pm
index 50430f5..b93f6ec 100644
--- a/web/modules/pxt/PXT/Utils.pm
+++ b/web/modules/pxt/PXT/Utils.pm
@@ -67,59 +67,6 @@ sub olson_from_offset {
return $timezone_conversions{$offset};
}
-# return a list of the selectable timezones for user prefs
-sub get_timezones {
- my $class = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "User_queries",
- -mode => "available_timezones");
-
- my $result = $ds->execute_query();
-
- return @$result;
-}
-
-# take 2 timestamps, return relative difference between them
-sub relative_time_diff {
- my $class = shift;
- my $time1 = shift; # timestamp
- my $time2 = shift; # timestamp
-
- # might want to suck in Date::Calc, but for now do this...
-
- my $delta = abs($time2 - $time1);
-
- my %diff;
- $diff{seconds} = $delta % 60;
- $diff{minutes} = int($delta / 60) % 60;
- $diff{hours} = int($delta / 3600) % 24;
- $diff{days} = int($delta / 86400);
- $diff{direction} = $time2 > $time1 ? 1 : -1;
-
- return \%diff;
-}
-
-# given the output of relative_time_diff, show a prettier string
-# (also must give the fields you want, ie. 'day', 'minute',
'second', etc...)
-sub pretty_relative_time {
- my $class = shift;
- my $diff_ref = shift;
- my @fields = @_;
-
- my @ret;
- foreach my $singular (@fields) {
- my $plural = $singular . 's';
- my $value = $diff_ref->{$plural};
- push @ret, $value eq 1 ? $value . " $singular" : $value . "
$plural";
- }
-
- if (scalar(@ret) > 1) {
- $ret[-1] = 'and ' . $ret[-1];
- }
-
- return join(", ", @ret);
-}
-
sub split_attributes {
my $blob = shift;
@@ -137,50 +84,6 @@ sub split_attributes {
return @ret;
}
-sub country_selectbox {
- my ($class, $formvar, $lang, $default, $current, $allow_empty) = @_;
-
- $lang ||= 'en';
- $current ||= $default || '';
-
- my $dbh = RHN::DB->connect;
-
- my $sql = "SELECT vc.code, nvl(short_name_tl, short_name)
- FROM valid_countries vc, valid_countries_tl tl
- where tl.lang (+) = ? and tl.code (+)= vc.code
- ORDER BY vc.short_name";
-
- my $sth = $dbh->prepare($sql);
- $sth->execute($lang);
-
- my @codes;
-
- while (my @r = $sth->fetchrow) {
-
- next if (grep { $_ eq uc $r[0] } qw/US CA MX/);
-
- push @codes, \@r;
- }
- $sth->finish();
-
- unshift @codes, ( ["US", "United States"], ["MX",
"Mexico"], ["CA", "Canada"]);
-
- if ($allow_empty) {
- unshift @codes, [ "", "None" ];
- }
-
- my @opts;
- foreach my $country (@codes) {
- push @opts, [ $country->[1], $country->[0], (lc($country->[0]) eq
lc($current)) ? 1 : 0 ];
- }
-
- my $ret = PXT::HTML->select(-name => $formvar,
- -size => 1,
- -options => \@opts);
-
- return $ret;
-}
-
sub paginate_variables {
my $class = shift;
my $block = shift;
@@ -346,26 +249,6 @@ sub random_password {
return $ret;
}
-sub prefix_selectbox {
- my ($class, $formvar, $default) = @_;
-
- my $dbh = RHN::DB->connect;
-
- my $sql = "SELECT text FROM web_user_prefix WHERE text <> '.' AND
text <> ' ' ORDER BY text";
-
- my $sth = $dbh->prepare($sql);
- $sth->execute;
-
- my @codes;
- while (my ($prefix) = $sth->fetchrow) {
- push @codes, [ $prefix, $prefix, $default ne '.' ? $default eq $prefix :
$prefix eq 'Mr.' ];
- }
- $sth->finish();
-
- return PXT::HTML->select(-name => $formvar,
- -options => \@codes);
-}
-
# take a positive integer, return a pretty version with commas
sub commafy {
my $class = shift;
@@ -376,42 +259,6 @@ sub commafy {
return scalar reverse $n;
}
-sub humanify {
- my $class = shift;
- my $n = shift;
- my $suffix = shift || '';
- my $dec = shift;
-
- my $unit = '';
- my $form;
- if ($dec) {
- $form = "%.${dec}f";
- }
- else {
- $form = "%d";
- }
-
- if ($n > 1 * 1024 * 1024 * 1024) {
- $n = sprintf $form, $n/1024/1024/1024;
- $unit = 'G';
- }
- elsif ($n > 1 * 1024 * 1024) {
- $n = sprintf $form, $n/1024/1024;
- $unit = 'M';
- }
- elsif ($n > 1 * 1024) {
- $n = sprintf $form, $n/1024;
- $unit = 'K';
- }
-
- if ($unit) {
- return "$n$unit$suffix";
- }
- else {
- return "$n$suffix";
- }
-}
-
sub untaint {
my $class = shift;
my $dref = shift;
@@ -439,27 +286,4 @@ sub random_bits {
}
-sub get_subtag_body {
- my $class = shift;
- my $tagname = shift;
- my $source = shift;
-
- if ($source =~ m{<$tagname>(.*?)</$tagname>}ism) {
- return $1;
- }
-
- return undef;
-}
-
-sub replace_subtag {
- my $class = shift;
- my $tagname = shift;
- my $target = shift;
- my $replacement = shift;
-
- $target =~ s{<$tagname>.*?</$tagname>}{$replacement}ism;
-
- return $target;
-}
-
1;
commit 7184ce8499f0668581982cad11983c41c97e457d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:04:06 2010 +0100
profiling_markpoint is not called anywhere, removing.
diff --git a/web/modules/pxt/PXT/ApacheHandler.pm b/web/modules/pxt/PXT/ApacheHandler.pm
index 03f2f8c..2fdfaa9 100644
--- a/web/modules/pxt/PXT/ApacheHandler.pm
+++ b/web/modules/pxt/PXT/ApacheHandler.pm
@@ -734,16 +734,5 @@ sub clear_profile_timer {
$last_profile_pt = 0;
}
-sub profiling_markpoint {
- my $now = Time::HiRes::time;
-
- my $where = join(": ", (caller)[1], (caller)[2]);
- my $delta = $last_profile_pt ? sprintf("%.03f", $now - $last_profile_pt) :
"begin";
-
- warn "profile pt: $now ($delta) at $where\n";
-
- $last_profile_pt = $now;
-}
-
1;
commit 882cf2574ed4323f925a4ee0baf8bf55737f7d72
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:01:06 2010 +0100
render_modes and sql_install_query are not called anywhere, removing.
diff --git a/web/modules/grail/Grail/Component.pm b/web/modules/grail/Grail/Component.pm
index 35adf74..56a2c2d 100644
--- a/web/modules/grail/Grail/Component.pm
+++ b/web/modules/grail/Grail/Component.pm
@@ -65,12 +65,6 @@ sub render_mapping {
return $self->{_render_map_}->{+shift};
}
-sub render_modes {
- my $self = shift;
-
- return keys %{$self->{_render_map_}};
-}
-
sub initialize {
my $self = shift;
@@ -78,24 +72,4 @@ sub initialize {
foreach $self->component_modes;
}
-sub sql_install_query {
- my $self = shift;
- my $pkg = ref $self ? ref $self : $self;
-
- my @ret;
-
- foreach my $c ($self->component_modes) {
- my $role = $c->[4] ? "'$c->[4]'" : 'NULL';
- my $config = $c->[3] ? "'$c->[3]'" : 'NULL';
- my $label = $c->[2] || '';
-
- push @ret, <<EOQ;
-INSERT INTO rhnGrailComponents (id, component_pkg, component_mode, config_mode,
component_label, role_required)
- VALUES (rhn_grail_components_seq.nextval, '$pkg', '$c->[0]',
$config, '$label', $role);
-EOQ
- }
-
- return join("", @ret);
-}
-
1;