Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
30f4dcd4
Commit
30f4dcd4
authored
May 19, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uploads export
parent
a5f04ad4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
app/services/projects/import_export/export_service.rb
app/services/projects/import_export/export_service.rb
+5
-1
lib/gitlab/import_export/uploads_saver.rb
lib/gitlab/import_export/uploads_saver.rb
+35
-0
No files found.
app/services/projects/import_export/export_service.rb
View file @
30f4dcd4
...
...
@@ -4,7 +4,7 @@ module Projects
def
execute
(
options
=
{})
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
File
.
join
(
project
.
path_with_namespace
,
'work'
))
save_all
if
[
save_version
,
save_project_tree
,
bundle_repo
,
bundle_wiki_repo
].
all?
save_all
if
[
save_version
,
save_project_tree
,
save_uploads
,
bundle_repo
,
bundle_wiki_repo
].
all?
cleanup_and_notify_worker
if
@shared
.
errors
.
any?
end
...
...
@@ -18,6 +18,10 @@ module Projects
Gitlab
::
ImportExport
::
ProjectTreeSaver
.
new
(
project:
project
,
shared:
@shared
).
save
end
def
save_uploads
Gitlab
::
ImportExport
::
UploadsSaver
.
save
(
project:
project
,
shared:
@shared
)
end
def
bundle_repo
Gitlab
::
ImportExport
::
RepoBundler
.
new
(
project:
project
,
shared:
@shared
).
bundle
end
...
...
lib/gitlab/import_export/uploads_saver.rb
0 → 100644
View file @
30f4dcd4
module
Gitlab
module
ImportExport
class
UploadsSaver
def
self
.
save
(
*
args
)
new
(
*
args
).
save
end
def
initialize
(
project
:,
shared
:)
@project
=
project
@shared
=
shared
end
def
save
return
true
unless
File
.
directory?
(
uploads_path
)
FileUtils
.
copy_entry
(
uploads_path
,
uploads_export_path
)
true
rescue
=>
e
@shared
.
error
(
e
.
message
)
false
end
private
def
uploads_export_path
File
.
join
(
@shared
.
export_path
,
'uploads'
)
end
def
uploads_path
File
.
join
(
Rails
.
root
.
join
(
'public/uploads'
),
project
.
path_with_namespace
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment