diff -uN -r ./admin/startup.pl /home/httpd/musicbrainz/mb_server/admin/startup.pl --- ./admin/startup.pl 1970-01-01 01:00:00.000000000 +0100 +++ /home/httpd/musicbrainz/mb_server/admin/startup.pl 2008-10-02 22:28:57.000000000 +0200 @@ -0,0 +1,141 @@ +#!/usr/bin/perl -w +# vi: set ts=4 sw=4 : +# +#Quick Migration Hack from mod_perl 1 to mod_perl 2 by LAADHARI SABER + +use Apache2::compat; +require Apache2::compat; + +unshift @INC, sub { + my $file = $_[1]; + my $msg = "require $file"; + for (my $i = 0; my @c = caller($i); ++$i) + { + $msg .= "\n\tcalled from $c[0] ($c[1] line $c[2])"; + } + print STDERR $msg."\n"; + return undef; +} if 0; # set to 1 if you want to trace when modules are loaded + +use strict; +use warnings; +eval 'require Devel::SawAmpersand'; + +# TODO: Check to make sure this path points to where the cgi-bin stuff is +use lib "/home/httpd/musicbrainz/mb_server/cgi-bin"; + +# Make sure we are in a sane environment. +#$ENV{GATEWAY_INTERFACE} =~ /CGI/ +# or die "GATEWAY_INTERFACE not Perl!"; + +# cgi-bin/*.pl is run via Apache::Registry +#require Apache::Registry; + +#require Apache::Session; +use Apache2::compat; +require DBI; +DBI->install_driver("Pg"); + +# Some of the MB modules defer loading ("require" instead of "use") for some +# modules. If we know we're likely to want some module eventually, load it +# now. +require POSIX; +require IO::Socket::INET; # FreeDB +require OSSP::uuid; # TableBase +require Net::SMTP; # MusicBrainz::Server::Mail +require Time::ParseDate; + +# Alphabetical order, for ease of maintenance +# (apart from DBDefs and ModDefs, which we'll load first, just to make sure) +require DBDefs; +require ModDefs; + +require Album; +require Alias; +require Artist; +require DebugLog; +require FreeDB; +require Insert; +require Label; +require LocaleSaver; +# require MM; +# require MM_2_0; +# require MM_2_1; +require Moderation; +require MusicBrainz; +require MusicBrainz::Server::Annotation; +require MusicBrainz::Server::Attribute; +require MusicBrainz::Server::AutomodElection; +require MusicBrainz::Server::AlbumCDTOC; +require MusicBrainz::Server::Cache; +require MusicBrainz::Server::CDTOC; +require MusicBrainz::Server::Country; +require MusicBrainz::Server::CoverArt; +require MusicBrainz::Server::DateTime; +require MusicBrainz::Server::DeferredUpdate; +require MusicBrainz::Server::Handlers; +require MusicBrainz::Server::Language; +require MusicBrainz::Server::Link; +require MusicBrainz::Server::LinkAttr; +require MusicBrainz::Server::LinkEntity; +require MusicBrainz::Server::LinkType; +require MusicBrainz::Server::LogFile; +require MusicBrainz::Server::Mail; +require MusicBrainz::Server::Markup; +require MusicBrainz::Server::ModerationNote; +require MusicBrainz::Server::NewsFeed; +require MusicBrainz::Server::PagedReport; +require MusicBrainz::Server::Release; +require MusicBrainz::Server::Replication; +require MusicBrainz::Server::Script; +require MusicBrainz::Server::Tag; +require MusicBrainz::Server::TRMGateway; +require MusicBrainz::Server::TRMGatewayHandler; +require MusicBrainz::Server::URL; +require MusicBrainz::Server::Vote; +require MusicBrainz::Server::Handlers::WS::1::Common; +require MusicBrainz::Server::WikiTransclusion; +require MusicBrainz::Server::Validation; +# Don't load MusicBrainz::Server::Moderation::* - Moderation.pm does that +require Parser; +require QuerySupport; +# require RDF2; +require SearchEngine; +require Sql; +require Statistic; +require Style; +require TableBase; +require TaggerSupport; +require Track; +require TRM; +require PUID; +require UserPreference; +require UserStuff; +require UserSubscription; + +require &DBDefs::MB_SERVER_ROOT . "/admin/depend.pl"; + +# Loading the Mason handler preloads the pages, so the other MusicBrainz +# modules must be ready by this point. +require MusicBrainz::Server::Mason; + +# Preload Apache::Registry scripts + +{ + use ModPerl::RegistryLoader (); + use File::Spec (); +# use Apache::RegistryLoader (); +# my $r = Apache::RegistryLoader->new; + my $r = ModPerl::RegistryLoader->new; + + $r->handler("/cgi-bin/$_", &DBDefs::MB_SERVER_ROOT."/cgi-bin/$_") + for qw( mq.pl mq_2_1.pl rdf.pl rdf_2_1.pl ); +} + +# Mason will try to load these later, when $m->cache->... is used. +# Preload them. +require Cache::FileCache; +require HTML::Mason::Cache::BaseCache; + +1; +# eof startup.pl diff -uN -r ./admin/startup.pl~ /home/httpd/musicbrainz/mb_server/admin/startup.pl~ --- ./admin/startup.pl~ 1970-01-01 01:00:00.000000000 +0100 +++ /home/httpd/musicbrainz/mb_server/admin/startup.pl~ 2008-10-02 15:58:39.000000000 +0200 @@ -0,0 +1,138 @@ +#!/usr/bin/perl -w +# vi: set ts=4 sw=4 : +use Apache2::compat; +require Apache2::compat; + +unshift @INC, sub { + my $file = $_[1]; + my $msg = "require $file"; + for (my $i = 0; my @c = caller($i); ++$i) + { + $msg .= "\n\tcalled from $c[0] ($c[1] line $c[2])"; + } + print STDERR $msg."\n"; + return undef; +} if 0; # set to 1 if you want to trace when modules are loaded + +use strict; +use warnings; +eval 'require Devel::SawAmpersand'; + +# TODO: Check to make sure this path points to where the cgi-bin stuff is +use lib "/home/httpd/musicbrainz/mb_server/cgi-bin"; + +# Make sure we are in a sane environment. +#$ENV{GATEWAY_INTERFACE} =~ /CGI/ +# or die "GATEWAY_INTERFACE not Perl!"; + +# cgi-bin/*.pl is run via Apache::Registry +#require Apache::Registry; + +#require Apache::Session; +use Apache2::compat; +require DBI; +DBI->install_driver("Pg"); + +# Some of the MB modules defer loading ("require" instead of "use") for some +# modules. If we know we're likely to want some module eventually, load it +# now. +require POSIX; +require IO::Socket::INET; # FreeDB +require OSSP::uuid; # TableBase +require Net::SMTP; # MusicBrainz::Server::Mail +require Time::ParseDate; + +# Alphabetical order, for ease of maintenance +# (apart from DBDefs and ModDefs, which we'll load first, just to make sure) +require DBDefs; +require ModDefs; + +require Album; +require Alias; +require Artist; +require DebugLog; +require FreeDB; +require Insert; +require Label; +require LocaleSaver; +# require MM; +# require MM_2_0; +# require MM_2_1; +require Moderation; +require MusicBrainz; +require MusicBrainz::Server::Annotation; +require MusicBrainz::Server::Attribute; +require MusicBrainz::Server::AutomodElection; +require MusicBrainz::Server::AlbumCDTOC; +require MusicBrainz::Server::Cache; +require MusicBrainz::Server::CDTOC; +require MusicBrainz::Server::Country; +require MusicBrainz::Server::CoverArt; +require MusicBrainz::Server::DateTime; +require MusicBrainz::Server::DeferredUpdate; +require MusicBrainz::Server::Handlers; +require MusicBrainz::Server::Language; +require MusicBrainz::Server::Link; +require MusicBrainz::Server::LinkAttr; +require MusicBrainz::Server::LinkEntity; +require MusicBrainz::Server::LinkType; +require MusicBrainz::Server::LogFile; +require MusicBrainz::Server::Mail; +require MusicBrainz::Server::Markup; +require MusicBrainz::Server::ModerationNote; +require MusicBrainz::Server::NewsFeed; +require MusicBrainz::Server::PagedReport; +require MusicBrainz::Server::Release; +require MusicBrainz::Server::Replication; +require MusicBrainz::Server::Script; +require MusicBrainz::Server::Tag; +require MusicBrainz::Server::TRMGateway; +require MusicBrainz::Server::TRMGatewayHandler; +require MusicBrainz::Server::URL; +require MusicBrainz::Server::Vote; +require MusicBrainz::Server::Handlers::WS::1::Common; +require MusicBrainz::Server::WikiTransclusion; +require MusicBrainz::Server::Validation; +# Don't load MusicBrainz::Server::Moderation::* - Moderation.pm does that +require Parser; +require QuerySupport; +# require RDF2; +require SearchEngine; +require Sql; +require Statistic; +require Style; +require TableBase; +require TaggerSupport; +require Track; +require TRM; +require PUID; +require UserPreference; +require UserStuff; +require UserSubscription; + +require &DBDefs::MB_SERVER_ROOT . "/admin/depend.pl"; + +# Loading the Mason handler preloads the pages, so the other MusicBrainz +# modules must be ready by this point. +require MusicBrainz::Server::Mason; + +# Preload Apache::Registry scripts + +{ + use ModPerl::RegistryLoader (); + use File::Spec (); +# use Apache::RegistryLoader (); +# my $r = Apache::RegistryLoader->new; + my $r = ModPerl::RegistryLoader->new; + + $r->handler("/cgi-bin/$_", &DBDefs::MB_SERVER_ROOT."/cgi-bin/$_") + for qw( mq.pl mq_2_1.pl rdf.pl rdf_2_1.pl ); +} + +# Mason will try to load these later, when $m->cache->... is used. +# Preload them. +require Cache::FileCache; +require HTML::Mason::Cache::BaseCache; + +1; +# eof startup.pl diff -uN -r ./cgi-bin/DBDefs.pm /home/httpd/musicbrainz/mb_server/cgi-bin/DBDefs.pm --- ./cgi-bin/DBDefs.pm 2008-10-02 03:33:32.000000000 +0200 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/DBDefs.pm 2008-10-02 17:53:19.000000000 +0200 @@ -57,9 +57,9 @@ READWRITE => { database => "musicbrainz_db", username => "musicbrainz_user", - password => "", - host => "", - port => "", + password => "ee", + host => "localhost", + port => "5432", }, # How to connect for read-only access. See "REPLICATION_TYPE" (below) READONLY => undef, @@ -68,8 +68,8 @@ database => "template1", username => "postgres", password => "", - host => "", - port => "", + host => "localhost", + port => "5432", }, # Raw data lives in a seperate DB to avoid the main DB from balooning in size. @@ -77,9 +77,9 @@ { database => "musicbrainz_db_raw", username => "musicbrainz_user", - password => "", - host => "", - port => "", + password => "ee", + host => "localhost", + port => "5432", }, # Fill out only if RAWDATA lives on a different host from the READWRITE server. RAWDATA_SYSTEM => undef, @@ -126,7 +126,7 @@ # passwords. However you MUST change it from the default # value (the empty string). This is so an attacker can't just look in CVS and # see the default secret value, and then use it to attack your server. -sub SMTP_SECRET_CHECKSUM { "" } +sub SMTP_SECRET_CHECKSUM { "zzz" } sub EMAIL_VERIFICATION_TIMEOUT { 604800 } # one week ################################################################################ diff -uN -r ./cgi-bin/DBDefs.pm~ /home/httpd/musicbrainz/mb_server/cgi-bin/DBDefs.pm~ --- ./cgi-bin/DBDefs.pm~ 1970-01-01 01:00:00.000000000 +0100 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/DBDefs.pm~ 2008-10-02 15:57:10.000000000 +0200 @@ -0,0 +1,250 @@ +#!/usr/bin/perl -w +# vi: set ts=4 sw=4 : +#____________________________________________________________________________ +# +# MusicBrainz -- the open internet music database +# +# Copyright (C) 1998 Robert Kaye +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: DBDefs.pm.default 9544 2007-10-14 21:31:30Z robert $ +#____________________________________________________________________________ + +package DBDefs; + +################################################################################ +# Directories +################################################################################ + +# The Server Root, i.e. the parent directory of admin, cgi-bin and htdocs +sub MB_SERVER_ROOT { "/home/httpd/musicbrainz/mb_server" } +# The htdocs directory +sub HTDOCS_ROOT { MB_SERVER_ROOT() . "/htdocs" } +# The data import directory (used by some reports) +sub DATA_IMPORT_DIR { "/home/httpd/musicbrainz/data-import" } + +# These two settings specify where to create the Apache::Session files +# that are needed for HTTP session persistence +sub LOCK_DIR { "/home/httpd/musicbrainz/locks" } +sub SESSION_DIR { "/home/httpd/musicbrainz/sessions" } + +# Mason's data_dir +sub MASON_DIR { "/home/httpd/musicbrainz/mason" } + + + +################################################################################ +# The Database +################################################################################ + +require MusicBrainz::Server::Database; +MusicBrainz::Server::Database->register_all( + { + # How to connect when we need read-write access to the database + READWRITE => { + database => "musicbrainz_db", + username => "musicbrainz_user", + password => "", + host => "", + port => "", + }, + # How to connect for read-only access. See "REPLICATION_TYPE" (below) + READONLY => undef, + # How to connect for administrative access + SYSTEM => { + database => "template1", + username => "postgres", + password => "", + host => "", + port => "", + }, + + # Raw data lives in a seperate DB to avoid the main DB from balooning in size. + RAWDATA => + { + database => "musicbrainz_db_raw", + username => "musicbrainz_user", + password => "", + host => "", + port => "", + }, + # Fill out only if RAWDATA lives on a different host from the READWRITE server. + RAWDATA_SYSTEM => undef, + }, +); + +# The schema sequence number. Must match the value in +# replication_control.current_schema_sequence. +sub DB_SCHEMA_SEQUENCE { 9 } + +# What type of server is this? +# * RT_MASTER - this is a master replication server. Changes are allowed, and +# they result in replication packets being produced. +# * RT_SLAVE - this is a slave replication server. After loading a snapshot +# produced by a master, the only changes allowed are those made +# by applying the next replication packet in turn. +# * RT_STANDALONE - this server neither generates nor uses replication +# packets. Changes to the database are allowed. +use MusicBrainz::Server::Replication ':replication_type'; +sub REPLICATION_TYPE { RT_STANDALONE } + +################################################################################ +# HTTP Server Names +################################################################################ + +# The host names of the HTML / RDF parts of the server +# To use a port number other than 80, add it like so: "myhost:8000" +sub WEB_SERVER { "www.musicbrainz.example.com" } +sub RDF_SERVER { "rdf.musicbrainz.example.com" } +sub LUCENE_SERVER { "search.musicbrainz.org" } + +################################################################################ +# Mail Settings +################################################################################ + +sub SMTP_SERVER { "localhost" } + +# If this is not undef, it lists a file to where all mail should be spooled +# (instead of being sent via SMTP_SERVER) +sub DEBUG_MAIL_SPOOL { undef } + +# This value should be set to some secret value for your server. Any old +# string of stuff should do; something suitably long and random, like for +# passwords. However you MUST change it from the default +# value (the empty string). This is so an attacker can't just look in CVS and +# see the default secret value, and then use it to attack your server. +sub SMTP_SECRET_CHECKSUM { "zzz" } +sub EMAIL_VERIFICATION_TIMEOUT { 604800 } # one week + +################################################################################ +# Documentation Server Settings +################################################################################ +sub WIKIDOC_SERVER { "wikidocs.musicbrainz.org" } +sub WIKITRANS_SERVER { "wiki.musicbrainz.org" } +sub WIKITRANS_INDEX_FILE { MB_SERVER_ROOT() . "/htdocs/generated/wikitrans-index" } +sub WIKITRANS_INDEX_URL { "http://musicbrainz.org/generated/wikitrans-index" } + +################################################################################ +# Cache Settings +################################################################################ + +# Show MISS, HIT, SET etc +sub CACHE_DEBUG { 1 } + +# Default expiry time in seconds. Use 0 for "never". +sub CACHE_DEFAULT_EXPIRES { 3600 } + +# Default delete time in seconds. Use 0 means allow re-insert straight away. +sub CACHE_DEFAULT_DELETE { 4 } + +# Cache::Memcached options +our %CACHE_OPTIONS = ( + servers => [ '127.0.0.1:11211' ], + debug => 0, +); +sub CACHE_OPTIONS { \%CACHE_OPTIONS } + +################################################################################ +# Rate-Limiting +################################################################################ + +# The "host:port" of the ratelimit server ($MB_SERVER/bin/ratelimit-server). +# If undef, the rate-limit code always returns undef (as it does if there is +# an error). +# Just like the memcached server settings, there is NO SECURITY built into the +# ratelimit protocol, so be careful about enabling it. +sub RATELIMIT_SERVER { undef } + +################################################################################ +# Other Settings +################################################################################ + +# Set this value to something true (e.g. 1) to set the server to read-only. +# To date, this option is widely ignored in the code; don't be surprised if you +# set it to true and find that writes are still possible. +sub DB_READ_ONLY { 0 } + +# Set this value to a message that you'd like to display to users when +# they attempt to write to your read-only database (not used if DB_READ_ONLY +# is false) +sub DB_READ_ONLY_MESSAGE { < 'musicbrainz01-20', + 'amazon.co.jp' => 'musicbrainz-22', + 'amazon.co.uk' => 'musicbrainz0c-21', + 'amazon.com' => 'musicbrainz0d-20', + 'amazon.de' => 'musicbrainz00-21', + 'amazon.fr' => 'musicbrainz0e-21', +); + +sub AWS_ASSOCIATE_ID +{ + return keys %amazon_store_associate_ids if not @_; + return $amazon_store_associate_ids{$_[0]}; +} + +sub AWS_DEVELOPER_ID { "D1TBI5FHXK38IE" } + +# Always use the ids now +sub AWS_USE_ASSOCIATE_IDS { 1 } + +1; +# eof DBDefs.pm diff -uN -r ./cgi-bin/MusicBrainz/Server/Handlers/WS/1/Tag.pm /home/httpd/musicbrainz/mb_server/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Tag.pm --- ./cgi-bin/MusicBrainz/Server/Handlers/WS/1/Tag.pm 2008-10-02 03:25:47.000000000 +0200 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Tag.pm 2008-10-02 16:47:33.000000000 +0200 @@ -26,11 +26,14 @@ use strict; package MusicBrainz::Server::Handlers::WS::1::Tag; +use Apache2::compat; -use Apache::Constants qw( ); +#use Apache::Constants qw( ); +use Apache2::Const qw( ); use Apache::File (); use MusicBrainz::Server::Handlers::WS::1::Common; -use Apache::Constants qw( OK BAD_REQUEST DECLINED SERVER_ERROR NOT_FOUND FORBIDDEN); +#use Apache::Constants qw( OK BAD_REQUEST DECLINED SERVER_ERROR NOT_FOUND FORBIDDEN); +use Apache2::Const qw( OK HTTP_BAD_REQUEST DECLINED SERVER_ERROR HTTP_NOT_FOUND FORBIDDEN); use MusicBrainz::Server::Tag; use Data::Dumper; @@ -77,16 +80,16 @@ my $error = "$@"; print STDERR "WS Error: $error\n"; # TODO: We should print a custom 500 server error screen with details about our error and where to report it - $r->status(Apache::Constants::SERVER_ERROR()); - return Apache::Constants::SERVER_ERROR(); + $r->status(Apache2::Const::SERVER_ERROR()); + return Apache2::Const::SERVER_ERROR(); } if (!defined $status) { - $r->status(Apache::Constants::NOT_FOUND()); - return Apache::Constants::NOT_FOUND(); + $r->status(Apache2::Const::HTTP_NOT_FOUND()); + return Apache2::Const::HTTP_NOT_FOUND(); } - return Apache::Constants::OK(); + return Apache2::Const::OK(); } sub handler_post @@ -147,8 +150,8 @@ } if (!defined $status) { - $r->status(NOT_FOUND); - return NOT_FOUND; + $r->status(HTTP_NOT_FOUND); + return HTTP_NOT_FOUND; } return OK; @@ -266,7 +269,7 @@ }; send_response($r, $printer); - return Apache::Constants::OK(); + return Apache2::Const::OK(); } sub print_xml diff -uN -r ./cgi-bin/MusicBrainz/Server/Handlers/WS/1/Track.pm /home/httpd/musicbrainz/mb_server/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Track.pm --- ./cgi-bin/MusicBrainz/Server/Handlers/WS/1/Track.pm 2008-10-02 03:25:47.000000000 +0200 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Track.pm 2008-10-02 16:43:07.000000000 +0200 @@ -27,10 +27,16 @@ package MusicBrainz::Server::Handlers::WS::1::Track; -use Apache::Constants qw( ); +use Apache2::compat; +#use Apache::Constants qw( ); +use Apache2::Const qw( ); use Apache::File (); use MusicBrainz::Server::Handlers::WS::1::Common qw( :DEFAULT apply_rate_limit ); -use Apache::Constants qw( OK BAD_REQUEST DECLINED SERVER_ERROR NOT_FOUND FORBIDDEN); +#use Apache::Constants qw( OK BAD_REQUEST DECLINED SERVER_ERROR NOT_FOUND FORBIDDEN); +use Apache2::Const qw( OK HTTP_BAD_REQUEST DECLINED SERVER_ERROR HTTP_NOT_FOUND FORBIDDEN); + + + sub handler { @@ -126,18 +132,18 @@ { my $error = "$@"; print STDERR "WS Error: $error\n"; - $r->status(Apache::Constants::SERVER_ERROR()); + $r->status(Apache2::Const::SERVER_ERROR()); $r->send_http_header("text/plain; charset=utf-8"); $r->print($error."\015\012") unless $r->header_only; - return Apache::Constants::SERVER_ERROR(); + return Apache2::Const::SERVER_ERROR(); } if (!defined $status) { - $r->status(Apache::Constants::NOT_FOUND()); - return Apache::Constants::NOT_FOUND(); + $r->status(Apache2::Const::HTTP_NOT_FOUND()); + return Apache2::Const::HTTP_NOT_FOUND(); } - return Apache::Constants::OK(); + return Apache2::Const::OK(); } sub serve_from_db @@ -152,7 +158,7 @@ }; send_response($r, $printer); - return Apache::Constants::OK(); + return Apache2::Const::OK(); } my $ar; @@ -179,7 +185,7 @@ }; send_response($r, $printer); - return Apache::Constants::OK(); + return Apache2::Const::OK(); } sub print_xml @@ -210,8 +216,8 @@ my ($trackid, $puid) = split(' ', $pair); if (!MusicBrainz::Server::Validation::IsGUID($puid) || !MusicBrainz::Server::Validation::IsGUID($trackid)) { - $r->status(BAD_REQUEST); - return BAD_REQUEST; + $r->status(HTTP_BAD_REQUEST); + return HTTP_BAD_REQUEST; } push @puids, { puid => $puid, trackmbid => $trackid }; } @@ -234,8 +240,8 @@ # Ensure that we're not a replicated server and that we were given a client version if (&DBDefs::REPLICATION_TYPE == &DBDefs::RT_SLAVE || $client eq '') { - $r->status(BAD_REQUEST); - return BAD_REQUEST; + $r->status(HTTP_BAD_REQUEST); + return HTTP_BAD_REQUEST; } my $status = eval @@ -259,8 +265,8 @@ } if (!defined $status) { - $r->status(NOT_FOUND); - return NOT_FOUND; + $r->status(HTTP_NOT_FOUND); + return HTTP_NOT_FOUND; } return OK; diff -uN -r ./cgi-bin/MusicBrainz/Server/Mason.pm /home/httpd/musicbrainz/mb_server/cgi-bin/MusicBrainz/Server/Mason.pm --- ./cgi-bin/MusicBrainz/Server/Mason.pm 2008-10-02 03:25:52.000000000 +0200 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/MusicBrainz/Server/Mason.pm 2008-10-02 17:29:12.000000000 +0200 @@ -30,7 +30,12 @@ package MusicBrainz::Server::Mason; -use Apache::Constants qw( DECLINED NOT_FOUND ); +#use Apache::Constants qw( DECLINED NOT_FOUND ); +use Apache2::Const; +use APR::Const; +use ModPerl::Const; +use Apache2::compat; +use Apache2::Request; sub preload_files { @@ -115,11 +120,11 @@ # out. And |u on its own is usually the wrong thing to do. $handler->interp->remove_escape('u'); - my $u = Apache->server->uid; - my $g = Apache->server->gid; + #my $u = Apache2->server->uid; + #my $g = Apache2->server->gid; - if (($> != $u or $) != $g) and ($>==0 or $<==0)) - { + #if (($> != $u or $) != $g) and ($>==0 or $<==0)) + #{ # Running as root? "chown" MASON_DIR to the Apache user and group # we're going to be serving requests under. # Mason claims to do this itself, but it doesn't seem to work :-( @@ -127,8 +132,9 @@ # This used to be done all in-process using File::Find; but doing it # this way is actually more efficient, because then we don't have to # bloat ourselves up with File::Find. - system "chown", "-R", "$u:$g", &DBDefs::MASON_DIR; - } + #system "chown", "-R", "$u:$g", &DBDefs::MASON_DIR; + system "chown", "-R", "apache:apache", &DBDefs::MASON_DIR; + #} $handler; } @@ -162,7 +168,8 @@ %cookies = (); { - my $req = Apache::Request->instance($r); + #my $req = Apache::Request()->instance($r); + my $req = Apache2::Request->new($r); $pnotes{'ispopup'} = ($req->param("ispopup") ? 1 : ""); } @@ -242,7 +249,7 @@ sub rate_limited { my ($r, $t) = @_; - $r->status(Apache::Constants::HTTP_SERVICE_UNAVAILABLE()); + $r->status(Apache2::Const::HTTP_SERVICE_UNAVAILABLE()); $r->headers_out->add("X-Rate-Limited", sprintf("%.1f %.1f %d", $t->rate, $t->limit, $t->period)); $r->send_http_header("text/plain; charset=utf-8"); unless ($r->header_only) @@ -250,7 +257,7 @@ $r->print("Your requests are exceeding the allowable rate limit (" . $t->msg . ")\015\012"); $r->print("Please slow down then try again.\015\012"); } - return Apache::Constants::OK(); + return Apache2::Constants::OK(); } # Given a key (optional - defaults to something sensible), tests to see if the diff -uN -r ./cgi-bin/rdf_2_1.pl /home/httpd/musicbrainz/mb_server/cgi-bin/rdf_2_1.pl --- ./cgi-bin/rdf_2_1.pl 2008-10-02 03:26:22.000000000 +0200 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/rdf_2_1.pl 2008-10-02 16:24:46.000000000 +0200 @@ -28,7 +28,8 @@ use QuerySupport; use DBDefs; use Apache; -use Apache::Request; +#use Apache::Request; +use Apache2::compat; use MM_2_1; my ($rdf, $mb, $query, $id, $out, $r, $depth); diff -uN -r ./cgi-bin/rdf.pl /home/httpd/musicbrainz/mb_server/cgi-bin/rdf.pl --- ./cgi-bin/rdf.pl 2008-10-02 03:26:22.000000000 +0200 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/rdf.pl 2008-10-02 16:22:33.000000000 +0200 @@ -28,7 +28,8 @@ use QuerySupport; use DBDefs; use Apache; -use Apache::Request; +#use Apache::Request; +use Apache2::compat; use MM_2_0; my ($rdf, $mb, $query, $id, $out, $r, $depth); diff -uN -r ./cgi-bin/UserStuff.pm /home/httpd/musicbrainz/mb_server/cgi-bin/UserStuff.pm --- ./cgi-bin/UserStuff.pm 2008-10-02 03:26:23.000000000 +0200 +++ /home/httpd/musicbrainz/mb_server/cgi-bin/UserStuff.pm 2008-10-02 17:25:14.000000000 +0200 @@ -31,14 +31,15 @@ use strict; use DBDefs; use MusicBrainz::Server::Validation; -use Apache; +use Apache2::compat; +#use Apache; use URI::Escape qw( uri_escape ); use CGI::Cookie; use Digest::SHA1 qw(sha1_base64); use Carp; use String::Similarity; use Encode qw( decode ); - +use Apache2::compat; use constant LOCKED_OUT_PASSWORD => ""; use constant AUTOMOD_FLAG => 1; @@ -1258,7 +1259,8 @@ my $session = GetSession(); return if $session->{uid}; - my $r = Apache->request; + #my $r = Apache->request; + my $r = Apache2::RequestUtil->request; # Get the permanent cookie my $c = $cookies->{&PERMANENT_COOKIE_NAME}