vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r10291: LJSUP-8339: lazy-cleanup worker is brock...

Committer: vsukhanov
LJSUP-8339: lazy-cleanup worker is brocken
A   trunk/cgi-bin/LJ/EventsFeed/EntryDeleted.pm
U   trunk/cgi-bin/LJ/Hooks/EventsFeed.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm
Added: trunk/cgi-bin/LJ/EventsFeed/EntryDeleted.pm
===================================================================
--- trunk/cgi-bin/LJ/EventsFeed/EntryDeleted.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/EventsFeed/EntryDeleted.pm	2011-03-24 05:36:15 UTC (rev 10291)
@@ -0,0 +1,27 @@
+package LJ::EventsFeed::EntryDeleted;
+
+use strict;
+use base 'LJ::EventsFeed';
+use Carp qw (croak);
+
+sub new {
+    my ($class, $u, $entry_url) = @_;
+
+    return $class->SUPER::new(
+                              userid      => $u->userid,
+                              userlogin   => $u->user,
+                              entry_url   => $entry_url,
+                             );
+}
+
+sub as_xml {
+    my $self = shift;
+    my $params = $self->params;
+
+    return $self->xml_head('entry_deleted') 
+            . "<journal name='$params->{userlogin}' id='$params->{userid}' />"
+            . "<entry url='$params->{entry_url}' />"
+            . $self->xml_footer;
+}
+
+1;

Modified: trunk/cgi-bin/LJ/Hooks/EventsFeed.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/EventsFeed.pm	2011-03-24 03:32:03 UTC (rev 10290)
+++ trunk/cgi-bin/LJ/Hooks/EventsFeed.pm	2011-03-24 05:36:15 UTC (rev 10291)
@@ -174,11 +174,19 @@
 LJ::register_hook('deletepost', sub {
     # deletepost
     my ($jid, $jitemid, $anum) = @_;
+    return unless LJ::is_enabled('events-feed-post-events');
+
     my $u     = LJ::load_userid($jid);
-    my $entry = LJ::Entry->new($u, jitemid => $jitemid);
 
-    return unless LJ::is_enabled('events-feed-post-events');
-    LJ::EventsFeed::EntryUpdated->new($u, $entry)->fire();
+    ## object LJ::Entry cann't load its data from DB,
+    ## because the data has been removed to this moment.
+    ## my $entry = LJ::Entry->new($u, jitemid => $jitemid);
+
+    ## construct entry URL manually.
+    my $ditemid = $jitemid * 256 + $anum;
+    my $entry_url = $u->journal_base . "/" . $ditemid . ".html";
+
+    LJ::EventsFeed::EntryDeleted->new($u, $entry_url)->fire();
 });
 
 LJ::register_hook('new_comment', sub {

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm	2011-03-24 03:32:03 UTC (rev 10290)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm	2011-03-24 05:36:15 UTC (rev 10291)
@@ -56,7 +56,7 @@
     my $chunk_size = $LJ::IS_DEV_SERVER ? 10 : 1000;
     my $exclude_protected_journals = LJ::UserManage::_exclude_protected_journals_clause();
     my $selected = $dbh->selectall_arrayref(qq{
-        SELECT journalid, jitemid 
+        SELECT journalid, jitemid, anum 
         FROM   log2
         WHERE  posterid = ?
         $exclude_protected_journals
@@ -81,7 +81,7 @@
                     WHERE journalid=? AND jitemid=?
                 }, undef, $row->{'journalid'}, $row->{'jitemid'});
             } else {
-                LJ::delete_entry($journalu, $row->{jitemid});
+                LJ::delete_entry($journalu, $row->{jitemid}, undef, $row->{anum});
             }
         }
         ## respawn self for leftover comments

Tags: ljcom, pm, vadvs
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