root/fastcgi/trunk/mt-xsearch.fcgi

Revision 126, 0.8 kB (checked in by ogawa, 3 years ago)

Add FastCGI support files for Movable Type 3.2

Line 
1#!/usr/bin/perl -w
2use strict;
3use lib 'lib';
4use MT::Bootstrap;
5use CGI::Fast;
6use CGI::Cache;
7use MT::App::XSearch;
8
9eval {
10    CGI::Cache::setup({
11        cache_options => { cache_root => './cache', default_expires_in => 600 }
12    });
13    while (my $q = new CGI::Fast) {
14        my $cgi_cache = $q->param('cgi_cache') || 0;
15        if ($cgi_cache) {
16            CGI::Cache::set_key($q->Vars);
17            CGI::Cache::start() or next;
18        }
19        my $app = MT::App::XSearch->new(CGIObject => $q)
20            or die MT::App::XSearch->errstr;
21        local $SIG{__WARN__} = sub { $app->trace($_[0]) };
22        MT->set_instance($app);
23        $app->init_request(CGIObject => $q) unless $app->{init_request};
24        $app->run;
25        CGI::Cache::stop($app->errstr ? 0 : 1) if $cgi_cache;
26    }
27};
28if ($@) {
29    print "Content-Type: text/html\n\n";
30    print "Got an error: $@";
31}
Note: See TracBrowser for help on using the browser.