From bcf2a5c852f0e1677c67da23f75e69457155fda9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 3 Oct 2015 16:03:53 -0500 Subject: [PATCH] eqemu_update.pl minor adjustment, v10 [skip ci] --- common/database_conversions.cpp | 2 +- utils/scripts/eqemu_update.pl | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index 8270527c9..c3c54cde5 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -494,7 +494,7 @@ bool Database::CheckDatabaseConversions() { /* Check for a new version of this script, the arg passed would have to be higher than the copy they have downloaded locally and they will re fetch */ - system("perl eqemu_update.pl V 9"); + system("perl eqemu_update.pl V 10"); /* Run Automatic Database Upgrade Script */ system("perl eqemu_update.pl ran_from_world"); diff --git a/utils/scripts/eqemu_update.pl b/utils/scripts/eqemu_update.pl index 37a2505d9..00d506630 100644 --- a/utils/scripts/eqemu_update.pl +++ b/utils/scripts/eqemu_update.pl @@ -22,7 +22,7 @@ if($Config{osname}=~/linux/i){ $OS = "Linux"; } if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } #::: If current version is less than what world is reporting, then download a new one... -$current_version = 9; +$current_version = 10; if($ARGV[0] eq "V"){ if($ARGV[1] > $current_version){ @@ -146,9 +146,12 @@ if($db){ print " Binary Revision / Local: (" . $bin_db_ver . " / " . $local_db_ver . ")\n"; #::: Bots - $bots_local_db_version = trim(get_mysql_result("SELECT bots_version FROM db_version LIMIT 1")); - if($bots_local_db_version > 0){ - print " (Bots) Binary Revision / Local: (" . trim($db_version[2]) . " / " . $bots_local_db_version . ")\n"; + #::: Make sure we're running a bots binary to begin with + if(trim($db_version[2]) > 0){ + $bots_local_db_version = get_bots_db_version(); + if($bots_local_db_version > 0){ + print " (Bots) Binary Revision / Local: (" . trim($db_version[2]) . " / " . $bots_local_db_version . ")\n"; + } } #::: If World ran this script, and our version is up to date, continue... @@ -707,6 +710,16 @@ sub are_file_sizes_different{ return; } +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 "\nColumn '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; +} + sub bots_db_management{ #::: Main Binary Database version $bin_db_ver = trim($db_version[2]); @@ -724,13 +737,7 @@ sub bots_db_management{ #::: Set on flag for running bot updates... $bots_db_management = 1; - #::: 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 "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")); + $bots_local_db_version = get_bots_db_version(); run_database_check(); }