vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r17489: Site optimization

Committer: vsukhanov
Site optimization
U   trunk/cgi-bin/LJ/Hooks/WebmasterTools.pm
U   trunk/cgi-bin/LJ/SiteMessages.pm
U   trunk/cgi-bin/LJ/User.pm
U   trunk/cgi-bin/ljlang.pl
Modified: trunk/cgi-bin/LJ/Hooks/WebmasterTools.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/WebmasterTools.pm	2010-10-04 03:23:27 UTC (rev 17488)
+++ trunk/cgi-bin/LJ/Hooks/WebmasterTools.pm	2010-10-04 04:24:12 UTC (rev 17489)
@@ -7,7 +7,8 @@
 
     my $journal = LJ::get_active_journal();
     return unless $journal;
-
+    
+    $journal->preload_props(qw/webmastertools_google webmastertools_yandex/);
     if (my $content = $journal->prop('webmastertools_google')) {
         $$headref .= qq{
             <meta name="google-site-verification" content="$content" /> 

Modified: trunk/cgi-bin/LJ/SiteMessages.pm
===================================================================
--- trunk/cgi-bin/LJ/SiteMessages.pm	2010-10-04 03:23:27 UTC (rev 17488)
+++ trunk/cgi-bin/LJ/SiteMessages.pm	2010-10-04 04:24:12 UTC (rev 17489)
@@ -298,6 +298,10 @@
     my $remote = LJ::get_remote();
     return unless $remote; # this feature only for logged in users
 
+    ## tiny optimization
+    $remote->preload_props(qw/country closed_sm/);
+
+    ##
     my @messages = $class->get_messages(user => $remote);
 
     my $closed = $remote->prop('closed_sm');

Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2010-10-04 03:23:27 UTC (rev 17488)
+++ trunk/cgi-bin/LJ/User.pm	2010-10-04 04:24:12 UTC (rev 17489)
@@ -5078,6 +5078,7 @@
 sub adult_content_calculated {
     my $u = shift;
 
+    $u->preload_props(qw/admin_content_flag adult_content/);
     return "explicit" if $u->admin_content_flag eq "explicit_adult";
     return $u->adult_content;
 }
@@ -7096,7 +7097,7 @@
     ### populate userhead data
     if ($userhead !~ /^https?:\/\//) {
         my $imgroot = $opts->{'imgroot'} || $LJ::IMGPREFIX;
-        $userhead = $imgroot . '/' . $userhead;
+        $userhead = $imgroot . '/' . $userhead . "?v=1";
     }
 
     $userhead_h ||= $userhead_w;  # make square if only one dimension given

Modified: trunk/cgi-bin/ljlang.pl
===================================================================
--- trunk/cgi-bin/ljlang.pl	2010-10-04 03:23:27 UTC (rev 17488)
+++ trunk/cgi-bin/ljlang.pl	2010-10-04 04:24:12 UTC (rev 17489)
@@ -710,8 +710,10 @@
     my @langs = @_;
     push @langs, @LJ::LANGS unless @langs;
 
-    my @list;
+    my $list = LJ::MemCache::get("langnames");
+    return $list if $list;
 
+    $list = [];
     foreach my $code (@langs) {
         my $l = LJ::Lang::get_lang($code);
         next unless $l;
@@ -724,10 +726,13 @@
         ## Native lang name
         my $namenative = LJ::Lang::get_text($l->{'lncode'}, $item);
 
-        push @list, $code, $namenative;
+        push @$list, $code, $namenative;
     }
 
-    return \@list;
+    ## cache name on 5 min
+    LJ::MemCache::set("langnames" => $list, 3660);
+
+    return $list;
 }
 
 sub set_lang {

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