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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7c9f2168
Commit
7c9f2168
authored
Jul 11, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add restore method
parent
a27d4d9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
lib/gitlab/import_export/avatar_saver.rb
lib/gitlab/import_export/avatar_saver.rb
+1
-1
lib/gitlab/import_export/uploads_manager.rb
lib/gitlab/import_export/uploads_manager.rb
+17
-2
No files found.
lib/gitlab/import_export/avatar_saver.rb
View file @
7c9f2168
...
...
@@ -16,7 +16,7 @@ module Gitlab
shared:
@shared
,
relative_export_path:
'avatar'
,
from:
avatar_path
).
copy
).
save
rescue
=>
e
@shared
.
error
(
e
)
false
...
...
lib/gitlab/import_export/uploads_manager.rb
View file @
7c9f2168
...
...
@@ -10,8 +10,8 @@ module Gitlab
@from
=
from
||
default_uploads_path
end
def
copy
copy_files
(
@from
,
uploads_export
_path
)
if
File
.
directory?
(
@from
)
def
save
copy_files
(
@from
,
default_uploads
_path
)
if
File
.
directory?
(
@from
)
if
File
.
file?
(
@from
)
&&
@relative_export_path
==
'avatar'
copy_files
(
@from
,
File
.
join
(
uploads_export_path
,
@project
.
avatar
.
filename
))
...
...
@@ -25,6 +25,21 @@ module Gitlab
false
end
def
restore
Dir
[
"
#{
uploads_export_path
}
/**/*"
].
each
do
|
upload
|
next
if
File
.
directory?
(
upload
)
upload_path
=
File
.
join
(
uploads_export_path
,
upload
)
UploadService
.
new
(
@project
,
File
.
open
(
upload_path
,
'r'
),
FileUploader
).
execute
end
true
rescue
=>
e
@shared
.
error
(
e
)
false
end
private
def
copy_from_object_storage
...
...
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