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