From 99ca2591c7e61a8dcff4a0052d34e43eeb2e4659 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Tue, 8 Aug 2017 13:31:53 -0700 Subject: [PATCH] fix for cache purge of index.. use purge for delete_cache --- models/site.rb | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/models/site.rb b/models/site.rb index 531c81a3..0131ed0f 100644 --- a/models/site.rb +++ b/models/site.rb @@ -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