Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ShinDarth
2016-08-30 15:13:26 +02:00
11 changed files with 211 additions and 86 deletions

View File

@@ -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
compiler:
- clang
- gcc ## Uncomment when we are up to full c++11 standards.
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
- 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
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 ..
script:
- mkdir build
- cd build
- cmake ../ -DSCRIPTS=1 -DTOOLS=1
- make -j8
- $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

View File

@@ -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

View File

@@ -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

View File

@@ -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
startTransaction="START TRANSACTION;";
updHeader="ALTER TABLE db_version CHANGE COLUMN "$latestUpd" "$dateToday"_"$counter" bit;";
endTransaction="COMMIT;";
oldVer=$oldDate"_"$oldCnt
cnt=$(printf -v counter "%02d" $counter ; echo $counter)
newVer=$dateToday"_"$cnt
startTransaction="START TRANSACTION;";
updHeader="ALTER TABLE version_db_"$db" CHANGE COLUMN "$oldVer" "$newVer" bit;";
endTransaction="COMMIT;";
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}
cat $entry >> "$newFile"
echo "$endTransaction" >> "$newFile"
[[ $prefix = "rev" && $suffix =~ ^-?[0-9]+$ ]] && isRev=1 || isRev=0
rm $entry
echo "-- DB update $oldVer -> $newVer" > "$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
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."

View File

@@ -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

View File

@@ -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;

View File

@@ -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`;

View File

@@ -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');

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";