From: Nick J. <nje...@us...> - 2002-03-08 06:57:33
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv25774/bin Modified Files: sandweb.cgi Log Message: * added return values to loading config files. * sandweb will now error out if a config file does not exist. Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.257 retrieving revision 1.258 diff -U2 -r1.257 -r1.258 --- sandweb.cgi 7 Mar 2002 09:15:53 -0000 1.257 +++ sandweb.cgi 8 Mar 2002 06:57:28 -0000 1.258 @@ -36,11 +36,19 @@ ); +if (!$return->{'errlev'}) { + # error loading config file + print header; + print("unable to open config file: $config_file in dir '$config_dir'"); + print("return data: <pre>" . Dumper($return) . "</pre>"); + exit(0); +} + # assign local references to the "global" objects # these should generally always be loaded, no matter # what action is going on. -my $config = $return->{'config'}; -my $log = $return->{'log'}; -my $ui = $return->{'ui'}; -my $auth = $return->{'auth'}; +my $config = $return->{'data'}->{'config'}; +my $log = $return->{'data'}->{'log'}; +my $ui = $return->{'data'}->{'ui'}; +my $auth = $return->{'data'}->{'auth'}; undef $return; # no need for this anymore @@ -2269,5 +2277,5 @@ # user doesn't have a preferences file! # load user preferences from default config in config dir - $user = SandWeb::Config::->new( + my $return = SandWeb::Config::->new( 'config_dir' => $config_dir, 'config_file' => "$user_cfg", @@ -2275,4 +2283,5 @@ ); + $user = $return->{'data'}; $user->{'repo'} = {}; @@ -2285,9 +2294,15 @@ # load users preferences from users dir - $user = SandWeb::Config::->new( + $return = SandWeb::Config::->new( 'config_dir' => $config->{'paths'}->{'users_dir'} . "/$username", 'config_file' => ".$user_cfg", 'log_obj' => $log, ); + if (!$return->{'errlev'}) { + # unable to load config + set_message("unable to load user config file. $!"); + login_menu(); + } + $user = $return->{'data'}; |