[Slashdotjp-dev 1178] [705] * Improve article.pl performance when non-user access

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2008年 7月 17日 (木) 16:04:45 JST


Revision: 705
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=705
Author:   tach
Date:     2008-07-17 16:04:45 +0900 (Thu, 17 Jul 2008)

Log Message:
-----------
 * Improve article.pl performance when non-user access
   - redirect to shtml internally

Modified Paths:
--------------
    slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm
    slashjp/branches/2.5.0.192/debian/changelog


-------------- next part --------------
Modified: slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm
===================================================================
--- slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm	2008-07-16 13:30:22 UTC (rev 704)
+++ slashjp/branches/2.5.0.192/Slash/Apache/Apache.pm	2008-07-17 07:04:45 UTC (rev 705)
@@ -450,6 +450,30 @@
 		return OK;
 	}
 
+	# return shtml internally when AC
+	# for slashdot.jp (2008-07-17)
+	if ($uri =~ m!^/(\w+/)?article\.pl$! && !$is_user) {
+		my $section = $1 || 'articles';
+		my $the_request = $r->the_request;
+		my $qs = {$the_request =~ m!\b(sid|threshold|mode|commentsort|lowbandwidth|simpledesign|light)=([-\w/]+)!g};
+
+		if ((defined($qs->{sid}) && $qs->{sid} =~ m|^\d{2}/\d{2}/\d{2}/\d{6,}$|) &&
+		    (!defined($qs->{threshold}) || $qs->{threshold} == 1) &&
+		    (!defined($qs->{mode}) || $qs->{mode} eq 'thread' ) &&
+		    (!defined($qs->{commentsort}) || $qs->{commentsort} == 3) &&
+		    !$qs->{lowbandwidth} &&
+		    !$qs->{simpledesign} &&
+		    !$qs->{light}) {
+			my $file = "$constants->{basedir}/$section/$qs->{sid}.shtml";
+			if (-r $file) {
+				$r->uri("/$section/$qs->{sid}.shtml");
+				$r->filename("$constants->{basedir}/$section/$qs->{sid}.shtml");
+				writeLog('shtml');
+				return OK;
+			}
+		}
+	}
+
 	# redirect to static if
 	# * not a user, nor a daypass holder,
 	# and

Modified: slashjp/branches/2.5.0.192/debian/changelog
===================================================================
--- slashjp/branches/2.5.0.192/debian/changelog	2008-07-16 13:30:22 UTC (rev 704)
+++ slashjp/branches/2.5.0.192/debian/changelog	2008-07-17 07:04:45 UTC (rev 705)
@@ -19,8 +19,10 @@
   * Add simple pollBooth URL
     - "/polls" and "/polls/{qid}"
   * Add feature: display pollBooth RSS on "/polls/rss"
+  * Improve article.pl performance when non-user access
+    - redirect to shtml internally
 
- -- Taku YASUI <tach****@osdn*****>  Wed, 16 Jul 2008 13:28:06 +0000
+ -- Taku YASUI <tach****@osdn*****>  Thu, 17 Jul 2008 07:03:47 +0000
 
 slash (2.5.0.192-15) unstable; urgency=low
 


Slashdotjp-dev メーリングリストの案内
Zurück zum Archiv-Index