- @config = YAML.load(File.read(config))
- @state = YAML.load(File.read(@config["state_file"]))
+ @config = YAML.safe_load(File.read(config))
+ @state = YAML.safe_load(File.read(@config["state_file"]), [Time])
@conn = PGconn.connect(@config["db"])
# get current time from the database rather than the current system
@now = @conn.exec("select now() as now").map { |row| Time.parse(row["now"]) }[0]
@conn = PGconn.connect(@config["db"])
# get current time from the database rather than the current system
@now = @conn.exec("select now() as now").map { |row| Time.parse(row["now"]) }[0]
new_ids = @conn
.exec("select distinct changeset_id from changeset_comments where created_at >= '#{last_run}' and created_at < '#{@now}' and visible")
.map { |row| row["changeset_id"].to_i }
new_ids = @conn
.exec("select distinct changeset_id from changeset_comments where created_at >= '#{last_run}' and created_at < '#{@now}' and visible")
.map { |row| row["changeset_id"].to_i }
{ "version" => "0.6",
"generator" => "replicate_changesets.rb",
"copyright" => "OpenStreetMap and contributors",
{ "version" => "0.6",
"generator" => "replicate_changesets.rb",
"copyright" => "OpenStreetMap and contributors",
"license" => "http://opendatacommons.org/licenses/odbl/1-0/" }
.each { |k, v| doc.root[k] = v }
"license" => "http://opendatacommons.org/licenses/odbl/1-0/" }
.each { |k, v| doc.root[k] = v }