Skip to content

Commit

Permalink
Item9267: Apply Babar's reordering of bin/configure to improve windows
Browse files Browse the repository at this point in the history
performance.

git-svn-id: http://svn.foswiki.org/trunk@8073 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Jul 8, 2010
1 parent 49b5c1b commit cfca6b0
Showing 1 changed file with 59 additions and 57 deletions.
116 changes: 59 additions & 57 deletions core/bin/configure
Original file line number Diff line number Diff line change
Expand Up @@ -276,25 +276,8 @@ if ($@) {
unshift( @INC, File::Spec->catfile( @root, 'lib' ) );
}

our $time = time();

# Load all the bits of the configure module that we explicitly use
# The loadBasicModule does some extra analysis on errors.
foreach my $module (
'Cwd', 'Data::Dumper',
'File::Copy', 'File::Temp',
'Foswiki::Configure::TemplateParser',
)
{
::_loadBasicModule($module);
}

$| = 1; # no buffering on STDOUT

###########################################################
# From this point on we shouldn't have any more "fatal" (to configure)
# errors, so we can report errors in the browser (i.e. without using die)

# We are configuring $Foswiki::cfg, so we need to be in package Foswiki from
# now on.
package Foswiki;
Expand All @@ -311,6 +294,60 @@ $TRUE = 1;
$FALSE = 0;
our $badLSC;

our $time = time();

our $query = new CGI;

my $url = $query->url();
my $action = $query->param('action') || 'Configure';

our $DEFAULT_FIELD_WIDTH_NO_CSS = '40';

# Handle serving an resource embedded in the configure page, before generating
# any other output
::_loadBasicModule( 'Foswiki::Configure::Util' );
::_loadBasicModule( 'Foswiki::Configure::TemplateParser' );
if ( $action eq 'resource' ) {
my $resource = $query->param('resource');
$resource =~ /^([-\w]+\.\w+)$/; # filter-in and untaint
$resource = $1;
if ( defined($resource) ) {

#ignore $query->param('type') and set it using the extension
my $type = 'image/gif';
if ( $resource =~ /\.ico$/ ) {
$type = 'resource/x-icon';
}
elsif ( $resource =~ /\.js$/ ) {
$type = 'text/javascript';
}

my $parser = Foswiki::Configure::TemplateParser->new;
my $text = $parser->getResource($resource);

# SMELL: this call is correct, but causes a perl error
# on some versions of CGI.pm
# print $query->header(-type => $query->param('type'));
# So use this instead:
print 'Content-type: ' . $type . "\n\n";
print $text;
}
exit 0;
}

# Load all the bits of the configure module that we explicitly use
# The loadBasicModule does some extra analysis on errors.
#foreach my $module (
# )
#{
# ::_loadBasicModule($module);
#}


###########################################################
# From this point on we shouldn't have any more "fatal" (to configure)
# errors, so we can report errors in the browser (i.e. without using die)

# Remember what we detected previously, for use by Checkers
if ( $scriptName =~ /(\.\w+)$/ ) {
$Foswiki::cfg{DETECTED}{ScriptExtension} = $1;
Expand Down Expand Up @@ -363,43 +400,6 @@ unless ( $Foswiki::cfg{OS} ) {
}
}

our $query = new CGI;

my $url = $query->url();
my $action = $query->param('action') || 'Configure';

our $DEFAULT_FIELD_WIDTH_NO_CSS = '40';

# Handle serving an resource embedded in the configure page, before generating
# any other output
if ( $action eq 'resource' ) {
my $resource = $query->param('resource');
$resource =~ /^([-\w]+\.\w+)$/; # filter-in and untaint
$resource = $1;
if ( defined($resource) ) {

#ignore $query->param('type') and set it using the extension
my $type = 'image/gif';
if ( $resource =~ /\.ico$/ ) {
$type = 'resource/x-icon';
}
elsif ( $resource =~ /\.js$/ ) {
$type = 'text/javascript';
}

my $parser = Foswiki::Configure::TemplateParser->new;
my $text = $parser->getResource($resource);

# SMELL: this call is correct, but causes a perl error
# on some versions of CGI.pm
# print $query->header(-type => $query->param('type'));
# So use this instead:
print 'Content-type: ' . $type . "\n\n";
print $text;
}
exit 0;
}

sub log {
my ($message) = @_;

Expand All @@ -415,15 +415,17 @@ sub log {
# Load all the bits of the configure module that we explicitly use
# The loadBasicModule does some extra analysis on errors.
foreach my $module (
'Cwd', 'Data::Dumper',
'File::Copy', 'File::Temp',
'Foswiki::Configure::Checker', 'Foswiki::Configure::Item',
'Foswiki::Configure::Load', 'Foswiki::Configure::Pluggable',
'Foswiki::Configure::Root', 'Foswiki::Configure::Section',
'Foswiki::Configure::Type', 'Foswiki::Configure::Types::BOOLEAN',
'Foswiki::Configure::Types::NUMBER', 'Foswiki::Configure::Types::SELECT',
'Foswiki::Configure::Types::STRING', 'Foswiki::Configure::FoswikiCfg',
'Foswiki::Configure::Util', 'Foswiki::Configure::UI',
'Foswiki::Configure::UIs::Section', 'Foswiki::Configure::Value',
'Foswiki::Configure::Valuer', 'Foswiki::Configure::GlobalControls',
'Foswiki::Configure::UI', 'Foswiki::Configure::UIs::Section',
'Foswiki::Configure::Value', 'Foswiki::Configure::Valuer',
'Foswiki::Configure::GlobalControls',
)
{
::_loadBasicModule($module);
Expand Down

0 comments on commit cfca6b0

Please sign in to comment.