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
dae0d809
Commit
dae0d809
authored
Jul 13, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor uploads manager
parent
c2d297d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lib/gitlab/import_export/uploads_manager.rb
lib/gitlab/import_export/uploads_manager.rb
+7
-7
No files found.
lib/gitlab/import_export/uploads_manager.rb
View file @
dae0d809
...
...
@@ -56,11 +56,11 @@ module Gitlab
def
copy_from_object_storage
return
unless
Gitlab
::
ImportExport
.
object_storage?
upload
s
do
|
upload_model
|
next
unless
upload
_model
.
file
next
if
upload
_model
.
upload
.
local?
# Already copied, using the old method
upload
ers
do
|
uploader
|
next
unless
upload
er
.
file
next
if
upload
er
.
upload
.
local?
# Already copied, using the old method
download_and_copy
(
upload
_model
)
download_and_copy
(
upload
er
)
end
end
...
...
@@ -72,19 +72,19 @@ module Gitlab
@uploads_export_path
||=
File
.
join
(
@shared
.
export_path
,
@relative_export_path
)
end
def
upload
s
def
upload
er
avatar_path
=
@project
.
avatar
&
.
upload
&
.
path
if
@relative_export_path
==
'avatar'
yield
(
@project
.
avatar
)
else
project_uploads
(
avatar_path
).
find_each
(
batch_size:
UPLOADS_BATCH_SIZE
)
do
|
upload
|
project_uploads
_or_avatar
(
avatar_path
).
find_each
(
batch_size:
UPLOADS_BATCH_SIZE
)
do
|
upload
|
yield
(
upload
.
build_uploader
)
end
end
end
def
project_uploads
(
avatar_path
)
def
project_uploads
_or_avatar
(
avatar_path
)
return
@project
.
uploads
unless
avatar_path
@project
.
uploads
.
where
(
"path != ?"
,
avatar_path
)
...
...
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