]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - config/make-dbhelper.pl
remove .wdsl
[SourceForge/phpwiki.git] / config / make-dbhelper.pl
1 #!/usr/bin/perl -sn
2 # makefile helper to extract various settings from config/config.ini
3 # $Id: make-dbhelper.pl,v 1.2 2004-07-01 08:15:10 rurban Exp $
4
5 #if ($v eq 'DATABASE_TYPE' and /^\s*DATABASE_TYPE\s*=\s*(\w+)/) {
6 #    print "$1\n";
7 #    exit;
8 #}
9
10 # word split
11 if ($v eq 'DATABASE_DSN' and /^\s*DATABASE_DSN\s*=\s*"?([\w:\/@]+)/) {
12     my $result = '';
13     my $dsn = $1;
14     $dsn =~ /^(.+?):\/\//       and $result .= "$1 "; # backend
15     $dsn =~ /.+\/(.+?)$/        and $result .= "$1 "; # database: everything after the last slash
16     $dsn =~ /:\/\/(\w+):/       and $result .= "$1 "; # username (optional)
17     $dsn =~ /:\/\/\w+:(\w+)@/   and $result .= "$1 "; # password (optional)
18     print "$result\n";
19     exit;
20 }
21
22 if ($v ne 'DATABASE_DSN') {
23   if (/^\s*$v\s*=\s*"?([^;]+)$/) {
24     print "$1\n";
25     exit;
26   }
27 }