Unbreak after the recent mod_perl2 updates.

Approved by:	kvs@pil.dk (maintainer), portmgr (krion)
This commit is contained in:
Philip Paeps 2005-05-23 07:45:51 +00:00
parent bd321eea66
commit 0df5e70ceb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=135928
2 changed files with 222 additions and 2 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= Apache-Gallery
PORTVERSION= 0.9.1
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= www perl5
MASTER_SITES= http://apachegallery.dk/download/ \
${MASTER_SITE_PERL_CPAN}
@ -27,7 +27,6 @@ BUILD_DEPENDS= ${APXS}:${PORTSDIR}/${APACHE_PORT} \
RUN_DEPENDS= ${BUILD_DEPENDS}
.if defined(WITH_APACHE2)
BROKEN= Broken due the new mod_perl2 API
BUILD_DEPENDS+= ${LOCALBASE}/libexec/apache2/mod_perl.so:${PORTSDIR}/www/mod_perl2
DEPENDS_ARGS+= WITHOUT_MODPERL=yes
DEPENDS_ARGS+= WITH_MODPERL2=yes

View File

@ -0,0 +1,221 @@
--- lib/Apache/Gallery.pm.orig Sat Sep 11 23:53:05 2004
+++ lib/Apache/Gallery.pm Sun May 22 20:29:22 2005
@@ -19,16 +19,15 @@
$::MP2 = ($mod_perl::VERSION >= 1.99);
if ($::MP2) {
- require Apache2;
- require Apache::Server;
- require Apache::RequestRec;
- require Apache::Log;
+ require Apache2::ServerRec;
+ require Apache2::RequestRec;
+ require Apache2::Log;
require APR::Table;
- require Apache::RequestIO;
- require Apache::SubRequest;
- require Apache::Const;
+ require Apache2::RequestIO;
+ require Apache2::SubRequest;
+ require Apache2::Const;
- Apache::Const->import(-compile => 'OK','DECLINED','FORBIDDEN','NOT_FOUND');
+ Apache2::Const->import(-compile => 'OK','DECLINED','FORBIDDEN','NOT_FOUND');
}
else {
@@ -61,7 +60,7 @@
sub handler {
- my $r = shift or Apache->request();
+ my $r = shift or Apache2::RequestUtil->request();
if ((not $memoized) and ($r->dir_config('GalleryMemoize'))) {
require Memoize;
@@ -84,10 +83,10 @@
}
if (-f $filename or -d $filename) {
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
else {
- return $::MP2 ? Apache::NOT_FOUND() : Apache::Constants::NOT_FOUND();
+ return $::MP2 ? Apache2::Const::NOT_FOUND() : Apache::Constants::NOT_FOUND();
}
}
@@ -105,7 +104,7 @@
}
$r->print($content);
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
# Selectmode providing checkboxes beside all thumbnails
@@ -113,7 +112,7 @@
# Let Apache serve icons without us modifying the request
if ($r->uri =~ m/^\/icons/i) {
- return $::MP2 ? Apache::DECLINED() : Apache::Constants::DECLINED();
+ return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
}
# Lookup the file in the cache and scale the image if the cached
# image does not exist
@@ -142,7 +141,7 @@
if ($::MP2) {
$r->sendfile($file);
- return Apache::OK();
+ return Apache2::Const::OK();
}
else {
$r->path_info('');
@@ -157,7 +156,7 @@
unless (-f $filename or -d $filename) {
show_error($r, 404, "404!", "No such file or directory: ".uri_escape($r->uri, $escape_rule));
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
my $doc_pattern = $r->dir_config('GalleryDocFile');
@@ -171,14 +170,14 @@
# Let Apache serve files we don't know how to handle anyway
if (-f $filename && $filename !~ m/$img_pattern/i) {
- return $::MP2 ? Apache::DECLINED() : Apache::Constants::DECLINED();
+ return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
}
if (-d $filename) {
unless (-d cache_dir($r, 0)) {
unless (create_cache($r, cache_dir($r, 0))) {
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
}
@@ -198,7 +197,7 @@
unless (opendir (DIR, $filename)) {
show_error ($r, 500, $!, "Unable to access directory $filename: $!");
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
$tpl_vars{MENU} = generate_menu($r);
@@ -420,7 +419,7 @@
}
$r->print($tpl_vars{MAIN});
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
else {
@@ -429,9 +428,9 @@
if (defined($ENV{QUERY_STRING}) && $ENV{QUERY_STRING} eq 'orig') {
if ($r->dir_config('GalleryAllowOriginal') ? 1 : 0) {
$r->filename($filename);
- return $::MP2 ? Apache::DECLINED() : Apache::Constants::DECLINED();
+ return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
} else {
- return $::MP2 ? Apache::FORBIDDEN() : Apache::Constants::FORBIDDEN();
+ return $::MP2 ? Apache2::Const::FORBIDDEN() : Apache::Constants::FORBIDDEN();
}
}
@@ -443,7 +442,7 @@
unless (-d $cache_path) {
unless (create_cache($r, $cache_path)) {
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
}
@@ -465,7 +464,7 @@
if ($cgi->param('width')) {
unless ((grep $cgi->param('width') == $_, @sizes) or ($cgi->param('width') == $original_size)) {
show_error($r, 200, "Invalid width", "The specified width is invalid");
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
$width = $cgi->param('width');
@@ -534,7 +533,7 @@
unless (opendir(DATADIR, $path)) {
show_error($r, 500, "Unable to access directory", "Unable to access directory $path");
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
my @pictures = grep { /$img_pattern/i } readdir (DATADIR);
closedir(DATADIR);
@@ -749,7 +748,7 @@
unless ((grep $cgi->param('slideshow') == $_, @slideshow_intervals)) {
show_error($r, 200, "Invalid interval", "Invalid slideshow interval choosen");
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
$tpl_vars{URL} = uri_escape($nextpicture, $escape_rule);
@@ -781,7 +780,7 @@
}
$r->print($tpl_vars{MAIN});
- return $::MP2 ? Apache::OK() : Apache::Constants::OK();
+ return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
}
@@ -998,7 +997,7 @@
my $imageinfo = {};
if ($type eq 'Data stream is not a known image file format') {
# should never be reached, this is supposed to be handled outside of here
- Apache->request->log_error("Something was fishy with the type of the file $file\n");
+ Apache2::RequestUtil->request->log_error("Something was fishy with the type of the file $file\n");
} else {
# Some files, like TIFF, PNG, GIF do not have EXIF info embedded but use .thm files
# instead.
@@ -1379,22 +1378,22 @@
$image->blend($logo, 0, 0, 0, $logox, $logoy, $x-$logox, $y-$logoy, $logox, $logoy);
}
else {
- Apache->request->log_error("GalleryCopyrightImage $copyrightfile was not found\n");
+ Apache2::RequestUtil->request->log_error("GalleryCopyrightImage $copyrightfile was not found\n");
}
}
if ($GalleryTTFDir && $GalleryCopyrightText && $GalleryTTFFile, $text_color) {
if (!-d $GalleryTTFDir) {
- Apache->request->log_error("GalleryTTFDir $GalleryTTFDir is not a dir\n");
+ Apache2::RequestUtil->request->log_error("GalleryTTFDir $GalleryTTFDir is not a dir\n");
} elsif ($GalleryCopyrightText eq '') {
- Apache->request->log_error("GalleryCopyrightText is empty. No text inserted to picture\n");
+ Apache2::RequestUtil->request->log_error("GalleryCopyrightText is empty. No text inserted to picture\n");
} elsif (!-e "$GalleryTTFDir/$GalleryTTFFile") {
- Apache->request->log_error("GalleryTTFFile $GalleryTTFFile was not found\n");
+ Apache2::RequestUtil->request->log_error("GalleryTTFFile $GalleryTTFFile was not found\n");
} else {
@@ -1415,7 +1414,7 @@
if (($text_x < $x - $offset) && ($text_y < $y - $offset)) {
$image->draw_text($x-$text_x-$offset, $y-$text_y-$offset, "$GalleryCopyrightText");
} else {
- Apache->request->log_error("Text is to big for the picture.\n");
+ Apache2::RequestUtil->request->log_error("Text is to big for the picture.\n");
}
}
}