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
Léo-Paul Géneau
gitlab-ce
Commits
97ce0607
Commit
97ce0607
authored
Jul 16, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code based on feedback
parent
07ec2c7b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
lib/gitlab/import_export/uploads_manager.rb
lib/gitlab/import_export/uploads_manager.rb
+4
-4
lib/gitlab/import_export/uploads_restorer.rb
lib/gitlab/import_export/uploads_restorer.rb
+1
-1
No files found.
lib/gitlab/import_export/uploads_manager.rb
View file @
97ce0607
...
@@ -51,7 +51,7 @@ module Gitlab
...
@@ -51,7 +51,7 @@ module Gitlab
def
copy_from_object_storage
def
copy_from_object_storage
return
unless
Gitlab
::
ImportExport
.
object_storage?
return
unless
Gitlab
::
ImportExport
.
object_storage?
uploaders
do
|
uploader
|
each_uploader
do
|
uploader
|
next
unless
uploader
.
file
next
unless
uploader
.
file
next
if
uploader
.
upload
.
local?
# Already copied, using the old method
next
if
uploader
.
upload
.
local?
# Already copied, using the old method
...
@@ -67,19 +67,19 @@ module Gitlab
...
@@ -67,19 +67,19 @@ module Gitlab
@uploads_export_path
||=
File
.
join
(
@shared
.
export_path
,
@relative_export_path
)
@uploads_export_path
||=
File
.
join
(
@shared
.
export_path
,
@relative_export_path
)
end
end
def
uploaders
def
each_uploader
avatar_path
=
@project
.
avatar
&
.
upload
&
.
path
avatar_path
=
@project
.
avatar
&
.
upload
&
.
path
if
@relative_export_path
==
'avatar'
if
@relative_export_path
==
'avatar'
yield
(
@project
.
avatar
)
yield
(
@project
.
avatar
)
else
else
project_uploads_
or
_avatar
(
avatar_path
).
find_each
(
batch_size:
UPLOADS_BATCH_SIZE
)
do
|
upload
|
project_uploads_
except
_avatar
(
avatar_path
).
find_each
(
batch_size:
UPLOADS_BATCH_SIZE
)
do
|
upload
|
yield
(
upload
.
build_uploader
)
yield
(
upload
.
build_uploader
)
end
end
end
end
end
end
def
project_uploads_
or
_avatar
(
avatar_path
)
def
project_uploads_
except
_avatar
(
avatar_path
)
return
@project
.
uploads
unless
avatar_path
return
@project
.
uploads
unless
avatar_path
@project
.
uploads
.
where
(
"path != ?"
,
avatar_path
)
@project
.
uploads
.
where
(
"path != ?"
,
avatar_path
)
...
...
lib/gitlab/import_export/uploads_restorer.rb
View file @
97ce0607
...
@@ -12,7 +12,7 @@ module Gitlab
...
@@ -12,7 +12,7 @@ module Gitlab
true
true
else
else
true
true
# Proceed without uploads
end
end
rescue
=>
e
rescue
=>
e
@shared
.
error
(
e
)
@shared
.
error
(
e
)
...
...
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