madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r19797: LJSUP-9307: Delayed entries bugfix. Opti...

Committer: sbelyaev
LJSUP-9307: Delayed entries bugfix. Option 'cluster' is added to 'delayed entry poster' worker.
U   branches/delayed_entries/bin/worker/delayed-entries-poster
U   branches/delayed_entries/cgi-bin/LJ/DelayedEntry/Scheduler.pm
U   branches/delayed_entries/cgi-bin/LJ/DelayedEntry.pm
U   branches/delayed_entries/cgi-bin/ljprotocol.pl
U   branches/delayed_entries/htdocs/editjournal.bml
U   branches/delayed_entries/htdocs/update.bml
Modified: branches/delayed_entries/bin/worker/delayed-entries-poster
===================================================================
--- branches/delayed_entries/bin/worker/delayed-entries-poster	2011-08-20 11:28:42 UTC (rev 19796)
+++ branches/delayed_entries/bin/worker/delayed-entries-poster	2011-08-22 02:59:07 UTC (rev 19797)
@@ -15,8 +15,28 @@
 
 use LJ::DelayedEntry::Scheduler;
 
+my $cluster;
+
+sub options {
+    my $self = shift;
+    return (
+        'cluster|c=i'  => \$cluster,
+        $self->SUPER::options(),
+    );
+}
+
+sub call_for_cluster {
+    my $coderef = shift;
+    my $opts = shift || {};
+
+    my $dbr = ($LJ::IS_DEV_SERVER) ?
+            LJ::get_cluster_reader($cluster) : LJ::DBUtil->get_inactive_db($cluster, $opts->{verbose});
+    $coderef->($cluster, $dbr);
+}
+
+
 sub work {
-    LJ::foreach_cluster( sub { LJ::DelayedEntry::Scheduler::on_pulse(@_); } );
+    call_for_cluster( sub { LJ::DelayedEntry::Scheduler::on_pulse(@_); } );
     return 1 if __PACKAGE__->should_quit;
     return 0;
 }
@@ -25,4 +45,3 @@
     sleep LJ::DelayedEntry::Scheduler::pulse_time();
 ;
 }
-

Modified: branches/delayed_entries/cgi-bin/LJ/DelayedEntry/Scheduler.pm
===================================================================
--- branches/delayed_entries/cgi-bin/LJ/DelayedEntry/Scheduler.pm	2011-08-20 11:28:42 UTC (rev 19796)
+++ branches/delayed_entries/cgi-bin/LJ/DelayedEntry/Scheduler.pm	2011-08-22 02:59:07 UTC (rev 19797)
@@ -6,7 +6,7 @@
 use warnings;
 use Data::Dumper;
 
-my $PULSE_TIME = 1 * 10;
+my $PULSE_TIME = 1 * 60; 
 
 sub pulse_time {
     return $PULSE_TIME;

Modified: branches/delayed_entries/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- branches/delayed_entries/cgi-bin/LJ/DelayedEntry.pm	2011-08-20 11:28:42 UTC (rev 19796)
+++ branches/delayed_entries/cgi-bin/LJ/DelayedEntry.pm	2011-08-22 02:59:07 UTC (rev 19797)
@@ -1389,10 +1389,6 @@
 sub __get_now {
     my $dt = DateTime->now->set_time_zone('UTC');
 
-    if ($dt->is_dst) {
-        $dt->subtract( hours => 1 );
-    }
-
     # make the proper date format
     return sprintf("%04d-%02d-%02d %02d:%02d",  $dt->year, 
                                                 $dt->month,
@@ -1413,9 +1409,9 @@
                               minute    => $req->{'min'},
                               time_zone => $req->{timezone}, );
 
-    if ($dt->is_dst) {
-        $dt->subtract( hours => 1 );
-    }
+    #if ($dt->is_dst) {
+    #    $dt->subtract( hours => 1 );
+    #}
 
     $dt->set_time_zone( 'UTC' );
 

Modified: branches/delayed_entries/cgi-bin/ljprotocol.pl
===================================================================
--- branches/delayed_entries/cgi-bin/ljprotocol.pl	2011-08-20 11:28:42 UTC (rev 19796)
+++ branches/delayed_entries/cgi-bin/ljprotocol.pl	2011-08-22 02:59:07 UTC (rev 19797)
@@ -65,6 +65,7 @@
          LJ::tosagree_str('protocol' => 'title')
      } ],
      "157" => [ E_TEMP, "Tags error" ],
+     "158" => [ E_TEMP, "You have no rights to make this entry sticky"],
 
      # Client Errors
      "200" => [ E_PERM, "Missing required argument(s)" ],
@@ -1972,7 +1973,7 @@
           !( LJ::check_rel($ownerid, $posterid, 'S') ||
              LJ::check_rel($ownerid, $posterid, 'M') ) )
     {
-        return fail($err, 174);
+        return fail($err, 158);
     }
 
     my $qallowmask = $req->{'allowmask'}+0;
@@ -2251,6 +2252,14 @@
                      "UNIX_TIMESTAMP($qeventtime), $rlogtime, $anum)");
     return $fail->($err,501,$dberr) if $dberr;
 
+    if ( $req->{type} && $req->{type} eq 'sticky' &&
+         $uowner->{'journaltype'} eq 'C' &&
+          !( LJ::check_rel($ownerid, $posterid, 'S') ||
+             LJ::check_rel($ownerid, $posterid, 'M') ) )
+    {
+        return fail($err, 158);
+    }
+
     # post become 'sticky post'
     if ( $req->{type} && $req->{type} eq 'sticky' ) {
         $uowner->set_sticky($jitemid);

Modified: branches/delayed_entries/htdocs/editjournal.bml
===================================================================
--- branches/delayed_entries/htdocs/editjournal.bml	2011-08-20 11:28:42 UTC (rev 19796)
+++ branches/delayed_entries/htdocs/editjournal.bml	2011-08-22 02:59:07 UTC (rev 19797)
@@ -267,7 +267,7 @@
                             'ver'        => $LJ::PROTOCOL_VER,
                             'username'   => $u->{'user'},
                             'usejournal' => $usejournal,
-                            'timezone'   => $POST{'delayed_timezone'} || $POST{'delayed_timezone'},
+                            'timezone'   => $POST{'timezone'} || $POST{'timezone'},
                             'itemid'     => $itemid,
                             'delayedid'  => $delayedid,
                             'type'       => $POST{'type'} || $POST{'type'},

Modified: branches/delayed_entries/htdocs/update.bml
===================================================================
--- branches/delayed_entries/htdocs/update.bml	2011-08-20 11:28:42 UTC (rev 19796)
+++ branches/delayed_entries/htdocs/update.bml	2011-08-22 02:59:07 UTC (rev 19797)
@@ -460,7 +460,7 @@
                     'password'    => $POST{'password'},
                     'usejournal'  => ($usejournalu) ? $usejournalu->user : undef,
                     'tz'          => 'guess',
-                    'timezone'    => $POST{'delayed_timezone'} || $POST{'delayed_timezone'},
+                    'timezone'    => $POST{'timezone'} || $POST{'timezone'},
                     'type'        => $POST{'type'} || $POST{'type'},
                     );
 

Tags: bml, livejournal, madeon, pl, pm
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