fix for cache purge of index.. use purge for delete_cache

This commit is contained in:
Kyle Drake 2017-08-08 13:31:53 -07:00
parent b3a5b2d860
commit 99ca2591c7

View file

@ -653,6 +653,7 @@ class Site < Sequel::Model
PurgeCacheWorker.perform_async username, relative_path
purge_file_path = Pathname(relative_path).dirname.to_s
purge_file_path = '' if purge_file_path == '.'
purge_file_path += '/' if purge_file_path != '/'
PurgeCacheWorker.perform_async username, '/?surf=1' if purge_file_path == '/'
@ -662,20 +663,8 @@ class Site < Sequel::Model
end
end
# TODO DRY this up
def delete_cache(path)
relative_path = path.gsub base_files_path, ''
PurgeCacheWorker.perform_async username, relative_path
# We gotta flush the dirname too if it's an index file.
if relative_path != '' && relative_path.match(/\/$|index\.html?$/i)
purge_file_path = Pathname(relative_path).dirname.to_s
PurgeCacheWorker.perform_async username, '/?surf=1' if purge_file_path == '/'
PurgeCacheWorker.perform_async username, purge_file_path
end
purge_cache path
end
Rye::Cmd.add_command :ipfs, nil, 'add', :r