getting there with the mp2 handlers
This commit is contained in:
parent
4d89f85047
commit
e8a514b753
11 changed files with 166 additions and 170 deletions
|
|
@ -1,7 +1,12 @@
|
|||
6.8.0
|
||||
- Switched Date::Manip to DateTime for better performance and more
|
||||
functionality. See gotchas for details. In our benchmarks DateTime runs
|
||||
about 13 times faster than Date::Manip.
|
||||
about 13 times faster than Date::Manip. Depending upon how date intensive
|
||||
your pages are, you will see a 2% to 100% performance increase from this
|
||||
change.
|
||||
- Switched from Apache::Registry/CGI to a pure mod_perl2 interface, which
|
||||
increased performance by over 70% to the entire system, and in some cases
|
||||
as much as 100%. See gotcha.txt for details.
|
||||
|
||||
|
||||
6.7.7
|
||||
|
|
|
|||
|
|
@ -22,6 +22,53 @@ save you many hours of grief.
|
|||
no longer need date caching so the enableDateCache directive can
|
||||
be removed from your config file.
|
||||
|
||||
* WebGUI now requires Apache2 with mod_perl2 so CGI, FastCGI, PerlEx,
|
||||
although never officially supported, are no longer possible.
|
||||
Making this change gave us more than 70% performance improvement
|
||||
and opens up even more possibilities for performance and other
|
||||
optimizations.
|
||||
|
||||
You'll need to make the following changes in Apache to upgrade
|
||||
to this release:
|
||||
|
||||
Install libaprereq2. You can either download and compile this
|
||||
from the mod_perl web site, CPAN as Apache2::Request, or by
|
||||
getting the version of the WRE 0.6.0 or higher.
|
||||
|
||||
Edit your httpd.conf or httpd.modperl.conf and add the following
|
||||
directives to your global server config:
|
||||
|
||||
LoadModule apreq_module modules/mod_apreq2.so
|
||||
PerlSetVar WebguiRoot /data/WebGUI
|
||||
|
||||
You may also remove this block if you have it:
|
||||
|
||||
<Files ~ "\.(pl)$">
|
||||
SetHandler perl-script
|
||||
PerlHandler ModPerl::Registry::handler
|
||||
PerlOptions +ParseHeaders
|
||||
</Files>
|
||||
|
||||
Edit each of your virtual hosts and add the following directives,
|
||||
changing them to suit your needs:
|
||||
|
||||
SetHandler perl-script
|
||||
PerlInitHandler WebGUI
|
||||
PerlSetVar WebguiConfig www.example.com.conf
|
||||
|
||||
If you were using mod rewrite you'll need to adjust your rules
|
||||
because they no longer need to remove the gateway (index.pl)
|
||||
from the URL.
|
||||
|
||||
If you were using the uploadsAccessHandler.perl you no longer
|
||||
need that as it is built in to the WebGUI handler.
|
||||
|
||||
For more information consult the WebGUI Done Right documentation.
|
||||
|
||||
* WebGUI now requires MySQL 5.0 to operate. This is due to the huge
|
||||
number of new features afforded us in the MySQL 5.0 database,
|
||||
which will increase performance, and add to our functionality
|
||||
for the future.
|
||||
|
||||
|
||||
6.7.0
|
||||
|
|
|
|||
|
|
@ -10,14 +10,29 @@ documentation.
|
|||
|
||||
QnD INSTALL INSTRUCTIONS:
|
||||
|
||||
1. Install Perl 5.6.x or greater. (5.8.x recommended)
|
||||
1. Install Perl 5.8 or higher.
|
||||
|
||||
2. Install Apache with mod_perl and set up your config. See Ruling WebGUI
|
||||
for information specific to Apache 1.3 vs 2.0. Apache 2 recommended.
|
||||
2. Install Apache 2.0 with mod_perl 2.0 and set up your config. Add the
|
||||
following directives to mod_perl (See WebGUI Done Right for more detail.)
|
||||
|
||||
3. Install MySQL 3.23 or greater. MySQL 4.1 recommended.
|
||||
LoadModule apreq_module modules/mod_apreq2.so
|
||||
LoadModule perl_module modules/mod_perl.so
|
||||
PerlSetVar WebguiRoot /data/WebGUI
|
||||
PerlCleanupHandler Apache2::SizeLimit
|
||||
PerlRequire /data/WebGUI/sbin/preload.perl
|
||||
|
||||
4. Install Image Magick.
|
||||
<VirtualHost *:80>
|
||||
ServerName www.example.com
|
||||
ServerAlias example.com
|
||||
DocumentRoot /data/domains/example.com/www/public
|
||||
SetHandler perl-script
|
||||
PerlInitHandler WebGUI
|
||||
PerlSetVar WebguiConfig www.example.com.conf
|
||||
</VirtualHost>
|
||||
|
||||
3. Install MySQL 5.0 or higher.
|
||||
|
||||
4. Install Image Magick 6.0 or higher.
|
||||
|
||||
5. Extract WebGUI into your webroot.
|
||||
|
||||
|
|
|
|||
|
|
@ -489,3 +489,11 @@ therefore removed them. This shouldn't affect almost anybody, but we're
|
|||
mentioning it just in case you're using WebGUI::DateTime in an odd mannner.
|
||||
They are: epochToDate, dateToEpoch, epochToArray, arrayToEpoch
|
||||
|
||||
|
||||
5.22 CGI No Longer
|
||||
|
||||
As of 6.8.0 we are no longer using CGI to handle our web interactions. Instead
|
||||
we are using a native mod perl handler. If you used $session{cgi} object
|
||||
you'll now need to convert your applications to use the methods provided by
|
||||
Apache2::Request which is referenced through $session{modperl}.
|
||||
|
||||
|
|
|
|||
|
|
@ -12,22 +12,28 @@ my $quiet;
|
|||
|
||||
start();
|
||||
addTimeZonesToUserPreferences();
|
||||
|
||||
#TODO (by somebody!):
|
||||
# possibly instead of deleting old user timeZone preferences, convert them.
|
||||
# MUST DO: any dates in WebGUI greater than epoch 2^32 must be reduced, because
|
||||
# the new DateTime system uses Params::Validate, which will only validate integers
|
||||
# up to 2^32 as SCALARs. :(
|
||||
|
||||
|
||||
removeUnneededFiles();
|
||||
finish();
|
||||
|
||||
#-------------------------------------------------
|
||||
sub addTimeZonesToUserPreferences {
|
||||
print "\tDropping time offsets in favor of time zones.\n" unless ($quiet);
|
||||
WebGUI::SQL->write("delete from userProfileData where fieldName='timeOffset'");
|
||||
WebGUI::SQL->write("update userProfileField set dataValues='', fieldName='timeZone', dataType='timeZone', dataDefault=".quote("['America/Chicago']")." where fieldName='timeOffset'");
|
||||
}
|
||||
|
||||
sub removeUnneededFiles {
|
||||
print "\tRemoving files that are no longer needed.\n" unless ($quiet);
|
||||
unlink("../../www/env.pl");
|
||||
unlink("../../www/index.fpl");
|
||||
unlink("../../www/index.pl");
|
||||
}
|
||||
|
||||
#--- DO NOT EDIT BELOW THIS LINE
|
||||
|
||||
#-------------------------------------------------
|
||||
|
|
|
|||
150
lib/WebGUI.pm
150
lib/WebGUI.pm
|
|
@ -32,93 +32,56 @@ use Apache2::RequestRec ();
|
|||
use Apache2::RequestIO ();
|
||||
use Apache2::Const -compile => qw(OK DECLINED);
|
||||
|
||||
our $s;
|
||||
our $r;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub handler {
|
||||
$s = Apache2::ServerUtil->server;
|
||||
$r = shift;
|
||||
my $r = shift;
|
||||
my $s = Apache2::ServerUtil->server;
|
||||
my $config = WebGUI::Config::getConfig($s->dir_config('WebguiRoot'),$r->dir_config('WebguiConfig'));
|
||||
my $extras = $config->{extrasURL};
|
||||
my $uploads = $config->{uploadsURL};
|
||||
unless ($r->uri =~ m/^$extras/ || $r->uri =~ m/^$uploads/) {
|
||||
$r->handler('perl-script');
|
||||
$r->set_handlers(PerlResponseHandler => \&contentHandler);
|
||||
$r->set_handlers(PerlResponseHandler => \&contentHandler);#, PerlTransHandler => \&Apache2::Const::OK);
|
||||
}
|
||||
return Apache2::Const::DECLINED;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub contentHandler {
|
||||
my $r = shift;
|
||||
my $s = Apache2::ServerUtil->server;
|
||||
WebGUI::Session::open($s->dir_config('WebguiRoot'),$r->dir_config('WebguiConfig'),$r);
|
||||
$session{wguri} = $r->uri;
|
||||
$r->print(page(undef,undef,1)); # Use existing session
|
||||
if ($session{env}{HTTP_X_MOZ} eq "prefetch") { # browser prefetch is a bad thing
|
||||
WebGUI::HTTP::setStatus("403","We don't allow prefetch, because it increases bandwidth, hurts stats, and can break web sites.");
|
||||
$r->print(WebGUI::HTTP::getHeader());
|
||||
} elsif ($session{setting}{specialState} eq "upgrading") {
|
||||
$r->print(upgrading());
|
||||
} elsif ($session{setting}{specialState} eq "init") {
|
||||
return $r->print(setup());
|
||||
} else {
|
||||
my $output = page();
|
||||
WebGUI::Affiliate::grabReferral(); # process affilliate tracking request
|
||||
if (WebGUI::HTTP::isRedirect()) {
|
||||
$output = WebGUI::HTTP::getHeader();
|
||||
} else {
|
||||
$output = WebGUI::HTTP::getHeader().$output;
|
||||
if (WebGUI::ErrorHandler::canShowDebug()) {
|
||||
$output .= WebGUI::ErrorHandler::showDebug();
|
||||
}
|
||||
}
|
||||
$r->print($output);
|
||||
}
|
||||
WebGUI::Session::close();
|
||||
return Apache2::Const::OK;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _processOperations {
|
||||
my ($cmd, $output);
|
||||
my $op = $session{form}{op};
|
||||
my $opNumber = shift || 1;
|
||||
if ($op) {
|
||||
$output = WebGUI::Operation::execute($op);
|
||||
}
|
||||
$opNumber++;
|
||||
if ($output eq "" && exists $session{form}{"op".$opNumber}) {
|
||||
my $urlString = WebGUI::URL::unescape($session{form}{"op".$opNumber});
|
||||
my @pairs = split(/\;/,$urlString);
|
||||
my %form;
|
||||
foreach my $pair (@pairs) {
|
||||
my @param = split(/\=/,$pair);
|
||||
$form{$param[0]} = $param[1];
|
||||
}
|
||||
$session{form} = \%form;
|
||||
$output = _processOperations($opNumber);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _setup {
|
||||
require WebGUI::Operation::WebGUI;
|
||||
my $output = WebGUI::Operation::WebGUI::www_setup();
|
||||
$output = WebGUI::HTTP::getHeader().$output;
|
||||
WebGUI::Session::close();
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _upgrading {
|
||||
my $webguiRoot = shift;
|
||||
my $output = WebGUI::HTTP::getHeader();
|
||||
open(FILE,"<".$webguiRoot."/docs/maintenance.html");
|
||||
while (<FILE>) {
|
||||
$output .= $_;
|
||||
}
|
||||
close(FILE);
|
||||
WebGUI::Session::close();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub page {
|
||||
my $webguiRoot = shift;
|
||||
my $configFile = shift;
|
||||
my $useExistingSession = shift; # used for static page generation functions where you may generate more than one asset at a time.
|
||||
my $assetUrl = shift;
|
||||
my $fastcgi = shift;
|
||||
WebGUI::Session::open($webguiRoot,$configFile,$fastcgi) unless ($useExistingSession);
|
||||
if ($session{env}{HTTP_X_MOZ} eq "prefetch") { # browser prefetch is a bad thing
|
||||
WebGUI::HTTP::setStatus("403","We don't allow prefetch, because it increases bandwidth, hurts stats, and can break web sites.");
|
||||
my $output = WebGUI::HTTP::getHeader();
|
||||
WebGUI::Session::close();
|
||||
return $output;
|
||||
}
|
||||
return _upgrading($webguiRoot) if ($session{setting}{specialState} eq "upgrading");
|
||||
return _setup() if ($session{setting}{specialState} eq "init");
|
||||
my $output = _processOperations();
|
||||
my $output = processOperations();
|
||||
if ($output eq "") {
|
||||
my $asset = WebGUI::Asset->newByUrl($assetUrl,$session{form}{revision});
|
||||
if (defined $asset) {
|
||||
|
|
@ -147,22 +110,53 @@ sub page {
|
|||
$output = $notFound->www_view;
|
||||
}
|
||||
}
|
||||
WebGUI::Affiliate::grabReferral(); # process affilliate tracking request
|
||||
if (WebGUI::HTTP::isRedirect() && !$useExistingSession) {
|
||||
$output = WebGUI::HTTP::getHeader();
|
||||
} else {
|
||||
$output = WebGUI::HTTP::getHeader().$output;
|
||||
if (WebGUI::ErrorHandler::canShowDebug()) {
|
||||
$output .= WebGUI::ErrorHandler::showDebug();
|
||||
}
|
||||
}
|
||||
# This allows an operation or wobject to write directly to the browser.
|
||||
$output = undef if ($session{page}{empty});
|
||||
WebGUI::Session::close() unless ($useExistingSession);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub processOperations {
|
||||
my ($cmd, $output);
|
||||
my $op = $session{form}{op};
|
||||
my $opNumber = shift || 1;
|
||||
if ($op) {
|
||||
$output = WebGUI::Operation::execute($op);
|
||||
}
|
||||
$opNumber++;
|
||||
if ($output eq "" && exists $session{form}{"op".$opNumber}) {
|
||||
my $urlString = WebGUI::URL::unescape($session{form}{"op".$opNumber});
|
||||
my @pairs = split(/\;/,$urlString);
|
||||
my %form;
|
||||
foreach my $pair (@pairs) {
|
||||
my @param = split(/\=/,$pair);
|
||||
$form{$param[0]} = $param[1];
|
||||
}
|
||||
$session{form} = \%form;
|
||||
$output = processOperations($opNumber);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub setup {
|
||||
require WebGUI::Operation::WebGUI;
|
||||
my $output = WebGUI::Operation::WebGUI::www_setup();
|
||||
return WebGUI::HTTP::getHeader().$output;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub upgrading {
|
||||
my $output = WebGUI::HTTP::getHeader();
|
||||
open(FILE,"<".$session{config}{webguiRoot}."/docs/maintenance.html");
|
||||
while (<FILE>) {
|
||||
$output .= $_;
|
||||
}
|
||||
close(FILE);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ An integer between 1 and 5 (5 = best).
|
|||
sub getRateUrl {
|
||||
my $self = shift;
|
||||
my $rating = shift;
|
||||
return $self->getUrl("func=rate;rating=".$rating."#".$self->getId);
|
||||
return $self->getUrl("func=rate;rating=".$rating."#id".$self->getId);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -399,7 +399,7 @@ sub getTemplateVars {
|
|||
$var{"deny.url"} = $self->getDenyUrl;
|
||||
$var{"reply.url"} = $self->getReplyUrl;
|
||||
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
|
||||
$var{'url'} = $self->getUrl.'#'.$self->getId;
|
||||
$var{'url'} = $self->getUrl.'#id'.$self->getId;
|
||||
$var{'rating.value'} = $self->get("rating")+0;
|
||||
$var{'rate.url.1'} = $self->getRateUrl(1);
|
||||
$var{'rate.url.2'} = $self->getRateUrl(2);
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ A string indicating the type of layout to use. Can be flat or nested.
|
|||
sub getLayoutUrl {
|
||||
my $self = shift;
|
||||
my $layout = shift;
|
||||
return $session{asset}->getUrl("layout=".$layout.'#'.$session{asset}->getId) if (exists $session{asset});
|
||||
return $session{asset}->getUrl("layout=".$layout.'#id'.$session{asset}->getId) if (exists $session{asset});
|
||||
return $self->getUrl("layout=".$layout);
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ sub getStickUrl {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
id
|
||||
=head2 getSubscribeUrl ( )
|
||||
|
||||
Formats the url to subscribe to the thread
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
use CGI;
|
||||
my $cgi = CGI->new();
|
||||
print $cgi->header;
|
||||
|
||||
foreach (keys %ENV) {
|
||||
print $_."=".$ENV{$_}."<br>\n";
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2004 Plain Black LLC.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
||||
# NOTE: This gateway script is to be used with FastCGI.
|
||||
|
||||
our ($webguiRoot, $configFile);
|
||||
|
||||
BEGIN {
|
||||
$configFile = "WebGUI.conf";
|
||||
$webguiRoot = "/data/WebGUI";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
#-----------------DO NOT MODIFY BELOW THIS LINE--------------------
|
||||
|
||||
use CGI::Carp qw(fatalsToBrowser);
|
||||
use strict;
|
||||
use WebGUI;
|
||||
use CGI::Fast;
|
||||
while (my $fcgi = new CGI::Fast) {
|
||||
print WebGUI::page($webguiRoot,$configFile,"","",$fcgi);
|
||||
}
|
||||
|
||||
38
www/index.pl
38
www/index.pl
|
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot, $configFile);
|
||||
|
||||
BEGIN {
|
||||
$configFile = "webgui.conf";
|
||||
$webguiRoot = "/data/WebGUI";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
#-----------------DO NOT MODIFY BELOW THIS LINE--------------------
|
||||
#use Devel::Profiler bad_pkgs => [qw(UNIVERSAL Time::HiRes B Carp Exporter Cwd Config CORE DynaLoader XSLoader AutoLoader Safe)];
|
||||
#use CGI::Carp qw(fatalsToBrowser);
|
||||
use strict;
|
||||
use WebGUI;
|
||||
print WebGUI::page($webguiRoot,$configFile);
|
||||
|
||||
# use Devel::DProfPP;
|
||||
# my $pp = Devel::DProfPP->new;
|
||||
#use Data::Dumper;
|
||||
# print Devel::DProfPP->new(
|
||||
# file => "tmon.out",
|
||||
# enter => sub { my ($self, $sub_name) = shift;
|
||||
# my $frame = ($self->stack)[-1];
|
||||
# print "\t" x $frame->height, $frame->sub_name;
|
||||
# }
|
||||
# )->parse;
|
||||
# print Dumper(\%hash);
|
||||
Loading…
Add table
Add a link
Reference in a new issue