+$oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'));
+if (isset($aCMDResult['quiet']) && $aCMDResult['quiet']) {
+ $oNominatimCmd->addParams('--quiet');
+}
+if ($aCMDResult['verbose']) {
+ $oNominatimCmd->addParams('--verbose');
+}
+
+// by default, use all but one processor, but never more than 15.
+var_dump($aCMDResult);
+$iInstances = max(1, $aCMDResult['threads'] ?? (min(16, getProcessorCount()) - 1));
+
+function run($oCmd) {
+ global $iInstances;
+ $oCmd->addParams('--threads', $iInstances);
+ $oCmd->run(true);
+}
+
+