refactor: using indexed temporary table as array works speed wonders :)

This commit is contained in:
Martin Ambrus
2017-10-27 21:04:16 +02:00
parent 0d84b5f3b4
commit 5a967055f4
3 changed files with 53 additions and 168 deletions
+3 -3
View File
@@ -908,13 +908,13 @@ class MYSQLi_DB implements IDbConnection {
global $autoprefix;
if (is_array($wid)) {
$wid = '"'.implode(',', $wid).'"';
$wid = '(' . implode('),(', $wid) . ')';
} else {
$wid = (int) $wid;
$wid = '(' . (int) $wid . ')';
}
// load the oasis regeneration (in-game) and units generation (during install) SQL file
// and replace village ID for the given $wid
// and replace village IDs for the given $wid
$str = file_get_contents($autoprefix."var/db/datagen-oasis-troops-regen.sql");
$str = preg_replace(["'%PREFIX%'", "'%VILLAGEID%'", "'%NATURE_REG_TIME%'"], [TB_PREFIX, $wid, ($automation ? NATURE_REGTIME : -1)], $str);
$result = $this->dblink->multi_query($str);