summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinDarth <borzifrancesco@gmail.com>2016-08-30 15:13:26 +0200
committerShinDarth <borzifrancesco@gmail.com>2016-08-30 15:13:26 +0200
commit2cf163434ca7d96b81be08a3604c55804766e43e (patch)
treef2ea57042bd4f3cef60c30406b54be4e3763e00e
parent736b92d9a70a30db1bff67cd2df2c596b4ce99c9 (diff)
parent6c4b7dc3ef4f688947534011b20231e21ad59596 (diff)
Merge remote-tracking branch 'upstream/master'
-rw-r--r--.travis.yml64
-rw-r--r--README.md1
-rwxr-xr-xbin/db_assembler/db_assembler.sh100
-rwxr-xr-xbin/db_pendings/import.sh68
-rwxr-xr-xbin/runners/run-engine3
-rw-r--r--data/sql/create/create_mysql.sql13
-rw-r--r--data/sql/create/drop_mysql.sql21
-rw-r--r--data/sql/updates/db_world/2016_08_26_00.sql2
-rwxr-xr-xdata/sql/updates/pending_db_auth/create_sql.sh7
-rwxr-xr-xdata/sql/updates/pending_db_characters/create_sql.sh7
-rwxr-xr-xdata/sql/updates/pending_db_world/create_sql.sh7
11 files changed, 209 insertions, 84 deletions
diff --git a/.travis.yml b/.travis.yml
index 68008293e1..9a9e31a38a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,44 +1,38 @@
-# Copyright (C)
-#
-# This file is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+sudo: required
+dist: trusty
language: cpp
+compiler:
+ - clang
git:
depth: 1
-branches:
- only:
- - master
+before_install:
+ - sudo apt-get -qq install build-essential libtool make cmake cmake-data openssl
+ - sudo apt-get -qq install libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev libace-dev
+ - sudo apt-get -qq install mysql-server
+ - git config user.email "travis@build.bot" && git config user.name "Travis CI"
+ - git tag -a -m "Travis build" init
-compiler:
- - clang
- - gcc ## Uncomment when we are up to full c++11 standards.
+install:
+ - mysql -uroot -e 'create database test_mysql;'
+ - cd bin
+ - cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=0 -DSCRIPTS=1 -DSERVERS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=check_install
+ - cd ..
-before_install:
- - sudo add-apt-repository ppa:kalakris/cmake -y
- - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- - sudo add-apt-repository 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.7 main'
- - wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- - sudo apt-get update -qq
- - sudo apt-get install clang-3.7
- - sudo apt-get install libace-dev
- - sudo apt-get install libncurses5-dev
- - sudo apt-get install build-essential autoconf libtool make cmake git-core patch wget links zip unzip unrar
- - sudo apt-get install openssl libssl-dev mysql-server mysql-client libmysqlclient15-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev
- - if [ "$CXX" = "clang++" ]; then sudo apt-get install -qq libstdc++-4.8-dev; fi
- - if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
- - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
-
script:
- - mkdir build
- - cd build
- - cmake ../ -DSCRIPTS=1 -DTOOLS=1
- - make -j8 \ No newline at end of file
+ - $CXX --version
+ - mysql -uroot < data/sql/create/create_mysql.sql
+ - cat data/sql/base/db_auth/*.sql | mysql -uacore -pacore auth
+ - cat data/sql/base/db_characters/*.sql | mysql -uacore -pacore characters
+ - cat data/sql/base/db_world/*.sql | mysql -uacore -pacore world
+ - cat data/sql/updates/db_auth/*.sql | mysql -uacore -pacore auth
+ - cat data/sql/updates/db_characters/*.sql | mysql -uacore -pacore characters
+ - cat data/sql/updates/db_world/*.sql | mysql -uacore -pacore world
+ - mysql -uroot < data/sql/create/drop_mysql.sql
+ - cd bin
+ - make -j 8 -k && make install
+ - cd check_install/bin
+ - ./authserver --version
+ - ./worldserver --version
diff --git a/README.md b/README.md
index 2e26bf6239..a56835a711 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
[![Gitter](https://badges.gitter.im/azerothcore/azerothcore.svg)](https://gitter.im/azerothcore/azerothcore?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=40032087)](https://www.bountysource.com/teams/azerothcore/bounties) [![Issue Stats](http://www.issuestats.com/github/AzerothCore/azerothcore-wotlk/badge/issue)](http://www.issuestats.com/github/AzerothCore/azerothcore-wotlk) [![Issue Stats](http://www.issuestats.com/github/AzerothCore/azerothcore-wotlk/badge/pr)](http://www.issuestats.com/github/AzerothCore/azerothcore-wotlk)
+[![Master Build Status](https://travis-ci.org/azerothcore/azerothcore-wotlk.svg)](https://travis-ci.org/azerothcore/azerothcore)
## Introduction
diff --git a/bin/db_assembler/db_assembler.sh b/bin/db_assembler/db_assembler.sh
index ebf6dbc2a3..74902ab729 100755
--- a/bin/db_assembler/db_assembler.sh
+++ b/bin/db_assembler/db_assembler.sh
@@ -27,22 +27,25 @@ fi
function assemble() {
# to lowercase
- database=$1
+ database=${1,,}
start_sql=$2
with_base=$3
with_updates=$4
with_custom=$5
- var_base="DB_"$database"_PATHS"
- base=${!var_base}
+ uc=${database^^}
- var_updates="DB_"$database"_UPDATE_PATHS"
- updates=${!var_updates}
+ name="DB_"$uc"_PATHS"
+ v="$name[@]"
+ base=("${!v}")
- var_custom="DB_"$database"_CUSTOM_PATHS"
- custom=${!var_custom}
+ name="DB_"$uc"_UPDATE_PATHS"
+ v="$name[@]"
+ updates=("${!v}")
- echo $updates
+ name='DB_'$uc'_CUSTOM_PATHS'
+ v="$name[@]"
+ custom=("${!v}")
suffix_base="_base"
@@ -95,11 +98,12 @@ function assemble() {
n="registry__$hash"
if [[ -z ${!n} ]]; then
if [ ! -e $updFile ]; then
- echo "" > $updFile
+ echo "-- assembled updates" > $updFile
fi
printf -v "registry__${hash}" %s "$file"
echo "-- New update sql: "$file
+ echo "-- $file"
cat "$entry" >> $updFile
fi
done
@@ -109,7 +113,7 @@ function assemble() {
fi
if [ $with_custom = true ]; then
- custFile=$OUTPUT_FOLDER$database$suffix_custom"_"$curTime".sql"
+ custFile=$OUTPUT_FOLDER$database$suffix_custom".sql"
if [ ! ${#custom[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_custom ..."
@@ -124,19 +128,12 @@ function assemble() {
continue
fi
- file=$(basename "$entry")
- hash=$($MD5_CMD "$entry")
- hash="${hash%% *}" #remove file path
- n="registry__$hash"
- if [[ -z ${!n} ]]; then
- if [ ! -e $custFile ]; then
- echo "" > $custFile
- fi
-
- printf -v "registry__${hash}" %s "$file"
- echo "-- New custom sql: "$file
- cat "$entry" >> $custFile
+ if [[ ! -e $custFile ]]; then
+ echo "-- assembled custom" > "$custFile"
fi
+
+ echo "-- $file" >> $custFile
+ cat "$entry" >> $custFile
done
fi
done
@@ -144,22 +141,55 @@ function assemble() {
fi
}
+function run() {
+ echo "===== STARTING PROCESS ====="
-echo "===== STARTING PROCESS ====="
+ mkdir -p $OUTPUT_FOLDER
- mkdir -p $OUTPUT_FOLDER
+ for db in ${DATABASES[@]}
+ do
+ assemble "$db" $version".sql" $1 $2 $3
+ done
- for db in ${DATABASES[@]}
- do
- assemble "$db" $version".sql" true true true
- done
+ echo "" > $reg_file
- echo "" > $reg_file
+ for k in ${!registry__*}
+ do
+ n=$k
+ echo "$k='${!n}';" >> "$reg_file"
+ done
- for k in ${!registry__*}
- do
- n=$k
- echo "$k='${!n}';" >> "$reg_file"
- done
+ echo "===== DONE ====="
+}
-echo "===== DONE ====="
+PS3='Please enter your choice: '
+options=("Create ALL" "Create only bases" "Create only updates" "Create only customs" "Clean registry" "Quit")
+select opt in "${options[@]}"
+do
+ case $opt in
+ "Create ALL")
+ run true true true
+ break #avoid loop
+ ;;
+ "Create only bases")
+ run true false false
+ break #avoid loop
+ ;;
+ "Create only updates")
+ run false true false
+ break #avoid loop
+ ;;
+ "Create only customs")
+ run false false true
+ break #avoid loop
+ ;;
+ "Clean registry")
+ rm "$reg_file"
+ break #avoid loop
+ ;;
+ "Quit")
+ break
+ ;;
+ *) echo invalid option;;
+ esac
+done
diff --git a/bin/db_pendings/import.sh b/bin/db_pendings/import.sh
index e0497bf549..cf85cd349e 100755
--- a/bin/db_pendings/import.sh
+++ b/bin/db_pendings/import.sh
@@ -4,12 +4,11 @@ CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/../bash_shared/includes.sh"
-
-
UPDATES_PATH="$AC_PATH_ROOT/data/sql/updates/"
function import() {
- folder="db_"$1
+ db=$1
+ folder="db_"$db
pendingPath="$AC_PATH_ROOT/data/sql/updates/pending_$folder"
updPath="$UPDATES_PATH/$folder"
@@ -35,22 +34,65 @@ function import() {
for entry in "$pendingPath"/*.sql
do
if [[ -e $entry ]]; then
+ oldVer=$oldDate"_"$oldCnt
+
+ cnt=$(printf -v counter "%02d" $counter ; echo $counter)
+
+ newVer=$dateToday"_"$cnt
+
startTransaction="START TRANSACTION;";
- updHeader="ALTER TABLE db_version CHANGE COLUMN "$latestUpd" "$dateToday"_"$counter" bit;";
+ updHeader="ALTER TABLE version_db_"$db" CHANGE COLUMN "$oldVer" "$newVer" bit;";
endTransaction="COMMIT;";
- cnt=$(printf -v counter "%02d" $counter ; echo $counter)
newFile="$updPath/"$dateToday"_"$cnt".sql"
- echo "$startTransaction" > "$newFile"
- echo "$updHeader" >> "$newFile"
- echo "--" >> "$newFile"
- echo "--" >> "$newFile"
+ oldFile=$(basename "$entry")
+ prefix=${oldFile%_*.sql}
+ suffix=${oldFile#rev_}
+ rev=${suffix%.sql}
+
+ [[ $prefix = "rev" && $suffix =~ ^-?[0-9]+$ ]] && isRev=1 || isRev=0
+
+ echo "-- DB update $oldVer -> $newVer" > "$newFile";
- cat $entry >> "$newFile"
- echo "$endTransaction" >> "$newFile"
+ if [[ $isRev ]]; then
+ echo "DROP PROCEDURE IF EXISTS \`updateDb\`;" >> "$newFile";
+ echo "DELIMITER //" >> "$newFile";
+ echo "CREATE PROCEDURE updateDb ()" >> "$newFile";
+ echo "proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE';" >> "$newFile";
+ fi
- rm $entry
+ echo "$startTransaction" >> "$newFile";
+ echo "$updHeader" >> "$newFile";
+
+ if [[ $isRev ]]; then
+ echo "SELECT sql_rev INTO OK FROM version_db_"$db" WHERE sql_rev = '$rev'; IF OK <> 'FALSE' THEN LEAVE proc; END IF;" >> "$newFile";
+ fi;
+
+ echo "--" >> "$newFile";
+ echo "-- START UPDATING QUERIES" >> "$newFile";
+ echo "--" >> "$newFile";
+
+ cat $entry >> "$newFile";
+
+ echo "--" >> "$newFile";
+ echo "-- END UPDATING QUERIES" >> "$newFile";
+ echo "--" >> "$newFile";
+
+ echo "$endTransaction" >> "$newFile";
+
+ if [[ $isRev ]]; then
+ echo "END;" >> "$newFile";
+ echo "//" >> "$newFile";
+ echo "DELIMITER ;" >> "$newFile";
+ echo "CALL updateDb();" >> "$newFile";
+ echo "DROP PROCEDURE IF EXISTS \`updateDb\`;" >> "$newFile";
+ fi;
+
+ rm $entry;
+
+ oldDate=$dateToday
+ oldCnt=$cnt
((counter+=1))
fi
@@ -61,3 +103,5 @@ function import() {
import "world"
import "characters"
import "auth"
+
+echo "Done."
diff --git a/bin/runners/run-engine b/bin/runners/run-engine
index 823bf0b3c6..a1b82ec365 100755
--- a/bin/runners/run-engine
+++ b/bin/runners/run-engine
@@ -1,7 +1,8 @@
#!/bin/bash
function checkStatus() {
- if screen -ls $1 | grep -q "No Sockets found"
+ # wipe do : destroy old screens + ls
+ if screen -wipe $1 | grep -q "No Sockets found"
then
return 0
else
diff --git a/data/sql/create/create_mysql.sql b/data/sql/create/create_mysql.sql
new file mode 100644
index 0000000000..8d2e47cb47
--- /dev/null
+++ b/data/sql/create/create_mysql.sql
@@ -0,0 +1,13 @@
+GRANT USAGE ON * . * TO 'acore'@'localhost' IDENTIFIED BY 'acore' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 ;
+
+CREATE DATABASE `world` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+CREATE DATABASE `characters` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+CREATE DATABASE `auth` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+GRANT ALL PRIVILEGES ON `world` . * TO 'acore'@'localhost' WITH GRANT OPTION;
+
+GRANT ALL PRIVILEGES ON `characters` . * TO 'acore'@'localhost' WITH GRANT OPTION;
+
+GRANT ALL PRIVILEGES ON `auth` . * TO 'acore'@'localhost' WITH GRANT OPTION; \ No newline at end of file
diff --git a/data/sql/create/drop_mysql.sql b/data/sql/create/drop_mysql.sql
new file mode 100644
index 0000000000..90f33cb01c
--- /dev/null
+++ b/data/sql/create/drop_mysql.sql
@@ -0,0 +1,21 @@
+REVOKE ALL PRIVILEGES ON * . * FROM 'acore'@'localhost';
+
+REVOKE ALL PRIVILEGES ON `world` . * FROM 'acore'@'localhost';
+
+REVOKE GRANT OPTION ON `world` . * FROM 'acore'@'localhost';
+
+REVOKE ALL PRIVILEGES ON `characters` . * FROM 'acore'@'localhost';
+
+REVOKE GRANT OPTION ON `characters` . * FROM 'acore'@'localhost';
+
+REVOKE ALL PRIVILEGES ON `auth` . * FROM 'acore'@'localhost';
+
+REVOKE GRANT OPTION ON `auth` . * FROM 'acore'@'localhost';
+
+DROP USER 'acore'@'localhost';
+
+DROP DATABASE IF EXISTS `world`;
+
+DROP DATABASE IF EXISTS `characters`;
+
+DROP DATABASE IF EXISTS `auth`;
diff --git a/data/sql/updates/db_world/2016_08_26_00.sql b/data/sql/updates/db_world/2016_08_26_00.sql
index 0c610dbdec..8ebf2c1518 100644
--- a/data/sql/updates/db_world/2016_08_26_00.sql
+++ b/data/sql/updates/db_world/2016_08_26_00.sql
@@ -1,3 +1,3 @@
-ALTER TABLE version_db_database CHANGE COLUMN 2016_08_25_00 2016_08_26_00 bit;
+ALTER TABLE version_db_world CHANGE COLUMN 2016_08_25_00 2016_08_26_00 bit;
DELETE FROM command WHERE name IN ('npc evade', 'debug send chatmessage');
diff --git a/data/sql/updates/pending_db_auth/create_sql.sh b/data/sql/updates/pending_db_auth/create_sql.sh
new file mode 100755
index 0000000000..e0ecec83bf
--- /dev/null
+++ b/data/sql/updates/pending_db_auth/create_sql.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )";
+
+rev=$( date +%s%N );
+
+echo "INSERT INTO version_db_auth(\`sql_rev\`) VALUES ('"$rev"');" > "$CUR_PATH/rev_"$rev".sql" && echo "File created";
diff --git a/data/sql/updates/pending_db_characters/create_sql.sh b/data/sql/updates/pending_db_characters/create_sql.sh
new file mode 100755
index 0000000000..94e9588d0f
--- /dev/null
+++ b/data/sql/updates/pending_db_characters/create_sql.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )";
+
+rev=$( date +%s%N );
+
+echo "INSERT INTO version_db_characters(\`sql_rev\`) VALUES ('"$rev"');" > "$CUR_PATH/rev_"$rev".sql" && echo "File created";
diff --git a/data/sql/updates/pending_db_world/create_sql.sh b/data/sql/updates/pending_db_world/create_sql.sh
new file mode 100755
index 0000000000..1ec4fae62b
--- /dev/null
+++ b/data/sql/updates/pending_db_world/create_sql.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )";
+
+rev=$( date +%s%N );
+
+echo "INSERT INTO version_db_world(\`sql_rev\`) VALUES ('"$rev"');" > "$CUR_PATH/rev_"$rev".sql" && echo "File created";