sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[livejournal] r23482: LJSUP-14653: Error when delete 1st spam ...

Committer: vtroitsky
LJSUP-14653: Error when delete 1st spam comment
U   trunk/cgi-bin/LJ/Entry.pm
Modified: trunk/cgi-bin/LJ/Entry.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry.pm	2012-12-18 14:20:29 UTC (rev 23481)
+++ trunk/cgi-bin/LJ/Entry.pm	2012-12-19 11:48:26 UTC (rev 23482)
@@ -2888,8 +2888,8 @@
 
     ##
     my $sql_sign = $action eq 'decr' ? '-' : '+';
-    my $sql = "UPDATE log2 SET replycount=LAST_INSERT_ID(replycount $sql_sign $value) WHERE journalid=? AND jitemid=?";
-    
+    my $sql = "UPDATE log2 SET replycount=LAST_INSERT_ID( ". ($sql_sign eq '-' ? "IF(replycount < $value, 0, replycount $sql_sign $value)" : "replycount $sql_sign $value"). " ) WHERE journalid=? AND jitemid=?";
+
     unless ( LJ::MemCache::can_gets() ){
     # used Cache::Memcached driver that does not support 'gets' and 'cas' commands
         $u->selectrow_array("SELECT GET_LOCK(?,10)", undef, $memkey);

Tags: livejournal, pm, sunnyman, vtroitsky
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