DB/Misc: A lucky bag random fixes
SQL: Maybe I'll have more luck :(
Revert "DB/Misc: A lucky bag random fixes"

This reverts commit 3fcb1bf09140e59a878911cd889d5047cf8a0ca6.
Shared/Logs: Add workaround for "w" flag used with dynamic name files

Ignore "w" flag and always use "a" for log files with dynamic name since the file handle is created at every log line and "w" would delete any other logged line from previous _write() calls.
The best solution would be to overwrite only at first call and append at any other call.
Shared/Logs: Make AppenderFile more thread-safe

In case of dynamic file names don't store the FILE* handle in a shared class variable but keep it only at function scope.

Valgrind log:
  at _IO_un_link (genops.c:69)
  by fclose@@GLIBC_2.2.5 (iofclose.c:55)
  by AppenderFile::CloseFile() (AppenderFile.cpp:94)
  by AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:66)
  by Appender::write(LogMessage&) (Appender.cpp:102)
  by Logger::write(LogMessage&) const (Logger.cpp:63)
  by Log::write(LogMessage*) (Log.cpp:279)
  by Log::vlog(std::string const&, LogLevel, char const*, __va_list_tag*) (Log.cpp:267)
  by Log::outMessage(std::string const&, LogLevel, char const*, ...) (Log.h:129)
Address 0x2a1bd2d0 is 0 bytes inside a block of size 568 free'd
  at free (vg_replace_malloc.c:468)
  by fclose@@GLIBC_2.2.5 (iofclose.c:85)
  by AppenderFile::CloseFile() (AppenderFile.cpp:94)
  by AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:66)
  by Appender::write(LogMessage&) (Appender.cpp:102)
  by Logger::write(LogMessage&) const (Logger.cpp:63)
  by Log::write(LogMessage*) (Log.cpp:279)
  by Log::vlog(std::string const&, LogLevel, char const*, __va_list_tag*) (Log.cpp:267)
  by Log::outMessage(std::string const&, LogLevel, char const*, ...) (Log.h:129)
Core/Warden: Fix crash
Shared/Logs: Code cleanup

Remove unneeded check added in 89af6097f37587e178ac412252326351ca655075
Merge pull request #11580 from Dehravor/warden

Core/Warden: Fix crash

Fix NULL dereference crash in case Warden is disabled (in configs or on Mac OS X platform) and client sends a CMSG_WARDEN_DATA opcode
Scripts/Eastern Plaguelands: Fix flypath exploit

Fix npc id 17209 in Eastern Plaguelands enabling taxi cheat to players just by talking to it.
Core/SAI: Fix crash

Disable script type SMART_SCRIPT_TYPE_TIMED_ACTIONLIST actions if they are trying to overwrite the timed action list while iterating it.
This was invalidating the iterator and deleting any smart action stored in it, including the current executed one.

Valgrind log:
 Invalid read of size 1
  at SmartScript::OnUpdate(unsigned int) (SmartScript.cpp:3258)
  by SmartAI::UpdateAI(unsigned int) (SmartAI.cpp:331)
  by Creature::Update(unsigned int) (Creature.cpp:544)
 Address 0x1807d9b2 is 10 bytes after a block of size 40 alloc'd
  at operator new(unsigned long) (vg_replace_malloc.c:319)
  ...
  by SmartAIMgr::LoadSmartAIFromDB() (SmartScriptMgr.cpp:231)
  by World::SetInitialWorldSettings() (World.cpp:1724)
  by Master::Run() (Master.cpp:169)
  by main (Main.cpp:142)
Core/SAI: Improve error log

Log both target and current Object when checking if a Creature/GameObject have SmartAI enabled.
DB/Items: Added "few" missing items.
Core/Group: Add sanity checks to CMSG_LOOT_METHOD's handler

If lootMethod or lootThreshold is invalid, portrait menus become unusable to the entire raid.
DB/Creature: Fix trigger visibility

They where visible to players and invisible to gms.
Core/Group: Fix exploit

The master looter should be in the group.
Core/Group: Any party member may mark targets (this does not apply to raid groups)

Also ensure that the targeted player is not hostile.
DB/Creature: Fix another trigger visibility

They where visible to players and invisible to gms.
Core/SAI: Fix assertion in SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST

Fix assertion triggered in SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST if max entry is less than min entry
DB/Creature: Fix more triggers visibility

If anyone can post a complete list of triggers visible to players but no to gms create a ticket with them, thx.
DB/Creature: Fix more triggers visibility

Closes #8178