Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r19288: LJSUP-8584 (ONTD: Top tags for month)

Committer: ailyin
LJSUP-8584 (ONTD: Top tags for month)
A   trunk/bin/stat/
A   trunk/bin/stat/calculate-recent-logtags.pl
Added: trunk/bin/stat/calculate-recent-logtags.pl
===================================================================
--- trunk/bin/stat/calculate-recent-logtags.pl	                        (rev 0)
+++ trunk/bin/stat/calculate-recent-logtags.pl	2011-06-15 08:08:40 UTC (rev 19288)
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use lib "$ENV{'LJHOME'}/cgi-bin";
+require 'ljlib.pl';
+
+use Getopt::Long;
+
+my ( $journal_username, $days, $usage );
+
+my $getopt_result = GetOptions(
+    'journal=s'     => \$journal_username,
+    'days=i'        => \$days,
+    'help|usage'    => \$usage
+);
+
+if ( $usage || !$getopt_result || !$journal_username || !$days ) {
+    usage();
+}
+
+my $journalu = LJ::load_user($journal_username);
+unless ($journalu) {
+    die "$journal_username: no such user\n";
+}
+
+my $tags_info = LJ::Tags::calculate_recent_logtags( $journalu, $days );
+my $propval = LJ::text_compress( LJ::JSON->to_json($tags_info) );
+$journalu->set_prop( 'recent_logtags' => $propval );
+
+sub usage {
+    print while ( <DATA> );
+    exit;
+    return;
+}
+
+__DATA__
+Usage:
+
+bin/stat/calculate-recent-logtags.pm --journal ohnotheydidnt --days 30
+bin/stat/calculate-recent-logtags.pm --help


Property changes on: trunk/bin/stat/calculate-recent-logtags.pl
___________________________________________________________________
Added: svn:executable
   + *

Tags: andy, livejournal, pl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments