[Cpan-forum-commit] rev 328 - in trunk: . lib/CPAN lib/CPAN/Forum/DB lib/CPAN/Forum/RM
svn at pti.co.il
svn at pti.co.il
Mon Aug 13 21:43:01 EEST 2007
Author: gabor
Date: 2007-08-13 21:43:01 +0300 (Mon, 13 Aug 2007)
New Revision: 328
Modified:
trunk/
trunk/lib/CPAN/Forum.pm
trunk/lib/CPAN/Forum/DB/Groups.pm
trunk/lib/CPAN/Forum/RM/Search.pm
trunk/lib/CPAN/Forum/RM/Subscriptions.pm
Log:
separate out the _search_modules method
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4396
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
+ 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4410
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
Modified: trunk/lib/CPAN/Forum/DB/Groups.pm
===================================================================
--- trunk/lib/CPAN/Forum/DB/Groups.pm 2007-08-10 15:34:15 UTC (rev 327)
+++ trunk/lib/CPAN/Forum/DB/Groups.pm 2007-08-13 18:43:01 UTC (rev 328)
@@ -58,7 +58,7 @@
sub add {
my ($self, %args) = @_;
- Carp::croak("DB::Groups->add requires name and gtype fields")
+ Carp::croak("add requires name and gtype fields")
if not $args{name} or not defined $args{gtype} or not $args{pauseid}; #version
my ($fields, $placeholders, @values) = $self->_prep_insert(\%args);
Modified: trunk/lib/CPAN/Forum/RM/Search.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Search.pm 2007-08-10 15:34:15 UTC (rev 327)
+++ trunk/lib/CPAN/Forum/RM/Search.pm 2007-08-13 18:43:01 UTC (rev 328)
@@ -99,25 +99,7 @@
}
if ($what eq "module" or $what eq "pauseid") {
- my $it;
- if ($what eq "module") {
- $it = CPAN::Forum::DB::Groups->search_like(name => '%' . $name . '%');
- } else {
- my $author = CPAN::Forum::DB::Authors->get_author_by_pauseid($name);
- if ($author) {
- $it = CPAN::Forum::DB::Groups->search(pauseid => $author->{id});
- }
- $t->param(pauseid_name => uc $name)
- }
- my @things;
- if ($it) {
- while (my $group = $it->next) {
- push @things, {name => $group->name};
- }
- }
- $any_result = 1 if @things;
- $t->param(groups => \@things);
- $t->param($what => 1);
+ $any_result = $self->_search_modules($t, $what, $name);
} elsif ($what eq "user") {
my @things;
my $it = CPAN::Forum::DB::Users->search_like(username => '%' . lc($name) . '%');
@@ -145,5 +127,30 @@
$t->output;
}
+sub _search_modules {
+ my ($self, $t, $what, $name) = @_;
+
+ my $it;
+ if ($what eq "module") {
+ $it = CPAN::Forum::DB::Groups->search_like(name => '%' . $name . '%');
+ } else {
+ my $author = CPAN::Forum::DB::Authors->get_author_by_pauseid($name);
+ if ($author) {
+ $it = CPAN::Forum::DB::Groups->search(pauseid => $author->{id});
+ }
+ $t->param(pauseid_name => uc $name)
+ }
+ my @things;
+ if ($it) {
+ while (my $group = $it->next) {
+ push @things, {name => $group->name};
+ }
+ }
+ $t->param(groups => \@things);
+ $t->param($what => 1);
+ return @things ? 1 : 0;
+}
+
+
1;
Modified: trunk/lib/CPAN/Forum/RM/Subscriptions.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Subscriptions.pm 2007-08-10 15:34:15 UTC (rev 327)
+++ trunk/lib/CPAN/Forum/RM/Subscriptions.pm 2007-08-13 18:43:01 UTC (rev 328)
@@ -233,7 +233,7 @@
my $pauseid = uc $q->param("name");
my $author = CPAN::Forum::DB::Authors->get_author_by_pauseid($pauseid); # SQL
if ($author) {
- my $s = CPAN::Forum::DB::Subscriptions_pauseid->find_or_create({
+ my $s = CPAN::Forum::DB::Subscriptions_pauseid->find_or_create({ # not SQL
uid => $uid,
pauseid => $author->{id},
});
@@ -247,7 +247,7 @@
$name =~ s/::/-/g;
my $group = CPAN::Forum::DB::Groups->info_by(name => $name); # SQL
if ($group) {
- my $s = CPAN::Forum::DB::Subscriptions->find_or_create({
+ my $s = CPAN::Forum::DB::Subscriptions->find_or_create({ # not SQL
uid => $uid,
gid => $group->{id},
});
Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm 2007-08-10 15:34:15 UTC (rev 327)
+++ trunk/lib/CPAN/Forum.pm 2007-08-13 18:43:01 UTC (rev 328)
@@ -1442,7 +1442,7 @@
} else {
$self->log->debug("Processing messages for followups, users who posted in this thread");
- my $uids = CPAN::Forum::DB::Posts->list_uids_who_posted_in_thread($post->{thread});
+ my $uids = CPAN::Forum::DB::Posts->list_uids_who_posted_in_thread($post->{thread}); #SQL
$self->log->debug(Data::Dumper->Dump([$uids], ['uids']));
my %uids = map {{ $_ => 1 }} @$uids;
More information about the Cpan-forum-commit
mailing list