From 2386e352075414073dba65ae98644640cb7b084b Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 29 Jun 2024 13:03:18 +0200 Subject: [PATCH] CLISetup/locales * removed redundant declaration of locales to process --- setup/tools/CLISetup.class.php | 15 +++++-------- setup/tools/dbc.class.php | 2 +- setup/tools/filegen/enchants.ss.php | 4 ++-- setup/tools/filegen/gems.ss.php | 4 ++-- setup/tools/filegen/glyphs.ss.php | 4 ++-- setup/tools/filegen/img-maps.ss.php | 31 +++++++++++++++------------ setup/tools/filegen/itemsets.ss.php | 4 ++-- setup/tools/filegen/locales.ss.php | 2 +- setup/tools/filegen/pets.ss.php | 4 ++-- setup/tools/filegen/profiler.ss.php | 30 +++++++++++++------------- setup/tools/filegen/talentcalc.ss.php | 6 +++--- setup/tools/setupScript.class.php | 6 +++--- setup/tools/sqlgen/emotes.ss.php | 2 +- 13 files changed, 56 insertions(+), 58 deletions(-) diff --git a/setup/tools/CLISetup.class.php b/setup/tools/CLISetup.class.php index 88b2816f..4c4b5884 100644 --- a/setup/tools/CLISetup.class.php +++ b/setup/tools/CLISetup.class.php @@ -10,7 +10,6 @@ if (!CLI) class CLISetup { public static $locales = []; - public static $localeIds = []; public static $srcDir = 'setup/mpqdata/'; @@ -199,14 +198,10 @@ class CLISetup // restrict actual locales foreach (self::$locales as $idx => $_) - { - if (!($l = Cfg::get('LOCALES')) || ($l & (1 << $idx))) - self::$localeIds[] = $idx; - else + if (($l = Cfg::get('LOCALES')) && !($l & (1 << $idx))) unset(self::$locales[$idx]); - } - if (!self::$localeIds) + if (!self::$locales) CLI::write('No valid locale specified. Check your config or --locales parameter, if used', CLI::LOG_ERROR); // get site status @@ -562,7 +557,7 @@ class CLISetup foreach (self::$expectedPaths as $xp => $locId) { - if (!in_array($locId, self::$localeIds)) + if (!in_array($locId, array_keys(self::$locales))) continue; if (isset($result[$locId])) @@ -582,7 +577,7 @@ class CLISetup if (!$matchAll && !$result) $status = false; - if ($matchAll && array_diff(self::$localeIds, array_keys($result))) + if ($matchAll && array_diff_key(self::$locales, $result)) $status = false; return $result; @@ -606,7 +601,7 @@ class CLISetup self::$gsFiles[$lId] = file($gsFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); } - if ($missing = array_diff(self::$localeIds, array_keys(self::$gsFiles))) + if ($missing = array_diff_key(self::$locales, self::$gsFiles)) { ClI::write('GlobalStrings.lua not found for locale '. Lang::concat($missing), CLI::LOG_WARN); return false; diff --git a/setup/tools/dbc.class.php b/setup/tools/dbc.class.php index c2d74290..5a15e5b2 100644 --- a/setup/tools/dbc.class.php +++ b/setup/tools/dbc.class.php @@ -112,7 +112,7 @@ class DBC $foundMask = 0x0; foreach (CLISetup::$expectedPaths as $locStr => $locId) { - if (!in_array($locId, CLISetup::$localeIds)) + if (!in_array($locId, array_keys(CLISetup::$locales))) continue; if ($foundMask & (1 << $locId)) diff --git a/setup/tools/filegen/enchants.ss.php b/setup/tools/filegen/enchants.ss.php index 9645b4dd..4a383198 100644 --- a/setup/tools/filegen/enchants.ss.php +++ b/setup/tools/filegen/enchants.ss.php @@ -97,7 +97,7 @@ CLISetup::registerSetup("build", new class extends SetupScript return false; } - foreach (CLISetup::$localeIds as $lId) + foreach (CLISetup::$locales as $lId => $jsonStr) { User::useLocale($lId); Lang::load($lId); @@ -254,7 +254,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $ench[$k] = $v[0]; $toFile = "var g_enchants = ".Util::toJSON($enchantsOut).";"; - $file = 'datasets/'.User::$localeString.'/enchants'; + $file = 'datasets/'.$jsonStr.'/enchants'; if (!CLISetup::writeFile($file, $toFile)) $this->success = false; diff --git a/setup/tools/filegen/gems.ss.php b/setup/tools/filegen/gems.ss.php index b7f3c4da..fc36fa5b 100644 --- a/setup/tools/filegen/gems.ss.php +++ b/setup/tools/filegen/gems.ss.php @@ -59,7 +59,7 @@ CLISetup::registerSetup("build", new class extends SetupScript return false; } - foreach (CLISetup::$localeIds as $lId) + foreach (CLISetup::$locales as $lId => $jsonStr) { set_time_limit(5); @@ -88,7 +88,7 @@ CLISetup::registerSetup("build", new class extends SetupScript } $toFile = "var g_gems = ".Util::toJSON($gemsOut).";"; - $file = 'datasets/'.User::$localeString.'/gems'; + $file = 'datasets/'.$jsonStr.'/gems'; if (!CLISetup::writeFile($file, $toFile)) $this->success = false; diff --git a/setup/tools/filegen/glyphs.ss.php b/setup/tools/filegen/glyphs.ss.php index 560eab7d..b73c43c8 100644 --- a/setup/tools/filegen/glyphs.ss.php +++ b/setup/tools/filegen/glyphs.ss.php @@ -52,7 +52,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $glyphSpells = new SpellList(array(['s.id', array_keys($glyphList)], Cfg::get('SQL_LIMIT_NONE'))); - foreach (CLISetup::$localeIds as $lId) + foreach (CLISetup::$locales as $lId => $jsonStr) { set_time_limit(30); @@ -82,7 +82,7 @@ CLISetup::registerSetup("build", new class extends SetupScript } $toFile = "var g_glyphs = ".Util::toJSON($glyphsOut).";"; - $file = 'datasets/'.User::$localeString.'/glyphs'; + $file = 'datasets/'.$jsonStr.'/glyphs'; if (!CLISetup::writeFile($file, $toFile)) $this->success = false; diff --git a/setup/tools/filegen/img-maps.ss.php b/setup/tools/filegen/img-maps.ss.php index 66034f46..97713edb 100644 --- a/setup/tools/filegen/img-maps.ss.php +++ b/setup/tools/filegen/img-maps.ss.php @@ -84,8 +84,8 @@ CLISetup::registerSetup("build", new class extends SetupScript if (strpos($dir[0], '%s') === false) $this->requiredDirs[] = $dir[0]; else - foreach (CLISetup::$localeIds as $l) - $this->requiredDirs[] = sprintf($dir[0], strtolower(Util::$localeStrings[$l]).'/'); + foreach (CLISetup::$locales as $l => $locJsonStr) + $this->requiredDirs[] = sprintf($dir[0], $locJsonStr.'/'); } } } @@ -143,9 +143,9 @@ CLISetup::registerSetup("build", new class extends SetupScript { $sumFloors = array_sum(array_column($this->dmFloorData, 1)); $sumAreas = count($this->wmAreas); - $sumMaps = count(CLISetup::$localeIds) * ($sumAreas + $sumFloors); + $sumMaps = count(CLISetup::$locales) * ($sumAreas + $sumFloors); - CLI::write('Processing '.$sumAreas.' zone maps and '.$sumFloors.' dungeon maps from Interface/WorldMap/ for locale: '.Lang::concat(array_intersect_key(Util::$localeStrings, array_flip(CLISetup::$localeIds)))); + CLI::write('Processing '.$sumAreas.' zone maps and '.$sumFloors.' dungeon maps from Interface/WorldMap/ for locale: '.Lang::concat(array_intersect_key(Util::$localeStrings, CLISetup::$locales))); /* todo: retrain brain and generate maps by given files and GlobalStrings. Then assign dbc data to them not the other way round like it is now. foreach ($this->mapFiles as $name => [$floors, $isMultilevel]) @@ -236,8 +236,11 @@ CLISetup::registerSetup("build", new class extends SetupScript } */ - foreach (CLISetup::$localeIds as $progressLoc => $l) + $progressLoc = -1; + foreach (CLISetup::$locales as $l => $locJsonStr) { + $progressLoc++; + // source for mapFiles $mapSrcDir = ''; if ($this->modeMask & self::M_SPAWNS) @@ -280,7 +283,7 @@ CLISetup::registerSetup("build", new class extends SetupScript if (!CLISetup::fileExists($srcPath)) { $this->success = false; - CLI::write('worldmap file '.$srcPath.' missing for selected locale '.Util::$localeStrings[$l], CLI::LOG_ERROR); + CLI::write('worldmap file '.$srcPath.' missing for selected locale '.$locJsonStr, CLI::LOG_ERROR); continue; } @@ -330,7 +333,7 @@ CLISetup::registerSetup("build", new class extends SetupScript foreach (self::DEST_DIRS as $sizeIdx => [$path, $width, $height]) { - $outFile[$sizeIdx] = sprintf($path, strtolower(Util::$localeStrings[$l]).'/') . $zoneId; + $outFile[$sizeIdx] = sprintf($path, $locJsonStr.'/') . $zoneId; /* dataset 'zones' requires that ... * 3959 - Black Temple: starts with empty floor suffix @@ -503,11 +506,11 @@ CLISetup::registerSetup("build", new class extends SetupScript { $sumFloors = array_sum(array_column($this->dmFloorData, 1)); $sumAreas = count($this->wmAreas); - $sumMaps = count(CLISetup::$localeIds) * ($sumAreas + $sumFloors); + $sumMaps = count(CLISetup::$locales) * ($sumAreas + $sumFloors); - CLI::write('[img-maps] Processing '.$sumAreas.' zone maps and '.$sumFloors.' dungeon maps from Interface/WorldMap/ for locale: '.Lang::concat(array_intersect_key(Util::$localeStrings, array_flip(CLISetup::$localeIds)))); + CLI::write('[img-maps] Processing '.$sumAreas.' zone maps and '.$sumFloors.' dungeon maps from Interface/WorldMap/ for locale: '.Lang::concat(array_intersect_key(Util::$localeStrings, CLISetup::$locales))); - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $locJsonStr) { // source for mapFiles $mapSrcDir = ''; @@ -519,7 +522,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $mapSrcDir = $this->genSteps[self::M_MAPS][1][$l] ?? ''; if (!$mapSrcDir) { - CLI::write('[img-maps] - No suitable localized map files found for locale ['.$l.': '.Util::$localeStrings[$l].'].', CLI::LOG_ERROR); + CLI::write('[img-maps] - No suitable localized map files found for locale ['.$l.': '.$locJsonStr.'].', CLI::LOG_ERROR); $this->success = false; continue; } @@ -554,7 +557,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $dmFloors = array_combine($dmFloors, $dmFloors); CLI::write( - '['.Util::$localeStrings[$l].'] ' . + '['.$locJsonStr.'] ' . str_pad('['.$areaEntry['areaId'].']', 7) . str_pad($areaEntry['nameINT'], 22) . str_pad('Overlays: '.count($this->wmOverlays[$areaEntry['id']] ?? []), 14) . @@ -564,7 +567,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $srcPath = $mapSrcDir.'/'.$textureStr; if (!CLISetup::fileExists($srcPath)) { - CLI::write('[img-maps] - WorldMap file path '.$srcPath.' missing for selected locale '.Util::$localeStrings[$l], CLI::LOG_ERROR); + CLI::write('[img-maps] - WorldMap file path '.$srcPath.' missing for selected locale '.$locJsonStr, CLI::LOG_ERROR); $this->success = false; continue; } @@ -616,7 +619,7 @@ CLISetup::registerSetup("build", new class extends SetupScript foreach (self::DEST_DIRS as $sizeIdx => [$path, $width, $height]) { - $outPaths[$sizeIdx] = sprintf($path, strtolower(Util::$localeStrings[$l]).'/') . $outFile . '.jpg'; + $outPaths[$sizeIdx] = sprintf($path, strtolower($locJsonStr).'/') . $outFile . '.jpg'; if (!CLISetup::getOpt('force') && file_exists($outPaths[$sizeIdx])) { diff --git a/setup/tools/filegen/itemsets.ss.php b/setup/tools/filegen/itemsets.ss.php index 8b827757..ea8e75c6 100644 --- a/setup/tools/filegen/itemsets.ss.php +++ b/setup/tools/filegen/itemsets.ss.php @@ -44,7 +44,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $setList = DB::Aowow()->Select('SELECT * FROM ?_itemset ORDER BY refSetId DESC'); $jsonBonus = []; - foreach (CLISetup::$localeIds as $lId) + foreach (CLISetup::$locales as $lId => $jsonStr) { User::useLocale($lId); Lang::load($lId); @@ -120,7 +120,7 @@ CLISetup::registerSetup("build", new class extends SetupScript } $toFile = "var g_itemsets = ".Util::toJSON($itemsetOut).";"; - $file = 'datasets/'.User::$localeString.'/itemsets'; + $file = 'datasets/'.$jsonStr.'/itemsets'; if (!CLISetup::writeFile($file, $toFile)) $this->success = false; diff --git a/setup/tools/filegen/locales.ss.php b/setup/tools/filegen/locales.ss.php index 2c89c137..7bfdca5c 100644 --- a/setup/tools/filegen/locales.ss.php +++ b/setup/tools/filegen/locales.ss.php @@ -63,7 +63,7 @@ CLISetup::registerSetup("build", new class extends SetupScript ); $result = []; - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $_) if (isset($available[$l])) $result[] = $available[$l]; diff --git a/setup/tools/filegen/pets.ss.php b/setup/tools/filegen/pets.ss.php index 5f31aa0d..553d7b66 100644 --- a/setup/tools/filegen/pets.ss.php +++ b/setup/tools/filegen/pets.ss.php @@ -57,7 +57,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $locations = DB::Aowow()->selectCol('SELECT `typeId` AS ARRAY_KEY, `areaId` AS ARRAY_KEY2, `areaId` FROM ?_spawns WHERE `type` = ?d AND `typeId` IN (?a) GROUP BY `typeId`, `areaId`', Type::NPC, array_column($petList, 'id')); - foreach (CLISetup::$localeIds as $lId) + foreach (CLISetup::$locales as $lId => $jsonStr) { User::useLocale($lId); Lang::load($lId); @@ -82,7 +82,7 @@ CLISetup::registerSetup("build", new class extends SetupScript } $toFile = "var g_pets = ".Util::toJSON($petsOut).";"; - $file = 'datasets/'.User::$localeString.'/pets'; + $file = 'datasets/'.$jsonStr.'/pets'; if (!CLISetup::writeFile($file, $toFile)) $this->success = false; diff --git a/setup/tools/filegen/profiler.ss.php b/setup/tools/filegen/profiler.ss.php index 603a6dae..7079c0d3 100644 --- a/setup/tools/filegen/profiler.ss.php +++ b/setup/tools/filegen/profiler.ss.php @@ -90,7 +90,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $relCurr = new CurrencyList(array(['id', $_])); - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $jsonStr) { set_time_limit(20); @@ -108,7 +108,7 @@ CLISetup::registerSetup("build", new class extends SetupScript foreach ($questz->getListviewData() as $id => $data) $buff .= '_['.$id.'] = '.Util::toJSON($data).";\n"; - if (!CLISetup::writeFile('datasets/'.User::$localeString.'/p-quests-'.$cat2, $buff)) + if (!CLISetup::writeFile('datasets/'.$jsonStr.'/p-quests-'.$cat2, $buff)) $this->success = false; } } @@ -135,7 +135,7 @@ CLISetup::registerSetup("build", new class extends SetupScript if (empty($titlez->sources[$id][4]) && empty($titlez->sources[$id][12])) $this->addExclusion(Type::TITLE, $id, PR_EXCLUDE_GROUP_UNAVAILABLE); - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $jsonStr) { set_time_limit(5); @@ -152,7 +152,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $buff .= '_['.$id.'] = '.Util::toJSON($data).";\n"; } - if (!CLISetup::writeFile('datasets/'.User::$localeString.'/p-titles-'.$g, $buff)) + if (!CLISetup::writeFile('datasets/'.$jsonStr.'/p-titles-'.$g, $buff)) $this->success = false; } } @@ -179,7 +179,7 @@ CLISetup::registerSetup("build", new class extends SetupScript if (!$mountz->getSources()) $this->addExclusion(Type::SPELL, $id, PR_EXCLUDE_GROUP_UNAVAILABLE); - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $jsonStr) { set_time_limit(5); @@ -203,7 +203,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $buff .= '_['.$id.'] = '.Util::toJSON($data).";\n"; } - if (!CLISetup::writeFile('datasets/'.User::$localeString.'/p-mounts', $buff)) + if (!CLISetup::writeFile('datasets/'.$jsonStr.'/p-mounts', $buff)) $this->success = false; } } @@ -222,7 +222,7 @@ CLISetup::registerSetup("build", new class extends SetupScript if (!$companionz->getSources()) $this->addExclusion(Type::SPELL, $id, PR_EXCLUDE_GROUP_UNAVAILABLE); - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $jsonStr) { set_time_limit(5); @@ -241,7 +241,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $buff .= '_['.$id.'] = '.Util::toJSON($data).";\n"; } - if (!CLISetup::writeFile('datasets/'.User::$localeString.'/p-companions', $buff)) + if (!CLISetup::writeFile('datasets/'.$jsonStr.'/p-companions', $buff)) $this->success = false; } } @@ -254,7 +254,7 @@ CLISetup::registerSetup("build", new class extends SetupScript ); $factionz = new FactionList($condition); - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $jsonStr) { set_time_limit(5); @@ -267,7 +267,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $buff .= "\ng_faction_order = [0, 469, 891, 1037, 1118, 67, 1052, 892, 936, 1117, 169, 980, 1097];\n"; - if (!CLISetup::writeFile('datasets/'.User::$localeString.'/p-factions', $buff)) + if (!CLISetup::writeFile('datasets/'.$jsonStr.'/p-factions', $buff)) $this->success = false; } } @@ -307,7 +307,7 @@ CLISetup::registerSetup("build", new class extends SetupScript } } - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $jsonStr) { set_time_limit(10); @@ -324,7 +324,7 @@ CLISetup::registerSetup("build", new class extends SetupScript if (!$buff) { // this behaviour is intended, do not create an error - CLI::write('[profiler] - file datasets/'.User::$localeString.'/p-recipes-'.$file.' has no content => skipping', CLI::LOG_INFO); + CLI::write('[profiler] - file datasets/'.$jsonStr.'/p-recipes-'.$file.' has no content => skipping', CLI::LOG_INFO); continue; } @@ -333,7 +333,7 @@ CLISetup::registerSetup("build", new class extends SetupScript if (is_array($s)) $buff .= "\ng_skill_order = [171, 164, 333, 202, 182, 773, 755, 165, 186, 393, 197, 185, 129, 356];\n"; - if (!CLISetup::writeFile('datasets/'.User::$localeString.'/p-recipes-'.$file, $buff)) + if (!CLISetup::writeFile('datasets/'.$jsonStr.'/p-recipes-'.$file, $buff)) $this->success = false; } } @@ -348,7 +348,7 @@ CLISetup::registerSetup("build", new class extends SetupScript ); $achievez = new AchievementList($condition); - foreach (CLISetup::$localeIds as $l) + foreach (CLISetup::$locales as $l => $jsonStr) { set_time_limit(5); @@ -368,7 +368,7 @@ CLISetup::registerSetup("build", new class extends SetupScript // sum points $buff .= "\ng_achievement_points = [".$sumPoints."];\n"; - if (!CLISetup::writeFile('datasets/'.User::$localeString.'/achievements', $buff)) + if (!CLISetup::writeFile('datasets/'.$jsonStr.'/achievements', $buff)) $this->success = false; } } diff --git a/setup/tools/filegen/talentcalc.ss.php b/setup/tools/filegen/talentcalc.ss.php index 59712660..db0ae0c1 100644 --- a/setup/tools/filegen/talentcalc.ss.php +++ b/setup/tools/filegen/talentcalc.ss.php @@ -54,7 +54,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $tSpellIds = DB::Aowow()->selectCol('SELECT rank1 FROM dbc_talent UNION SELECT rank2 FROM dbc_talent UNION SELECT rank3 FROM dbc_talent UNION SELECT rank4 FROM dbc_talent UNION SELECT rank5 FROM dbc_talent'); $this->tSpells = new SpellList(array(['s.id', $tSpellIds], Cfg::get('SQL_LIMIT_NONE'))); - foreach (CLISetup::$localeIds as $lId) + foreach (CLISetup::$locales as $lId => $jsonStr) { User::useLocale($lId); Lang::load($lId); @@ -67,7 +67,7 @@ CLISetup::registerSetup("build", new class extends SetupScript set_time_limit(20); - $file = 'datasets/'.User::$localeString.'/talents-'.$i; + $file = 'datasets/'.$jsonStr.'/talents-'.$i; $toFile = '$WowheadTalentCalculator.registerClass('.$i.', '.Util::toJSON($this->buildTree(1 << ($i - 1))).')'; if (!CLISetup::writeFile($file, $toFile)) @@ -77,7 +77,7 @@ CLISetup::registerSetup("build", new class extends SetupScript // PetCalc $toFile = "var g_pet_icons = ".$petIcons.";\n\n"; $toFile .= 'var g_pet_talents = '.Util::toJSON($this->buildTree(0)).';'; - $file = 'datasets/'.User::$localeString.'/pet-talents'; + $file = 'datasets/'.$jsonStr.'/pet-talents'; if (!CLISetup::writeFile($file, $toFile)) $this->success = false; diff --git a/setup/tools/setupScript.class.php b/setup/tools/setupScript.class.php index a608685f..98d61f2f 100644 --- a/setup/tools/setupScript.class.php +++ b/setup/tools/setupScript.class.php @@ -179,7 +179,7 @@ trait TrImageProcessor $locList = []; foreach (CLISetup::$expectedPaths as $xp => $locId) - if (in_array($locId, CLISetup::$localeIds)) + if (in_array($locId, array_keys(CLISetup::$locales))) $locList[] = $xp; CLI::write('[img-proc] required resources overview:', CLI::LOG_INFO); @@ -202,11 +202,11 @@ trait TrImageProcessor { $foundLoc = []; foreach (CLISetup::$expectedPaths as $xp => $lId) - if (in_array($lId, CLISetup::$localeIds)) + if (in_array($lId, array_keys(CLISetup::$locales))) if (isset($realPaths[$lId]) && ($n = stripos($realPaths[$lId], '/'.$xp.'/'))) $foundLoc[$lId] = substr($realPaths[$lId], $n + 1, 4); - if ($diff = array_diff(CLISetup::$localeIds, array_keys($foundLoc))) + if ($diff = array_diff_key(CLISetup::$locales, $foundLoc)) { $buff = []; foreach ($diff as $d) diff --git a/setup/tools/sqlgen/emotes.ss.php b/setup/tools/sqlgen/emotes.ss.php index eca512d6..632f8a09 100644 --- a/setup/tools/sqlgen/emotes.ss.php +++ b/setup/tools/sqlgen/emotes.ss.php @@ -24,7 +24,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript $allOK = true; $locPath = CLISetup::filesInPathLocalized($globStrPath, $allOK); - if ($x = array_diff(CLISetup::$localeIds, array_keys($locPath))) + if ($x = array_diff_key(CLISetup::$locales, $locPath)) { $locs = array_intersect_key(CLISetup::$locales, array_flip($x)); CLI::write('[emotes] '.sprintf($globStrPath, CLI::bold('['.implode('/,', $locs).'/]')) . ' not found!', CLI::LOG_WARN);