public function recreateUnitDestroyIndex(array $params) { global $DB; $mapID = (int) $params['mapID']; require_once "variants/install.php"; InstallTerritory::loadExistingTerritories($mapID); // Generate the SQL before wiping & reinserting it $unitDestroyIndexRecreateSQL = InstallTerritory::unitDestroyIndexSQL($mapID); $DB->sql_put("BEGIN"); list($entriesBefore) = $DB->sql_row("SELECT COUNT(*) FROM wD_UnitDestroyIndex WHERE mapID = " . $mapID); $DB->sql_put("DELETE FROM wD_UnitDestroyIndex WHERE mapID = " . $mapID); $DB->sql_put($unitDestroyIndexRecreateSQL); list($entriesAfter) = $DB->sql_row("SELECT COUNT(*) FROM wD_UnitDestroyIndex WHERE mapID = " . $mapID); $DB->sql_put("COMMIT"); return l_t('The unit destroy indexes were recreated for map ID #%s ; there were %s entries before and there are currently %s entries.', $mapID, $entriesBefore, $entriesAfter); }