[interchange-cvs] interchange - heins modified 3 files

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Wed Nov 14 19:54:00 2001


User:      heins
Date:      2001-11-15 00:53:04 GMT
Modified:  scripts  interchange.PL
Modified:  lib/Vend Interpolate.pm Session.pm
Log:
	* Add new mv_tmp_session variable which bypasses session creation.

	* Add flag ($Vend::new_session) which indicates a new session
	  was issued.

	* Add new=1 option to [timed-build], which caches the page
	  and only issues it to a new session. This can make issuing
	  the initial index page very fast for new entrants, making
	  a "RedirectMatch  ^/$ /cgi-bin/something/ [R,L]" quite
	  reasonable.

Revision  Changes    Path
2.15      +12 -2     interchange/scripts/interchange.PL


rev 2.15, prev_rev 2.14
Index: interchange.PL
===================================================================
RCS file: /anon_cvs/repository/interchange/scripts/interchange.PL,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -r2.14 -r2.15
--- interchange.PL	2001/10/19 02:55:57	2.14
+++ interchange.PL	2001/11/15 00:53:04	2.15
@@ -50,7 +50,7 @@
 #
 # Interchange version 4.9.0
 #
-# $Id: interchange.PL,v 2.14 2001/10/19 02:55:57 mheins Exp $
+# $Id: interchange.PL,v 2.15 2001/11/15 00:53:04 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -1904,7 +1904,12 @@
 
 	$::Instance->{CookieName} = $Vend::Cfg->{CookieName};
 
-	if ($::Instance->{CookieName} and defined $CGI::cookie) {
+	if($CGI::values{mv_tmp_session}) {
+		$Vend::tmp_session = $Vend::new_session = 1;
+		$sessionid = 'nsession';
+		$Vend::Cookie = 1;
+	}
+	elsif ($::Instance->{CookieName} and defined $CGI::cookie) {
 		$CGI::cookie =~ m{$Vend::CookieName=($Vend::Cfg->{CookiePattern})};
 		$seed = $sessionid = $1;
 		$::Instance->{ExternalCookie} = $sessionid || 1;
@@ -1962,6 +1967,11 @@
     if ($sessionid) {
 		$Vend::SessionID = $sessionid;
     	$Vend::SessionName = session_name();
+		if($Vend::tmp_session) {
+			$Vend::Session = {};
+			init_session;
+			last RESOLVEID;
+		}
 		# get_session will return a value if a session is read,
 		# if not it will return false and a new session has been created.
 		# The IP address will be counted for robot_resolution



2.29      +24 -10    interchange/lib/Vend/Interpolate.pm


rev 2.29, prev_rev 2.28
Index: Interpolate.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.28
retrieving revision 2.29
diff -u -r2.28 -r2.29
--- Interpolate.pm	2001/11/09 23:34:52	2.28
+++ Interpolate.pm	2001/11/15 00:53:04	2.29
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.28 2001/11/09 23:34:52 mheins Exp $
+# $Id: Interpolate.pm,v 2.29 2001/11/15 00:53:04 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.28 $, 10);
+$VERSION = substr(q$Revision: 2.29 $, 10);
 
 @EXPORT = qw (
 
@@ -5802,6 +5802,8 @@
 		}
 	}
 
+	# This allows access from embedded Perl
+	$Tmp->{flycode} = $code;
 # TRACK
 	$Vend::Track->view_product($code);
 # END TRACK
@@ -6414,15 +6416,25 @@
 
 	$opt->{login} = 1 if $opt->{auto};
 
-	return Vend::Interpolate::interpolate_html($_[0])
-		if $abort
-		or ( ! $opt->{force}
-				and
-				(   ! $Vend::Cookie
-					or $Vend::BuildingPages
-					or ! $opt->{login} && $Vend::Session->{logged_in}
-				)
-			);
+	my $save_scratch;
+	if($opt->{new} and $Vend::new_session) {
+#::logDebug("we are new");
+		$save_scratch = $::Scratch;
+		$Vend::Cookie = 1;
+		$Vend::Session->{scratch} = { %{$Vend::Cfg->{ScratchDefault}}, mv_no_session_id => 1, mv_no_count => 1, mv_force_cache => 1 };
+		
+	}
+	else {
+		return Vend::Interpolate::interpolate_html($_[0])
+			if $abort
+			or ( ! $opt->{force}
+					and
+					(   ! $Vend::Cookie
+						or $Vend::BuildingPages
+						or ! $opt->{login} && $Vend::Session->{logged_in}
+					)
+				);
+	}
 	
 	if($opt->{auto}) {
 		$opt->{login} =    1 unless defined $opt->{login};
@@ -6496,9 +6508,11 @@
 			}
 		}
 # END STATICPAGE
+		$Vend::Session->{scratch} = $save_scratch if $save_scratch;
         return $out;
     }
-    else {        return Vend::Util::readfile($file);    }
+	$Vend::Session->{scratch} = $save_scratch if $save_scratch;
+	return Vend::Util::readfile($file);
 }
 
 sub update {



2.1       +3 -2      interchange/lib/Vend/Session.pm


rev 2.1, prev_rev 2.0
Index: Session.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Session.pm,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- Session.pm	2001/07/18 02:23:14	2.0
+++ Session.pm	2001/11/15 00:53:04	2.1
@@ -1,6 +1,6 @@
 # Vend::Session - Interchange session routines
 #
-# $Id: Session.pm,v 2.0 2001/07/18 02:23:14 jon Exp $
+# $Id: Session.pm,v 2.1 2001/11/15 00:53:04 mheins Exp $
 # 
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -26,7 +26,7 @@
 require Exporter;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.0 $, 10);
+$VERSION = substr(q$Revision: 2.1 $, 10);
 
 @ISA = qw(Exporter);
 
@@ -230,6 +230,7 @@
 			last unless exists $Vend::SessionDBM{$name};
 		}
     }
+	$Vend::new_session = 1;
 	count_ip(1);
 	undef $Vend::Cookie;
     $Vend::SessionName = $name;