eqemu_update.pl minor adjustment, v10 [skip ci]

This commit is contained in:
Akkadius 2015-10-03 16:03:53 -05:00
parent 9bf4f399da
commit bcf2a5c852
2 changed files with 19 additions and 12 deletions

View File

@ -494,7 +494,7 @@ bool Database::CheckDatabaseConversions() {
/* Check for a new version of this script, the arg passed /* Check for a new version of this script, the arg passed
would have to be higher than the copy they have downloaded would have to be higher than the copy they have downloaded
locally and they will re fetch */ 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 */ /* Run Automatic Database Upgrade Script */
system("perl eqemu_update.pl ran_from_world"); system("perl eqemu_update.pl ran_from_world");

View File

@ -22,7 +22,7 @@ if($Config{osname}=~/linux/i){ $OS = "Linux"; }
if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; }
#::: If current version is less than what world is reporting, then download a new one... #::: 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[0] eq "V"){
if($ARGV[1] > $current_version){ if($ARGV[1] > $current_version){
@ -146,9 +146,12 @@ if($db){
print " Binary Revision / Local: (" . $bin_db_ver . " / " . $local_db_ver . ")\n"; print " Binary Revision / Local: (" . $bin_db_ver . " / " . $local_db_ver . ")\n";
#::: Bots #::: Bots
$bots_local_db_version = trim(get_mysql_result("SELECT bots_version FROM db_version LIMIT 1")); #::: Make sure we're running a bots binary to begin with
if($bots_local_db_version > 0){ if(trim($db_version[2]) > 0){
print " (Bots) Binary Revision / Local: (" . trim($db_version[2]) . " / " . $bots_local_db_version . ")\n"; $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... #::: If World ran this script, and our version is up to date, continue...
@ -707,6 +710,16 @@ sub are_file_sizes_different{
return; 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{ sub bots_db_management{
#::: Main Binary Database version #::: Main Binary Database version
$bin_db_ver = trim($db_version[2]); $bin_db_ver = trim($db_version[2]);
@ -724,13 +737,7 @@ sub bots_db_management{
#::: Set on flag for running bot updates... #::: Set on flag for running bot updates...
$bots_db_management = 1; $bots_db_management = 1;
#::: Check if bots_version column exists... $bots_local_db_version = get_bots_db_version();
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"));
run_database_check(); run_database_check();
} }