2014-05-03 12:34:36 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2015-04-27 21:44:41 +00:00
|
|
|
class Store
|
|
|
|
class Provider
|
|
|
|
class DB < ApplicationModel
|
|
|
|
self.table_name = 'store_provider_dbs'
|
2014-05-03 12:34:36 +00:00
|
|
|
|
2015-04-27 21:44:41 +00:00
|
|
|
def self.add(data, sha)
|
|
|
|
Store::Provider::DB.create(
|
|
|
|
data: data,
|
|
|
|
sha: sha,
|
|
|
|
)
|
|
|
|
true
|
|
|
|
end
|
2014-05-03 12:34:36 +00:00
|
|
|
|
2015-04-27 21:44:41 +00:00
|
|
|
def self.get(sha)
|
|
|
|
file = Store::Provider::DB.where( sha: sha ).first
|
|
|
|
return if !file
|
|
|
|
file.data
|
|
|
|
end
|
2014-05-03 12:34:36 +00:00
|
|
|
|
2015-04-27 21:44:41 +00:00
|
|
|
def self.delete(sha)
|
|
|
|
Store::Provider::DB.where( sha: sha ).destroy_all
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
2014-05-03 12:34:36 +00:00
|
|
|
end
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|