Foorum
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Foorum/ResultSet/Forum.pm view on Meta::CPAN
}
sub get_forum_url {
my ( $self, $forum ) = @_;
my $forum_url = '/forum/' . $forum->{forum_code};
return $forum_url;
}
sub update_forum {
my ( $self, $forum_id, $update ) = @_;
my $schema = $self->result_source->schema;
my $cache = $schema->cache();
$self->search( { forum_id => $forum_id } )->update($update);
$cache->remove("forum|forum_id=$forum_id");
if ( $update->{forum_code} ) {
lib/Foorum/ResultSet/Topic.pm view on Meta::CPAN
$schema->resultset('User')->update_user(
$user,
{ threads => \'threads + 1',
point => \'point + 2',
}
);
return $topic;
}
sub update_topic {
my ( $self, $topic_id, $update ) = @_;
my $schema = $self->result_source->schema;
my $cache = $schema->cache();
$self->search( { topic_id => $topic_id } )->update($update);
$cache->remove("topic|topic_id=$topic_id");
}
lib/Foorum/ResultSet/User.pm view on Meta::CPAN
}
sub delete_cache_by_user_cond {
my ( $self, $cond ) = @_;
my $user = $self->get($cond);
$self->delete_cache_by_user($user);
}
# call this update will delete cache.
sub update_user {
my ( $self, $user, $update ) = @_;
$self->delete_cache_by_user($user);
$self->search( { user_id => $user->{user_id} } )->update($update);
}
# update threads and replies count
sub update_threads_and_replies {
my ( $self, $user ) = @_;
my $schema = $self->result_source->schema;
# get $threads + $replies
my $total = $schema->resultset('Comment')->count(
{ author_id => $user->{user_id},
object_type => 'topic',
}
);
lib/Foorum/TheSchwartz/Worker/Scraper.pm view on Meta::CPAN
$name = substr( $name, 0, 24 );
my $rs = $schema->resultset('Variables')->search(
{ type => 'log',
name => $name
}
)->first;
return $rs ? $rs->value : 0;
}
sub update_last_scraped_msg_id {
my ( $schema, $name, $value ) = @_;
$name = substr( $name, 0, 24 );
$schema->resultset('Variables')->search(
{ type => 'log',
name => $name,
}
)->delete;
$schema->resultset('Variables')->create(
{ type => 'log',
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.295 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )