[livejournal] r17359: LJSUP-6778: load ad_base.css on journal ...
Committer: vsukhanov
LJSUP-6778: load ad_base.css on journal pages with "?v" param.U trunk/cgi-bin/LJ/S2.pm U trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm 2010-09-13 07:33:56 UTC (rev 17358)
+++ trunk/cgi-bin/LJ/S2.pm 2010-09-13 07:34:17 UTC (rev 17359)
@@ -2044,7 +2044,8 @@
$p->{'head_content'} .= $u->openid_tags if $opts && $opts->{'addopenid'};
# Ads and control strip
- $p->{'head_content'} .= qq{<link rel='stylesheet' href='$LJ::STATPREFIX/ad_base.css' type='text/css' />\n};
+ my $ad_base_url = LJ::stat_src_to_url('/ad_base.css');
+ $p->{'head_content'} .= qq{<link rel='stylesheet' href='$ad_base_url' type='text/css' />\n};
my $show_control_strip = LJ::run_hook('show_control_strip', {
user => $u->{user},
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl 2010-09-13 07:33:56 UTC (rev 17358)
+++ trunk/cgi-bin/weblib.pl 2010-09-13 07:34:17 UTC (rev 17359)
@@ -1222,18 +1222,20 @@
}
}
- my $set = sub {
- my $mtime = shift;
- $stat_cache{$key} = { lastcheck => $now, modtime => $mtime };
- return $mtime;
- };
-
my $file = "$LJ::HOME/htdocs/$key";
my $mtime = (stat($file))[9];
- return $set->($mtime);
+ $stat_cache{$key} = { lastcheck => $now, modtime => $mtime };
+ return $mtime;
}
}
+sub stat_src_to_url {
+ my $url = shift;
+ my $mtime = _file_modtime("/stc" . $url, time);
+ return $LJ::STATPREFIX . $url . "?v=" . $mtime;
+}
+
+
## Support for conditional file inclusion:
## e.g. LJ::need_res( {condition => 'IE'}, 'ie.css', 'myie.css') will result in
## <!--[if IE]><link rel="stylesheet" type="text/css" href="$statprefix/..." /><![endif]-->
