diff options
author | Jochen Topf <jochen@topf.org> | 2013-01-11 12:02:51 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-01-11 12:02:51 +0100 |
commit | 71e1327b05eae06a39128b1bd288c4685861ab10 (patch) | |
tree | 34a6ef9e46f03bd09527a1827d85fadad0abccec /web/taginfo.rb | |
parent | 3df767aa62268e209a4c0749f82aa594919a0af5 (diff) | |
download | taginfo-71e1327b05eae06a39128b1bd288c4685861ab10.tar taginfo-71e1327b05eae06a39128b1bd288c4685861ab10.tar.gz |
Changed database initialization code.
All sources are now automatically attached.
Diffstat (limited to 'web/taginfo.rb')
-rwxr-xr-x | web/taginfo.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/web/taginfo.rb b/web/taginfo.rb index 386bc51..ab6a96e 100755 --- a/web/taginfo.rb +++ b/web/taginfo.rb @@ -56,15 +56,7 @@ TaginfoConfig.read BCP47::read_registry -db = SQL::Database.new('../../data') - -db.select('SELECT * FROM sources ORDER BY no').execute().each do |source| - Source.new source['id'], source['name'], source['data_until'], source['update_start'], source['update_end'], source['visible'].to_i == 1 -end - -DATA_UNTIL = db.select("SELECT min(data_until) FROM sources").get_first_value().sub(/:..$/, '') - -db.close +DATA_UNTIL = SQL::Database.init('../../data'); class Taginfo < Sinatra::Base @@ -124,7 +116,7 @@ class Taginfo < Sinatra::Base # (otherwise switching languages doesn't work) expires 0, :no_cache - @db = SQL::Database.new('../../data') + @db = SQL::Database.new.attach_sources @data_until = DATA_UNTIL end |