db.rb 502 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
  2. class Store::Provider::DB < ApplicationModel
  3. self.table_name = 'store_provider_dbs'
  4. def self.add(data, sha)
  5. Store::Provider::DB.create(
  6. :data => data,
  7. :sha => sha,
  8. )
  9. true
  10. end
  11. def self.get(sha)
  12. file = Store::Provider::DB.where( :sha => sha ).first
  13. return if !file
  14. file.data
  15. end
  16. def self.delete(sha)
  17. Store::Provider::DB.where( :sha => sha ).destroy_all
  18. true
  19. end
  20. end