From 67502a510482fb9c3d101b2d1ccde96d1ed14e30 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Tue, 10 Apr 2012 09:10:46 -0400 Subject: [PATCH] SuperCat fixes - Child Init Sometimes it seems that child_init has not run properly for supercat. This attempts to fix that by checking for the global appsession objects. If they are not there we run child_init. The function that does this is being called from all handler entry functions. Signed-off-by: Thomas Berezansky Signed-off-by: Bill Erickson --- .../src/perlmods/lib/OpenILS/WWW/SuperCat.pm | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm index f47ad27f7c..bc33b81f37 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm @@ -273,6 +273,14 @@ sub child_init { } } +sub check_child_init() { + if (!defined $supercat || !defined $actor || !defined $search) { + # For some reason one (or more) of our appsessions is missing.... + # So init! + child_init(); + } +} + =head2 parse_feed_type($type) Determines whether and how a given feed type needs to be "fleshed out" @@ -367,6 +375,8 @@ sub oisbn { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + (my $isbn = $apache->path_info) =~ s{^.*?([^/]+)$}{$1}o; my $list = $supercat @@ -398,6 +408,8 @@ sub unapi { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + my $cgi = new CGI; my $add_path = 0; @@ -727,6 +739,8 @@ sub supercat { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + my $cgi = new CGI; my $add_path = 0; @@ -966,6 +980,8 @@ sub bookbag_feed { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + my $cgi = new CGI; my $year = (gmtime())[5] + 1900; @@ -1056,6 +1072,8 @@ sub changes_feed { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + my $cgi = new CGI; my $year = (gmtime())[5] + 1900; @@ -1203,6 +1221,8 @@ sub opensearch_feed { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + my $cgi = new CGI; my $year = (gmtime())[5] + 1900; @@ -1518,6 +1538,8 @@ sub string_browse { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + my $cgi = new CGI; my $year = (gmtime())[5] + 1900; @@ -1601,6 +1623,8 @@ sub string_startwith { my $apache = shift; return Apache2::Const::DECLINED if (-e $apache->filename); + check_child_init(); + my $cgi = new CGI; my $year = (gmtime())[5] + 1900; @@ -1812,6 +1836,8 @@ my $ex_doc; sub sru_search { my $cgi = new CGI; + check_child_init(); + my $req = SRU::Request->newFromCGI( $cgi ); my $resp = SRU::Response->newFromRequest( $req ); @@ -2022,6 +2048,8 @@ my $auth_ex_doc; sub sru_auth_search { my $cgi = new CGI; + check_child_init(); + my $req = SRU::Request->newFromCGI( $cgi ); my $resp = SRU::Response->newFromRequest( $req ); -- 2.43.2