ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[livejournal] r17593: LJSV-1030: Suspended entries shouldn't b...

Committer: ssafronova
LJSV-1030: Suspended entries shouldn't be considered when displaying recent entries
A   trunk/bin/misc/fire-mark-suspended.pl
A   trunk/bin/worker/mark-suspended-entries
Added: trunk/bin/misc/fire-mark-suspended.pl
===================================================================
--- trunk/bin/misc/fire-mark-suspended.pl	                        (rev 0)
+++ trunk/bin/misc/fire-mark-suspended.pl	2010-10-22 09:50:29 UTC (rev 17593)
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+#
+use strict;
+use lib "$ENV{LJHOME}/cgi-bin";
+require 'ljlib.pl';
+
+# fire job for marking entries posted by suspended account
+
+my $action = shift;
+my $userid = shift;
+die "Usage: fire-mark-suspended.pl suspend|unsuspend userid|username" unless $userid;
+
+unless ($userid =~ /^\d+$/) {
+    my $u = LJ::load_user($userid);
+    die "Usage: fire-mark-suspended.pl userid|username" unless $u;
+    $userid = $u->userid;
+}
+
+my $event = $action eq 'suspend' ? 'LJ::Worker::MarkSuspendedEntries::mark' : 'LJ::Worker::MarkSuspendedEntries::unmark';
+
+my $job = TheSchwartz::Job->new_from_array($event, { userid => $userid });
+my $sclient = LJ::theschwartz();
+
+die "Cannot get TheSchwartz client" unless $sclient;
+die "Cannot make a job" unless $job;
+$sclient->insert_jobs($job);
+
+print "Event Fired!\n";


Property changes on: trunk/bin/misc/fire-mark-suspended.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/bin/worker/mark-suspended-entries
===================================================================
--- trunk/bin/worker/mark-suspended-entries	                        (rev 0)
+++ trunk/bin/worker/mark-suspended-entries	2010-10-22 09:50:29 UTC (rev 17593)
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+use strict;
+use lib "$ENV{LJHOME}/cgi-bin";
+require 'ljlib.pl';
+require 'ljprotocol.pl';
+require 'ljlang.pl';
+
+package LJ::NewWorker::TheSchwartz::MarkSuspendedEntries;
+use base 'LJ::NewWorker::TheSchwartz';
+sub capabilities { qw/LJ::Worker::MarkSuspendedEntries::mark LJ::Worker::MarkSuspendedEntries::unmark/ };
+
+__PACKAGE__->start;
+
+package LJ::Worker::MarkSuspendedEntries::mark;
+use base 'TheSchwartz::Worker';
+
+sub work {
+    my ($class, $job) = @_;
+    my $args = $job->arg;
+    my $userid = $args->{userid};
+
+    foreach my $cid (@LJ::CLUSTERS) {
+        my $dbh = LJ::get_cluster_master($cid);
+        return unless $dbh;
+
+        $dbh->do("UPDATE log2 SET compressed='S' WHERE posterid=?", undef, $userid);
+    }
+
+    $job->completed;
+}
+
+package LJ::Worker::MarkSuspendedEntries::unmark;
+use base 'TheSchwartz::Worker';
+
+sub work {
+    my ($class, $job) = @_;
+    my $args = $job->arg;
+    my $userid = $args->{userid};
+
+    foreach my $cid (@LJ::CLUSTERS) {
+        my $dbh = LJ::get_cluster_master($cid);
+        return unless $dbh;
+
+        $dbh->do("UPDATE log2 SET compressed='N' WHERE posterid=?", undef, $userid);
+    }
+
+    $job->completed;
+}
+
+
+1


Property changes on: trunk/bin/worker/mark-suspended-entries
___________________________________________________________________
Added: svn:executable
   + *

Tags: livejournal, pl, ssafronova
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