Update eqemu_server.pl [skip ci]

This commit is contained in:
Akkadius 2019-01-04 19:38:33 -06:00
parent bce3609617
commit f3782af10e

View File

@ -74,13 +74,14 @@ if(-e "eqemu_update.pl"){
print "[Info] For EQEmu Server management utilities - run eqemu_server.pl\n" if $ARGV[0] eq "ran_from_world";
check_db_version_table();
#::: Check if db_version table exists...
if(trim(get_mysql_result("SHOW COLUMNS FROM db_version LIKE 'Revision'")) ne "" && $db){
print get_mysql_result("DROP TABLE db_version");
print "[Database] Old db_version table present, dropping...\n\n";
}
check_db_version_table();
check_for_world_bootup_database_update();
sub urlencode {
@ -446,7 +447,8 @@ sub do_installer_routines {
#::: Download assets
if($OS eq "Windows"){
fetch_latest_windows_binaries();
# fetch_latest_windows_binaries();
fetch_latest_windows_appveyor();
get_remote_file($install_repository_request_url . "lua51.dll", "lua51.dll", 1);
get_remote_file($install_repository_request_url . "zlib1.dll", "zlib1.dll", 1);
get_remote_file($install_repository_request_url . "libmysql.dll", "libmysql.dll", 1);
@ -722,6 +724,7 @@ sub fetch_utility_scripts {
if($OS eq "Windows"){
get_remote_file($install_repository_request_url . "t_database_backup.bat", "t_database_backup.bat");
get_remote_file($install_repository_request_url . "t_start_server.bat", "t_start_server.bat");
get_remote_file($install_repository_request_url . "t_server_update_binaries_no_bots.bat", "t_server_update_binaries_no_bots.bat");
get_remote_file($install_repository_request_url . "t_start_server_with_login_server.bat", "t_start_server_with_login_server.bat");
get_remote_file($install_repository_request_url . "t_stop_server.bat", "t_stop_server.bat");
get_remote_file($install_repository_request_url . "t_server_crash_report.pl", "t_server_crash_report.pl");
@ -753,7 +756,7 @@ sub setup_bots {
sub show_menu_prompt {
$dc = 0;
while (1) {
while (1) {
if($ARGV[0] ne ""){
$input = trim($ARGV[0]);
@ -1015,7 +1018,7 @@ sub check_db_version_table{
version int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO db_version (version) VALUES ('1000');");
print "[Database] Table 'db_version' does not exists.... Creating...\n\n";
print "[Database] Table 'db_version' does not exist.... Creating...\n\n";
}
}
@ -1093,50 +1096,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){
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){
}
if($o=~/<longname>/i){
($long_name) = $o =~ /<longname>(.*)<\/longname>/;
print "Long Name: '" . $long_name . "'\n" if $debug;
}
if($in_database_tag == 1){
}
if($in_database_tag == 1){
@left = split (">", $o);
@right = split("<", $left[1]);
$tag_data = trim($right[0]);
if($o=~/<username>/i && $in_database_tag){
if($o=~/<username>/i && $in_database_tag){
$user = $tag_data;
print "Database User: '" . $user . "'\n" if $debug;
}
if($o=~/<password>/i && $in_database_tag){
}
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){
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);
}
}
}
close(CONFIG);
}
sub read_eqemu_config_json {
@ -1299,6 +1302,7 @@ sub fetch_latest_windows_binaries {
}
print "[Update] Done\n";
rmtree('updates_staged');
}
@ -1532,11 +1536,11 @@ sub fetch_peq_db_full{
print "[Install] DB :: Installing :: " . $destination_file . "\n";
get_mysql_result_from_file($file);
}
if($file=~/eqtime/i){
print "[Install] Installing eqtime.cfg\n";
copy_file($file, "eqtime.cfg");
}
}
#::: PEQ DB baseline version
print get_mysql_result("DELETE FROM db_version");
print get_mysql_result("INSERT INTO `db_version` (`version`) VALUES (9130);");
}
sub map_files_fetch_bulk{
@ -2030,8 +2034,8 @@ sub convert_existing_bot_data{
sub get_bots_db_version{
#::: Check if bots_version column exists...
if(get_mysql_result("SHOW COLUMNS FROM db_version LIKE 'bots_version'") eq "" && $db){
print get_mysql_result("ALTER TABLE db_version ADD bots_version int(11) DEFAULT '0' AFTER version;");
print "[Database] Column 'bots_version' does not exists.... Adding to 'db_version' table...\n\n";
print get_mysql_result("ALTER TABLE db_version ADD bots_version int(11) DEFAULT '0' AFTER version;");
print "[Database] Column 'bots_version' does not exists.... Adding to 'db_version' table...\n\n";
}
$bots_local_db_version = trim(get_mysql_result("SELECT bots_version FROM db_version LIMIT 1"));
return $bots_local_db_version;
@ -2157,7 +2161,7 @@ sub run_database_check{
}
#::: Iterate through Manifest backwards from binary version down to local version...
for($i = $binary_database_version ; $i > $revision_check; $i--){
for($i = $revision_check; $i < $binary_database_version; $i++){
if(!defined($m_d{$i}[0])){ next; }
$file_name = trim($m_d{$i}[1]);
@ -2263,12 +2267,12 @@ sub print_break{
}
sub generate_random_password {
my $passwordsize = shift;
my @alphanumeric = ('a'..'z', 'A'..'Z', 0..9);
my $randpassword = join '',
map $alphanumeric[rand @alphanumeric], 0..$passwordsize;
my $passwordsize = shift;
my @alphanumeric = ('a'..'z', 'A'..'Z', 0..9);
my $randpassword = join '',
map $alphanumeric[rand @alphanumeric], 0..$passwordsize;
return $randpassword;
return $randpassword;
}
sub quest_heading_convert {