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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
083027fc
Commit
083027fc
authored
Mar 24, 2015
by
Vinnie Okada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change directory when removing old backups
parent
b9372c99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
CHANGELOG
CHANGELOG
+1
-0
lib/backup/manager.rb
lib/backup/manager.rb
+8
-7
No files found.
CHANGELOG
View file @
083027fc
...
...
@@ -25,6 +25,7 @@ v 7.10.0 (unreleased)
- Passing the name of pushed ref to CI service (requires GitLab CI 7.9+)
- Add location field to user profile
- Fix print view for markdown files and wiki pages
- Fix errors when deleting old backups
- Improve GitLab performance when working with git repositories
- Add tag message and last commit to tag hook (Kamil Trzciński)
- Restrict permissions on backup files
...
...
lib/backup/manager.rb
View file @
083027fc
...
...
@@ -70,16 +70,17 @@ module Backup
# delete backups
$progress
.
print
"Deleting old backups ... "
keep_time
=
Gitlab
.
config
.
backup
.
keep_time
.
to_i
path
=
Gitlab
.
config
.
backup
.
path
if
keep_time
>
0
removed
=
0
file_list
=
Dir
.
glob
(
Rails
.
root
.
join
(
path
,
"*_gitlab_backup.tar"
))
file_list
.
map!
{
|
f
|
$1
.
to_i
if
f
=~
/(\d+)_gitlab_backup.tar/
}
file_list
.
sort
.
each
do
|
timestamp
|
if
Time
.
at
(
timestamp
)
<
(
Time
.
now
-
keep_time
)
if
Kernel
.
system
(
*
%W(rm
#{
timestamp
}
_gitlab_backup.tar)
)
removed
+=
1
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
do
file_list
=
Dir
.
glob
(
'*_gitlab_backup.tar'
)
file_list
.
map!
{
|
f
|
$1
.
to_i
if
f
=~
/(\d+)_gitlab_backup.tar/
}
file_list
.
sort
.
each
do
|
timestamp
|
if
Time
.
at
(
timestamp
)
<
(
Time
.
now
-
keep_time
)
if
Kernel
.
system
(
*
%W(rm
#{
timestamp
}
_gitlab_backup.tar)
)
removed
+=
1
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