[livejournal] r19830: LJSUP-9616: statistics added
Committer: sbelyaev
LJSUP-9616: statistics addedU trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl 2011-08-25 06:56:45 UTC (rev 19829)
+++ trunk/cgi-bin/ljprotocol.pl 2011-08-25 07:04:56 UTC (rev 19830)
@@ -19,6 +19,7 @@
);
use LJ::TimeUtil;
+use POSIX;
LJ::Config->load;
@@ -2088,6 +2089,29 @@
}
};
+ # LJSUP-9616
+ if ($req->{'props'}->{'opt_backdated'}) {
+ my $state_date = POSIX::strftime("%Y-%m-%d", gmtime);
+ my $key = "stat:opt_backdated:$state_date";
+
+ LJ::MemCache::incr($key, 1) ||
+ (LJ::MemCache::add($key, 0), LJ::MemCache::incr($key, 1));
+
+ my @ltime = gmtime(time());
+ my $current = sprintf("%04d-%02d-%02d %02d:%02d",
+ $ltime[5]+1900,
+ $ltime[4] + 1,
+ $ltime[3],
+ $ltime[2],
+ $ltime[1]);
+
+ if ($eventtime ge $current) {
+ my $key_future = "stat:opt_backdated:future:$state_date";
+ LJ::MemCache::incr($key_future, 1) ||
+ (LJ::MemCache::add($key_future, 0), LJ::MemCache::incr($key, 1));
+ }
+ }
+
my $need_moderated = ( $uowner->{'moderated'} =~ /^[1A]$/ ) ? 1 : 0;
if ( $uowner->{'moderated'} eq 'F' ) {
## Scan post for spam
