mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
storage engines refactor
This commit is contained in:
@@ -3,33 +3,50 @@ module FileStore
|
||||
class BaseStore
|
||||
|
||||
def store_upload(file, upload, content_type = nil)
|
||||
path = get_path_for_upload(upload)
|
||||
store_file(file, path)
|
||||
end
|
||||
|
||||
def store_optimized_image(file, optimized_image)
|
||||
path = get_path_for_optimized_image(optimized_image)
|
||||
store_file(file, path)
|
||||
end
|
||||
|
||||
def store_file(file, path, opts = {})
|
||||
end
|
||||
|
||||
def remove_upload(upload)
|
||||
remove_file(upload.url)
|
||||
end
|
||||
|
||||
def remove_optimized_image(optimized_image)
|
||||
remove_file(optimized_image.url)
|
||||
end
|
||||
|
||||
def remove_file(url)
|
||||
end
|
||||
|
||||
def has_been_uploaded?(url)
|
||||
end
|
||||
|
||||
def download_url(upload)
|
||||
end
|
||||
|
||||
def cdn_url(url)
|
||||
url
|
||||
end
|
||||
|
||||
def absolute_base_url
|
||||
end
|
||||
|
||||
def relative_base_url
|
||||
end
|
||||
|
||||
def download_url(upload)
|
||||
end
|
||||
|
||||
def external?
|
||||
end
|
||||
|
||||
def internal?
|
||||
!external?
|
||||
end
|
||||
|
||||
def path_for(upload)
|
||||
@@ -38,16 +55,9 @@ module FileStore
|
||||
def download(upload)
|
||||
end
|
||||
|
||||
def avatar_template(avatar)
|
||||
end
|
||||
|
||||
def purge_tombstone(grace_period)
|
||||
end
|
||||
|
||||
def cdn_url(url)
|
||||
url
|
||||
end
|
||||
|
||||
def get_path_for(type, id, sha, extension)
|
||||
depth = [0, Math.log(id / 1_000.0, 16).ceil].max
|
||||
tree = File.join(*sha[0, depth].split(""), "")
|
||||
|
Reference in New Issue
Block a user