1 # This is a module for returning stats info
2 # Functions in statslib.pl should get moved here
11 sub get_popular_interests
{
12 my $memkey = 'pop_interests';
15 # Try to fetch from memcache
16 my $mem = LJ
::MemCache
::get
($memkey);
23 my $dbr = LJ
::get_db_reader
();
25 = $dbr->selectall_arrayref(
26 "SELECT statkey, statval FROM stats WHERE " . "statcat=? ORDER BY statval DESC, statkey ASC",
27 undef, 'pop_interests' );
28 return undef if $dbr->err;
31 my $rv = LJ
::MemCache
::set
( $memkey, \@
$ints, 3600 );
37 my ($user, $user_url) = @_;
39 my $dbr = LJ
::get_db_reader
();
41 = $dbr->selectall_arrayref( "SELECT statkey FROM stats WHERE statcat='pop_faq' ORDER BY statval DESC LIMIT 10",
46 foreach my $r (@
$rows) {
47 my $f = LJ
::Faq
->load( $r->{statkey
}, 'lang' => LJ
::Lang
::current_language
() );
48 $f->render_in_place( { user
=> $user, url
=> $user_url } );
49 my $q = $f->question_html;
50 my $link = $f->page_url;
51 push @
$faq, { link => $link, question
=> $q };