madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20440: LJSUP-10239: 500 error on Omega server w...

Committer: sbelyaev
LJSUP-10239: 500 error on Omega server when try open journal where was sticky post
U   trunk/cgi-bin/LJ/User.pm
U   trunk/cgi-bin/ljlib.pl
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-10-26 12:57:53 UTC (rev 20439)
+++ trunk/cgi-bin/LJ/User.pm	2011-10-26 20:09:49 UTC (rev 20440)
@@ -6254,7 +6254,7 @@
 }
 
 # returns sticky entry jitemid
-sub remove_sticky_id {
+sub remove_sticky_entry_id {
     my ($self) = @_;
     my $ownerid = $self->userid;
     LJ::MemCache::delete([$ownerid, "log2lt:$ownerid"]);

Modified: trunk/cgi-bin/ljlib.pl
===================================================================
--- trunk/cgi-bin/ljlib.pl	2011-10-26 12:57:53 UTC (rev 20439)
+++ trunk/cgi-bin/ljlib.pl	2011-10-26 20:09:49 UTC (rev 20440)
@@ -1308,31 +1308,32 @@
     if ( $sticky && $show_sticky_on_top ) {
         if ( !$skip_sticky ) {
             my $entry = LJ::Entry->new( $u, 'jitemid' => $sticky );
-            my $alldatepart;
-            my $system_alldatepart;
+            if ($entry && $entry->valid) {
+                my $alldatepart;
+                my $system_alldatepart;
 
-            if ($opts->{'dateformat'} eq "S2") {
-                 $alldatepart = LJ::TimeUtil->alldatepart_s2($entry->eventtime_mysql);
-                 $system_alldatepart = LJ::TimeUtil->alldatepart_s2($entry->logtime_mysql);
-            } else {
-                 $alldatepart = LJ::TimeUtil->alldatepart_s1($entry->eventtime_mysql);
-                 $system_alldatepart = LJ::TimeUtil->alldatepart_s1($entry->logtime_mysql);
-            }
+                if ($opts->{'dateformat'} eq "S2") {
+                    $alldatepart = LJ::TimeUtil->alldatepart_s2($entry->eventtime_mysql);
+                    $system_alldatepart = LJ::TimeUtil->alldatepart_s2($entry->logtime_mysql);
+                } else {
+                    $alldatepart = LJ::TimeUtil->alldatepart_s1($entry->eventtime_mysql);
+                    $system_alldatepart = LJ::TimeUtil->alldatepart_s1($entry->logtime_mysql);
+                }
 
-            my $item = {'itemid' => $sticky,
-                        'alldatepart'   => $alldatepart,
-                        'allowmask'     => $entry->allowmask,
-                        'posterid'      => $entry->posterid,
-                        'eventtime'     => $entry->eventtime_mysql,
-                        'system_alldatepart' => $system_alldatepart,
-                        'security'           => $entry->security,
-                        'anum'               => $entry->anum,
-                        'logtime'            => $entry->logtime_mysql,
-                      };
+                my $item = { 'itemid' => $sticky,
+                             'alldatepart'   => $alldatepart,
+                             'allowmask'     => $entry->allowmask,
+                             'posterid'      => $entry->posterid,
+                             'eventtime'     => $entry->eventtime_mysql,
+                             'system_alldatepart' => $system_alldatepart,
+                             'security'           => $entry->security,
+                             'anum'               => $entry->anum,
+                             'logtime'            => $entry->logtime_mysql, };
                             
-            push @items, $item;
-            push @{$opts->{'entry_objects'}}, $item;
-            push @{$opts->{'itemids'}}, $entry->jitemid;
+                push @items, $item;
+                push @{$opts->{'entry_objects'}}, $item;
+                push @{$opts->{'itemids'}}, $entry->jitemid;
+            }
         }
 
         # sticky exculustion

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2011-10-26 12:57:53 UTC (rev 20439)
+++ trunk/cgi-bin/ljprotocol.pl	2011-10-26 20:09:49 UTC (rev 20440)
@@ -2808,7 +2808,7 @@
         };
 
         if ( $itemid == $uowner->get_sticky_entry_id() ) {
-            $uowner->remove_sticky_id();
+            $uowner->remove_sticky_entry_id();
         }
 
         return $res;
@@ -2859,7 +2859,7 @@
         }
     }
     elsif ( $itemid == $uowner->get_sticky_entry_id() ) {
-        $uowner->remove_sticky_id();
+        $uowner->remove_sticky_entry_id();
     }
 
     ## give features

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