Added work with snapshots. Part 2
This commit is contained in:
@@ -526,4 +526,14 @@ class ProjectsActions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def restore_snapshot(id, snap)
|
||||
repo_path = get_project_repo(id)
|
||||
snap_path = get_project_snap(id, snap)
|
||||
|
||||
if Dir.exist?(repo_path) && Dir.exist?(snap_path)
|
||||
Dir.glob(File.join(repo_path, '*')).each { |file| File.unlink(file) if File.file?(file) || FileUtils.rm_rf(file) }
|
||||
FileUtils.cp_r(Dir.glob(File.join(snap_path, '*')), repo_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user