private static function updateSets(callback $callback = null) { // Update the callback if one is present if ($callback) { $callback->call('Updating sets...'); } // Pull the country list $db = new DatabaseConnection(); $rs = $db->getRows("SELECT isocode,capital FROM geonames_countryinfo"); foreach ($rs as $cc) { $f = $db->getSingleRow("SELECT * FROM geonames_datasets WHERE setkey=%s", $cc['isocode']); if (!$f) { $db->insertRow("INSERT INTO geonames_datasets (setkey,setname,url,active) VALUES (%s,%s,%s,0)", $cc['isocode'], $cc['capital'], self::getUrl($cc['isocode'] . '.zip')); } } if ($callback) { $callback->call('All sets updated'); } }