mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
fix for cache purge of index.. use purge for delete_cache
This commit is contained in:
parent
b3a5b2d860
commit
99ca2591c7
1 changed files with 2 additions and 13 deletions
|
@ -653,6 +653,7 @@ class Site < Sequel::Model
|
||||||
PurgeCacheWorker.perform_async username, relative_path
|
PurgeCacheWorker.perform_async username, relative_path
|
||||||
|
|
||||||
purge_file_path = Pathname(relative_path).dirname.to_s
|
purge_file_path = Pathname(relative_path).dirname.to_s
|
||||||
|
purge_file_path = '' if purge_file_path == '.'
|
||||||
purge_file_path += '/' if purge_file_path != '/'
|
purge_file_path += '/' if purge_file_path != '/'
|
||||||
|
|
||||||
PurgeCacheWorker.perform_async username, '/?surf=1' if purge_file_path == '/'
|
PurgeCacheWorker.perform_async username, '/?surf=1' if purge_file_path == '/'
|
||||||
|
@ -662,20 +663,8 @@ class Site < Sequel::Model
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO DRY this up
|
|
||||||
|
|
||||||
def delete_cache(path)
|
def delete_cache(path)
|
||||||
relative_path = path.gsub base_files_path, ''
|
purge_cache 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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Rye::Cmd.add_command :ipfs, nil, 'add', :r
|
Rye::Cmd.add_command :ipfs, nil, 'add', :r
|
||||||
|
|
Loading…
Add table
Reference in a new issue