mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
Use site_files instead of file_list when all file list is needed
This commit is contained in:
parent
b2bdcfd1f5
commit
8174db65e1
4 changed files with 9 additions and 10 deletions
|
@ -79,10 +79,6 @@ get '/permanent-web' do
|
||||||
erb :'permanent_web'
|
erb :'permanent_web'
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/hotlinking/?' do
|
|
||||||
erb :'hotlinking'
|
|
||||||
end
|
|
||||||
|
|
||||||
get '/thankyou' do
|
get '/thankyou' do
|
||||||
erb :'thankyou'
|
erb :'thankyou'
|
||||||
end
|
end
|
||||||
|
|
|
@ -185,7 +185,7 @@ post '/settings/:username/change_name' do
|
||||||
end
|
end
|
||||||
|
|
||||||
old_host = @site.host
|
old_host = @site.host
|
||||||
old_file_paths = @site.file_list.collect {|f| f[:path]}
|
old_site_file_paths = @site.site_files.collect {|site_file| site_file.path}
|
||||||
|
|
||||||
@site.username = params[:name]
|
@site.username = params[:name]
|
||||||
|
|
||||||
|
@ -195,11 +195,11 @@ post '/settings/:username/change_name' do
|
||||||
@site.move_files_from old_username
|
@site.move_files_from old_username
|
||||||
}
|
}
|
||||||
|
|
||||||
old_file_paths.each do |file_path|
|
old_site_file_paths.each do |site_file_path|
|
||||||
@site.delete_cache file_path
|
@site.delete_cache site_file_path
|
||||||
end
|
end
|
||||||
|
|
||||||
flash[:success] = "Site/user name has been changed. You will need to use this name to login, <b>don't forget it</b>."
|
flash[:success] = "Site/user name has been changed. You will need to use this name to login, <b>don't forget it!</b>"
|
||||||
redirect "/settings/#{@site.username}#username"
|
redirect "/settings/#{@site.username}#username"
|
||||||
else
|
else
|
||||||
flash[:error] = @site.errors.first.last.first
|
flash[:error] = @site.errors.first.last.first
|
||||||
|
|
|
@ -207,6 +207,9 @@ get '/site_files/allowed_types' do
|
||||||
erb :'site_files/allowed_types'
|
erb :'site_files/allowed_types'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get '/site_files/hotlinking' do
|
||||||
|
erb :'site_files/hotlinking'
|
||||||
|
end
|
||||||
|
|
||||||
get '/site_files/mount_info' do
|
get '/site_files/mount_info' do
|
||||||
erb :'site_files/mount_info'
|
erb :'site_files/mount_info'
|
||||||
|
|
|
@ -459,8 +459,8 @@ class Site < Sequel::Model
|
||||||
FileUtils.mv files_path, File.join(BANNED_SITES_ROOT, username)
|
FileUtils.mv files_path, File.join(BANNED_SITES_ROOT, username)
|
||||||
}
|
}
|
||||||
|
|
||||||
file_list.each do |path|
|
site_files.each do |site_file|
|
||||||
delete_cache path
|
delete_cache site_file.path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue