fix filename with dirname's file copying
This commit is contained in:
1 parent
11ada5f7ad
commit
b45e6f4bb4
4 files changed
+1285
-271
No files matched your search
@@ -30,6 +30,15 @@ class Admin::PatchfilesController < OrbitAdminController
|
||||
end
|
||||
end
|
||||
end
|
||||
if params["filefield"]["refresh_btn"] == "true"
|
||||
@last_message = @file_to_show.last_message
|
||||
@active_file_arr = @file_to_show.file_show.values.map{|hash| hash.values.first}.map{|hash| hash.keys.zip(hash.values.map{|hash| hash[:status]}).to_h}.select{|hash| hash.values.include?(1)}.flat_map{|hash| hash.values.map.with_index{|status,i| (status != 1) ? nil : i}.select{|index| !index.nil?}.map{|index| hash.keys[index]}}
|
||||
@file_to_show.destroy
|
||||
@file_to_show = Filefield.new()
|
||||
@file_to_show.last_message = @last_message
|
||||
@active_file_arr.each{|active_file| @file_to_show.file_show.keys.each{|file_group| (@file_to_show.file_show[file_group][:files].keys.include?(active_file)) ? (@file_to_show.file_show[file_group][:files][active_file][:status] = 1) : nil }}
|
||||
@file_to_show.save
|
||||
end
|
||||
if params["filefield"]["recovery_btn"] == "true"
|
||||
@file_to_show.recovery = "true"
|
||||
else
|
||||
|
||||
@@ -34,7 +34,8 @@ class Filefield
|
||||
'preference@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/admin/', :dest=>@views_path+'admin/sites/'}
|
||||
},:status=>0} ,
|
||||
"member"=>{:files=>{'member_profile@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@model_path},
|
||||
'members_controller@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/admin/', :dest=>@controller_path+'admin/'},
|
||||
'admin/members_controller@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@controller_path},
|
||||
'members_controller@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@controller_path},
|
||||
'_user_basic_passwd@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/admin/', :dest=>@views_path+'admin/members/'}
|
||||
},:status=>0} ,
|
||||
"accessibility"=>{:files=>{'back_end@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>@views_path+'layouts/'},
|
||||
@@ -57,7 +58,7 @@ class Filefield
|
||||
|
||||
def backup_file(file_name,file_path)
|
||||
FileUtils.cd(file_path)
|
||||
if (file_name.include? "/") == false
|
||||
if file_name[-1] != "/"
|
||||
FileUtils.cp(file_name , file_name+'_back')
|
||||
else
|
||||
FileUtils.cd('..')
|
||||
@@ -68,7 +69,7 @@ class Filefield
|
||||
end
|
||||
def recover_file(file_name,file_path)
|
||||
FileUtils.cd(file_path)
|
||||
if (file_name.include? "/") == false
|
||||
if file_name[-1] != "/"
|
||||
FileUtils.cp(file_name+'_back', file_name)
|
||||
else
|
||||
FileUtils.cd('..')
|
||||
@@ -82,8 +83,10 @@ class Filefield
|
||||
end
|
||||
def copy_file(file_name,source_file_path,dest_file_path)
|
||||
FileUtils.cd(source_file_path)
|
||||
if (file_name.include? "/") == false
|
||||
FileUtils.cp(file_name , dest_file_path)
|
||||
if file_name[-1] != "/"
|
||||
@file_name = Pathname.new(file_name)
|
||||
FileUtils.cd(@file_name.dirname.to_s)
|
||||
FileUtils.cp(@file_name.basename.to_s , dest_file_path+@file_name.dirname.to_s)
|
||||
else
|
||||
if !Dir.exist?(dest_file_path)
|
||||
FileUtils.mkdir_p dest_file_path
|
||||
|
||||
Reference in new issue
Block a user