0 ORDER BY it.entry DESC ; "; $gems = Db::Aowow()->Select($gemQuery); $locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU]; $jsonGems = []; // check directory-structure foreach (Util::$localeStrings as $dir) if (!is_dir('datasets\\'.$dir)) mkdir('datasets\\'.$dir, 0755, true); echo "script set up in ".Util::execTime()."
\n"; foreach ($locales as $lId) { User::useLocale($lId); $gemsOut = []; foreach ($gems as $pop) { // costy and locale-independant -> cache if (!isset($jsonGems[$pop['itemId']])) $jsonGems[$pop['itemId']] = Util::parseItemEnchantment($pop); $gemsOut[$pop['itemId']] = array( 'name' => Util::localizedString($pop, 'name'), 'quality' => $pop['quality'], 'icon' => strToLower($pop['icon']), 'enchantment' => Util::localizedString($pop, 'text'), 'jsonequip' => $jsonGems[$pop['itemId']], 'colors' => $pop['colors'], 'expansion' => $pop['expansion'] ); } $toFile = "var g_gems = "; $toFile .= json_encode($gemsOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); $toFile .= ";"; $file = 'datasets\\'.User::$localeString.'\\gems'; $handle = fOpen($file, "w"); fWrite($handle, $toFile); fClose($handle); echo "done gems loc: ".$lId." in ".Util::execTime()."
\n"; } echo "
\nall done"; User::useLocale(LOCALE_EN); $stats = DB::Aowow()->getStatistics(); echo "
\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000); ?>