Update of /cvs/scoop/scoop/lib/Scoop
In directory lithium.sabren.com:/tmp/cvs-serv4073/lib/Scoop
Modified Files:
Tag: scoop_1_2-dev
ApacheHandler.pm Utility.pm
Log Message:
Now we're getting down to business. Initial checking of apache2 support into the 1.2-dev tree. Unfortunately, support in the installer isn't there yet, and the new config file templates aren't done. Still, it will work under both apache 1.3 and apache 2. More to follow soon. -j
Index: Utility.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Utility.pm,v
retrieving revision 1.38
retrieving revision 1.38.2.1
diff -C2 -d -r1.38 -r1.38.2.1
*** Utility.pm 16 Aug 2006 23:44:06 -0000 1.38
--- Utility.pm 26 Aug 2006 20:06:00 -0000 1.38.2.1
***************
*** 132,136 ****
$save = 1 unless $file_upload_type eq 'content';
! my $upload = $S->{APR}->upload;
my ($filename, $size) = ($upload->filename, $upload->size);
$filename =$S->clean_filename($filename);
--- 132,149 ----
$save = 1 unless $file_upload_type eq 'content';
! my $uploaduse = ($Scoop::MP2) ? 'use Apache2::Upload' : '';
! eval "$uploaduse";
! my $upload;
! if($Scoop::MP2){
! #$upload = $S->{APR}->upload('file_upload');
! my $uploads = $S->{APR}->upload;
! #$upload = $uploads->{'file_upload'};
! foreach (keys %$uploads){
! $upload = $uploads->{$_};
! }
! }
! else {
! $upload = $S->{APR}->upload;
! }
my ($filename, $size) = ($upload->filename, $upload->size);
$filename =$S->clean_filename($filename);
***************
*** 254,258 ****
=item * save_file_upload($advertiser_id,$tmpl)
! This will get a file though the Apache::Request object, and save it
to the directory $S->{UI}->{VARS}->{ad_files_base}/$advertiser_id/
It returns the filename that it saved it as, the file size in bytes,
--- 267,271 ----
=item * save_file_upload($advertiser_id,$tmpl)
! This will get a file though the Apache2::Request object, and save it
to the directory $S->{UI}->{VARS}->{ad_files_base}/$advertiser_id/
It returns the filename that it saved it as, the file size in bytes,
***************
*** 280,285 ****
}
! my $upload = $S->{APR}->upload;
!
# don't use their filename! bad bad bad!
my $random_fn = $S->rand_stuff(7);
--- 293,306 ----
}
! my $uploaduse = ($Scoop::MP2) ? 'use Apache2::Upload' : '';
! eval "$uploaduse";
! my $upload;
! if($Scoop::MP2){
! $upload = $S->{APR}->upload('file_upload');
! }
! else {
! $upload = $S->{APR}->upload;
! }
!
# don't use their filename! bad bad bad!
my $random_fn = $S->rand_stuff(7);
Index: ApacheHandler.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/ApacheHandler.pm,v
retrieving revision 1.76
retrieving revision 1.76.4.1
diff -C2 -d -r1.76 -r1.76.4.1
*** ApacheHandler.pm 6 Jul 2004 06:07:43 -0000 1.76
--- ApacheHandler.pm 26 Aug 2006 20:06:00 -0000 1.76.4.1
***************
*** 23,28 ****
sub handler {
! my $r = shift;
! Apache->request($r);
my $time; # = localtime(time());
warn "\n<<ApacheHandler: $time>> I've got this one...\n" if $DEBUG;
--- 23,35 ----
sub handler {
! my $req = shift;
! my $r;
! if($Scoop::MP2){
! $r = Apache2::Request->new($req);
! }
! else {
! $r = $req; undef $req;
! Apache->request($r);
! }
my $time; # = localtime(time());
warn "\n<<ApacheHandler: $time>> I've got this one...\n" if $DEBUG;
***************
*** 35,40 ****
# Get an $S object, and make sure it's initialized
my $S = Scoop->instance();
! $S->initialize();
!
# Parse the path-info out. Op translation is done here too.
&_parse_path($S);
--- 42,51 ----
# Get an $S object, and make sure it's initialized
my $S = Scoop->instance();
! if($Scoop::MP2){
! $S->initialize($r);
! }
! else {
! $S->initialize();
! }
# Parse the path-info out. Op translation is done here too.
&_parse_path($S);
***************
*** 47,51 ****
# If set, Scoop will only serve pages to superuser or those with the right perm
if ($S->{UI}->{VARS}->{safe_mode} && ($S->{GID} ne 'Superuser') && !($S->have_perm('bypass_safe_mode'))) {
! my $ret = $Scoop::MP2 ? &Apache::HTTP_SERVICE_UNAVAILABLE : &Apache::Constants::HTTP_SERVICE_UNAVAILABLE;
# check if a redirect page is set
my $redir_page = $S->{UI}->{VARS}->{safe_mode_redirect};
--- 58,62 ----
# If set, Scoop will only serve pages to superuser or those with the right perm
if ($S->{UI}->{VARS}->{safe_mode} && ($S->{GID} ne 'Superuser') && !($S->have_perm('bypass_safe_mode'))) {
! my $ret = $Scoop::MP2 ? &Apache2::Const::HTTP_SERVICE_UNAVAILABLE : &Apache::Constants::HTTP_SERVICE_UNAVAILABLE;
# check if a redirect page is set
my $redir_page = $S->{UI}->{VARS}->{safe_mode_redirect};
***************
*** 53,57 ****
if($redir_page) {
$S->apache->header_out('Location', $redir_page);
! $ret = $Scoop::MP2 ? &Apache::HTTP_MOVED_TEMPORARILY : &Apache::Constants::HTTP_MOVED_TEMPORARILY;
}
$S->cleanup();
--- 64,68 ----
if($redir_page) {
$S->apache->header_out('Location', $redir_page);
! $ret = $Scoop::MP2 ? &Apache2::Const::HTTP_MOVED_TEMPORARILY : &Apache::Constants::HTTP_MOVED_TEMPORARILY;
}
$S->cleanup();
***************
*** 82,88 ****
# request back to apache
unless ($S->{OPS}->{$op} && $S->{OPS}->{$op}->{enabled}) {
$S->cleanup();
undef $Scoop::_instance;
! return $Scoop::MP2 ? &Apache::DECLINED : &Apache::Constants::DECLINED;
}
--- 93,100 ----
# request back to apache
unless ($S->{OPS}->{$op} && $S->{OPS}->{$op}->{enabled}) {
+ warn "No op? $op\n";
$S->cleanup();
undef $Scoop::_instance;
! return $Scoop::MP2 ? &Apache2::Const::DECLINED : &Apache::Constants::DECLINED;
}