Project

General

Profile

Patch #14438 ยป redmine_project_id.diff

Tiffany C, 2013-07-12 07:10

View differences:

Redmine.pm (working copy)
233 233
    req_override => OR_AUTHCFG,
234 234
    args_how => TAKE1,
235 235
  },
236
  {
237
    name => 'RedmineProjectId',
238
    req_override => OR_AUTHCFG,
239
    args_how => TAKE1,
240
  },
236 241
);
237 242

  
238 243
sub RedmineDSN {
......
282 287
  }
283 288
}
284 289

  
290
sub RedmineProjectId { set_val('RedmineProjectId', @_); }
291

  
285 292
sub trim {
286 293
  my $string = shift;
287 294
  $string =~ s/\s{2,}/ /g;
......
529 536

  
530 537
    my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
531 538
    my $location = $r->location;
532
    $location =~ s/\.git$// if (defined $cfg->{RedmineGitSmartHttp} and $cfg->{RedmineGitSmartHttp});
533
    my ($identifier) = $r->uri =~ m{$location/*([^/.]+)};
534
    $identifier;
539

  
540
    if($cfg->{RedmineProjectId}) {     
541
      my ($identifier) = $cfg->{RedmineProjectId};
542
      return $identifier;
543
    } else {
544
      $location =~ s/\.git$// if (defined $cfg->{RedmineGitSmartHttp} and $cfg->{RedmineGitSmartHttp});
545
      my ($identifier) = $r->uri =~ m{$location/*([^/.]+)};
546
      return $identifier;
547
    }
535 548
}
536 549

  
537 550
sub connect_database {
    (1-1/1)