Changeset 845

Show
Ignore:
Timestamp:
12/06/06 08:42:36 (2 years ago)
Author:
takayama
Message:

Fixed BugId: 44291

* Redirect to mt-wizard.cgi when mt-config file missing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/lib/MT.pm.pre

    r752 r845  
    462462 
    463463    my $cfg_file = $mt->find_config($param); 
    464     return $mt->trans_error("Missing configuration file. Maybe you forgot to move mt-config.cgi-original to mt-config.cgi?") unless $cfg_file; 
     464    die "Missing configuration file. Maybe you forgot to move mt-config.cgi-original to mt-config.cgi?" unless $cfg_file; 
    465465    if ($] >= 5.006) { 
    466466        $cfg_file = File::Spec->rel2abs($cfg_file); 
  • branches/wheeljack/lib/MT/Bootstrap.pm

    r670 r845  
    101101                } 
    102102            } else { 
    103                 print "Content-Type: text/plain; charset=$charset\n\n"; 
    104                 print $app ? $app->translate("Got an error: [_1]", $err) : "Got an error: $err\n"; 
     103 
     104                if ($err =~ m/Missing configuration file/) { 
     105                    my $host = $ENV{SERVER_NAME} || $ENV{HTTP_HOST}; 
     106                    $host =~ s/:\d+//; 
     107                    my $port = $ENV{SERVER_PORT}; 
     108                    my $uri = $ENV{REQUEST_URI} || $ENV{PATH_INFO}; 
     109                    $uri =~ s/mt(\.cgi)?.*$//; 
     110                    my $cgipath = ''; 
     111                    $cgipath = $port == 443 ? 'https' : 'http'; 
     112                    $cgipath .= '://' . $host; 
     113                    $cgipath .= ($port == 443 || $port == 80) ? '' : ':' . $port; 
     114                    $cgipath .= $uri; 
     115 
     116                    print "Status: 302 Moved\n"; 
     117                    print "Location: ".$cgipath."mt-wizard.cgi\n\n"; 
     118               } else { 
     119                    print "Content-Type: text/plain; charset=$charset\n\n"; 
     120                    print $app ? $app->translate("Got an error: [_1]", $err) : "Got an error: $err\n"; 
     121                } 
    105122            } 
    106123        }