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
82 82

  
83 83
  reposman.rb --redmine my.redmine.server --svn-dir /var/svn --owner www-data -u http://svn.server/svn-private/
84 84

  
85
If you want to use this module for a single repository you can do it, but you
86
have to set RedmineProjectId to the name of the project it is related to (we
87
could set a flag and use the last component of the location as the project
88
identifier, but using this option we don't need to use the same name for the
89
repository and the project identifier):
90

  
91
   PerlLoadModule Apache::Authn::Redmine
92
   <Location /svn/$MY_PROJECT_REPO_URL>
93
     DAV svn
94
     SVNPath "/var/svn/$MY_PROJECT_REPO_NAME"
95

  
96
     AuthType Basic
97
     AuthName redmine
98
     Require valid-user
99

  
100
     PerlAccessHandler Apache::Authn::Redmine::access_handler
101
     PerlAuthenHandler Apache::Authn::Redmine::authen_handler
102

  
103
     RedmineDSN "DBI:Pg:dbname=databasename;host=my.db.server"
104

  
105
     RedmineDbUser "redmine"
106
     RedmineDbPass "password"
107

  
108
     RedmineProjectId "$MY_PROJECT_REDMINE_ID"
109
  </Location>
110

  
85 111
=head1 MIGRATION FROM OLDER RELEASES
86 112

  
87 113
If you use an older reposman.rb (r860 or before), you need to change
......
142 168
    args_how => TAKE1,
143 169
    errmsg => 'RedmineCacheCredsMax must be decimal number',
144 170
  },
171
  {
172
    name => 'RedmineProjectId',
173
    req_override => OR_AUTHCFG,
174
    args_how => TAKE1,
175
  },
145 176
);
146 177

  
147 178
sub RedmineDSN { 
......
178 209
  }
179 210
}
180 211

  
212
sub RedmineProjectId { set_val('RedmineProjectId', @_); }
213

  
181 214
sub trim {
182 215
  my $string = shift;
183 216
  $string =~ s/\s{2,}/ /g;
......
371 404
sub get_project_identifier {
372 405
    my $r = shift;
373 406
    
407
    my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
408
    my $projectid = $cfg->{RedmineProjectId};
409
    if ($projectid) { return $projectid; }
410

  
374 411
    my $location = $r->location;
375 412
    my ($identifier) = $r->uri =~ m{$location/*([^/]+)};
376 413
    $identifier;
(2-2/2)