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
Jérome Perrin
gitlab-ce
Commits
36ccaca3
Commit
36ccaca3
authored
Jun 14, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
project export archiver
parent
dee6fba5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-3
app/models/project.rb
app/models/project.rb
+9
-0
app/workers/gitlab_project_archive_worker.rb
app/workers/gitlab_project_archive_worker.rb
+9
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+3
-0
No files found.
app/controllers/projects_controller.rb
View file @
36ccaca3
...
@@ -266,8 +266,6 @@ class ProjectsController < Projects::ApplicationController
...
@@ -266,8 +266,6 @@ class ProjectsController < Projects::ApplicationController
end
end
def
export_project_path
def
export_project_path
# TODO: move this, probably to ImportExport and refactor
Dir
.
glob
(
"
#{
@project
.
export_path
}
/*export.tar.gz"
).
max_by
{
|
f
|
File
.
ctime
(
f
)}
folder
=
File
.
join
(
Settings
.
shared
[
'path'
],
'tmp/project_exports'
,
@project
.
path_with_namespace
)
Dir
.
glob
(
"
#{
folder
}
/*export.tar.gz"
).
max_by
{
|
f
|
File
.
ctime
(
f
)}
end
end
end
end
app/models/project.rb
View file @
36ccaca3
...
@@ -348,6 +348,11 @@ class Project < ActiveRecord::Base
...
@@ -348,6 +348,11 @@ class Project < ActiveRecord::Base
joins
(
join_body
).
reorder
(
'join_note_counts.amount DESC'
)
joins
(
join_body
).
reorder
(
'join_note_counts.amount DESC'
)
end
end
# Deletes gitlab project export files older than 24 hours
def
archive_gitlab_exports!
Gitlab
::
Popen
.
popen
(
%W(find
#{
export_path
}
-not -path
#{
export_path
}
-mmin +1440 -delete)
)
end
end
end
def
team
def
team
...
@@ -1104,4 +1109,8 @@ class Project < ActiveRecord::Base
...
@@ -1104,4 +1109,8 @@ class Project < ActiveRecord::Base
Rails
.
logger
.
error
"Export job failed to start for project ID
#{
self
.
id
}
"
Rails
.
logger
.
error
"Export job failed to start for project ID
#{
self
.
id
}
"
end
end
end
end
def
export_path
File
.
join
(
ImportExport
.
storage_path
,
path_with_namespace
)
end
end
end
app/workers/gitlab_project_archive_worker.rb
0 → 100644
View file @
36ccaca3
class
GitlabProjectArchiveWorker
include
Sidekiq
::
Worker
sidekiq_options
queue: :default
def
perform
Project
.
archive_gitlab_exports!
end
end
config/initializers/1_settings.rb
View file @
36ccaca3
...
@@ -288,6 +288,9 @@ Settings.cron_jobs['admin_email_worker']['job_class'] = 'AdminEmailWorker'
...
@@ -288,6 +288,9 @@ Settings.cron_jobs['admin_email_worker']['job_class'] = 'AdminEmailWorker'
Settings
.
cron_jobs
[
'repository_archive_cache_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'repository_archive_cache_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'repository_archive_cache_worker'
][
'cron'
]
||=
'0 * * * *'
Settings
.
cron_jobs
[
'repository_archive_cache_worker'
][
'cron'
]
||=
'0 * * * *'
Settings
.
cron_jobs
[
'repository_archive_cache_worker'
][
'job_class'
]
=
'RepositoryArchiveCacheWorker'
Settings
.
cron_jobs
[
'repository_archive_cache_worker'
][
'job_class'
]
=
'RepositoryArchiveCacheWorker'
Settings
.
cron_jobs
[
'gitlab_project_archive_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'gitlab_project_archive_worker'
][
'cron'
]
||=
'0 * * * *'
Settings
.
cron_jobs
[
'gitlab_project_archive_worker'
][
'job_class'
]
=
'GitlabProjectArchiveWorker'
#
#
# GitLab Shell
# GitLab Shell
...
...
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