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