Project

General

Profile

Patch #6475 » Redmine.pm-Get_project_id_from_apache.diff

Patch against redmine-1.0.1, with comments - Sergio Talens-Oliag, 2010-09-23 14:10

View differences:

redmine-1.0.1/extra/svn/Redmine.pm 2010-09-23 14:13:43.464082780 +0200
reposman.rb --redmine my.redmine.server --svn-dir /var/svn --owner www-data -u http://svn.server/svn-private/
If you want to use this module for a single repository you can do it, but you
have to set RedmineProjectId to the name of the project it is related to (we
could set a flag and use the last component of the location as the project
identifier, but using this option we don't need to use the same name for the
repository and the project identifier):
PerlLoadModule Apache::Authn::Redmine
<Location /svn/$MY_PROJECT_REPO_URL>
DAV svn
SVNPath "/var/svn/$MY_PROJECT_REPO_NAME"
AuthType Basic
AuthName redmine
Require valid-user
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
RedmineDSN "DBI:Pg:dbname=databasename;host=my.db.server"
RedmineDbUser "redmine"
RedmineDbPass "password"
RedmineProjectId "$MY_PROJECT_REDMINE_ID"
</Location>
=head1 MIGRATION FROM OLDER RELEASES
If you use an older reposman.rb (r860 or before), you need to change
......
args_how => TAKE1,
errmsg => 'RedmineCacheCredsMax must be decimal number',
},
{
name => 'RedmineProjectId',
req_override => OR_AUTHCFG,
args_how => TAKE1,
},
);
sub RedmineDSN {
......
}
}
sub RedmineProjectId { set_val('RedmineProjectId', @_); }
sub trim {
my $string = shift;
$string =~ s/\s{2,}/ /g;
......
sub get_project_identifier {
my $r = shift;
my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
my $projectid = $cfg->{RedmineProjectId};
if ($projectid) { return $projectid; }
my $location = $r->location;
my ($identifier) = $r->uri =~ m{$location/*([^/]+)};
$identifier;
(2-2/2)