Update eqemu_server.pl [skip ci] - Fix eqemu_config.xml tag parsing scenarios

This commit is contained in:
Akkadius 2016-10-18 16:49:47 -05:00 committed by GitHub
parent fe968f83a3
commit 97999a63b7

View File

@ -1063,46 +1063,50 @@ sub trim {
}
sub read_eqemu_config_xml {
open (CONFIG, "eqemu_config.xml");
while (<CONFIG>){
chomp;
$o = $_;
open (CONFIG, "eqemu_config.xml");
while (<CONFIG>){
chomp;
$o = $_;
if($o=~/\<\!--/i){
next;
}
if($o=~/\<\!--/i){
next;
}
if($o=~/database/i && $o=~/\<\//i){
$in_database_tag = 0;
}
if($o=~/<database>/i){
print "IN DATABASE TAG\n" if $debug;
$in_database_tag = 1;
}
if($o=~/<longname>/i){
($long_name) = $o =~ /<longname>(.*)<\/longname>/;
print "Long Name: '" . $long_name . "'\n" if $debug;
}
if($in_database_tag == 1){
@left = split (">", $o);
@right = split("<", $left[1]);
$tag_data = trim($right[0]);
if($o=~/database/i && $o=~/\<\//i){
$in_database_tag = 0;
}
if($o=~/\<database\>/i){
print "IN DATABASE TAG\n" if $debug;
$in_database_tag = 1;
}
if($o=~/\<longname\>/i){
($long_name) = $o =~ /<longname>(.*)<\/longname>/;
print "Long Name: " . $long_name . "\n" if $debug;
}
if($in_database_tag == 1){
if($o=~/\<username\>/i && $in_database_tag){
($user) = $o =~ />(\w+)</;
print "Database User: " . $user . "\n" if $debug;
}
if($o=~/\<password\>/i && $in_database_tag){
($pass) = $o =~ />(\w+)</;
print "Database Pass: " . $pass . "\n" if $debug;
}
if($o=~/\<db\>/i){
($db) = $o =~ />(\w+)</;
print "Database Name: " . $db . "\n" if $debug;
}
if($o=~/\<host\>/i){
($host) = $o =~ />(\w+)</;
print "Database Host: " . $host . "\n" if $debug;
}
}
}
close(CONFIG);
if($o=~/<username>/i && $in_database_tag){
$user = $tag_data;
print "Database User: '" . $user . "'\n" if $debug;
}
if($o=~/<password>/i && $in_database_tag){
$pass = $tag_data;
print "Database Pass: '" . $pass . "'\n" if $debug;
}
if($o=~/<db>/i){
$db = $tag_data;
print "Database Name: '" . $db . "'\n" if $debug;
}
if($o=~/<host>/i){
$host = $tag_data;
print "Database Host: '" . $host . "'\n" if $debug;
}
}
}
close(CONFIG);
}
#::: Fetch Latest PEQ AA's