+ $sCmd = $sIndexCmd
+ .' -d '.$aDSNInfo['database']
+ .' -P '.$aDSNInfo['port']
+ .' -t '.$aResult['index-instances']
+ .' -r '.$aResult['index-rank'];
+ if (isset($aDSNInfo['hostspec']) && $aDSNInfo['hostspec']) {
+ $sCmd .= ' -H ' . $aDSNInfo['hostspec'];
+ }
+ if (isset($aDSNInfo['username']) && $aDSNInfo['username']) {
+ $sCmd .= ' -U ' . $aDSNInfo['username'];
+ }
+
+ runWithEnv($sCmd, $aProcEnv);
+
+ $oDB->exec('update import_status set indexed = true');
+}
+
+if ($aResult['update-address-levels']) {
+ echo 'Updating address levels from '.CONST_Address_Level_Config.".\n";
+ $oAlParser = new \Nominatim\Setup\AddressLevelParser(CONST_Address_Level_Config);
+ $oAlParser->createTable($oDB, 'address_levels');
+}
+
+if ($aResult['recompute-importance']) {
+ echo "Updating importance values for database.\n";
+ $oDB = new Nominatim\DB();
+ $oDB->connect();
+
+ $sSQL = 'ALTER TABLE placex DISABLE TRIGGER ALL;';
+ $sSQL .= 'UPDATE placex SET (wikipedia, importance) =';
+ $sSQL .= ' (SELECT wikipedia, importance';
+ $sSQL .= ' FROM compute_importance(extratags, country_code, osm_type, osm_id));';
+ $sSQL .= 'UPDATE placex s SET wikipedia = d.wikipedia, importance = d.importance';
+ $sSQL .= ' FROM placex d';
+ $sSQL .= ' WHERE s.place_id = d.linked_place_id and d.wikipedia is not null';
+ $sSQL .= ' and (s.wikipedia is null or s.importance < d.importance);';
+ $sSQL .= 'ALTER TABLE placex ENABLE TRIGGER ALL;';
+ $oDB->exec($sSQL);