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
baa15792
Commit
baa15792
authored
Jul 30, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stricter mkdir's in 'rake gitlab:backup:create'
parent
c5aae307
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
lib/backup/database.rb
lib/backup/database.rb
+5
-2
lib/backup/repository.rb
lib/backup/repository.rb
+4
-1
lib/backup/uploads.rb
lib/backup/uploads.rb
+5
-1
No files found.
lib/backup/database.rb
View file @
baa15792
...
@@ -7,7 +7,11 @@ module Backup
...
@@ -7,7 +7,11 @@ module Backup
def
initialize
def
initialize
@config
=
YAML
.
load_file
(
File
.
join
(
Rails
.
root
,
'config'
,
'database.yml'
))[
Rails
.
env
]
@config
=
YAML
.
load_file
(
File
.
join
(
Rails
.
root
,
'config'
,
'database.yml'
))[
Rails
.
env
]
@db_dir
=
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
'db'
)
@db_dir
=
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
'db'
)
FileUtils
.
mkdir_p
(
@db_dir
,
mode:
0700
)
unless
Dir
.
exists?
(
@db_dir
)
FileUtils
.
rm_rf
(
@db_dir
)
# Ensure the parent dir of @db_dir exists
FileUtils
.
mkdir_p
(
Gitlab
.
config
.
backup
.
path
)
# Fail if somebody raced to create @db_dir before us
FileUtils
.
mkdir
(
@db_dir
,
mode:
0700
)
end
end
def
dump
def
dump
...
@@ -25,7 +29,6 @@ module Backup
...
@@ -25,7 +29,6 @@ module Backup
abort
'Backup failed'
unless
success
abort
'Backup failed'
unless
success
$progress
.
print
'Compressing database ... '
$progress
.
print
'Compressing database ... '
FileUtils
.
rm_f
db_file_name_gz
success
=
system
(
'gzip'
,
db_file_name
)
success
=
system
(
'gzip'
,
db_file_name
)
report_success
(
success
)
report_success
(
success
)
abort
'Backup failed: compress error'
unless
success
abort
'Backup failed: compress error'
unless
success
...
...
lib/backup/repository.rb
View file @
baa15792
...
@@ -130,7 +130,10 @@ module Backup
...
@@ -130,7 +130,10 @@ module Backup
def
prepare
def
prepare
FileUtils
.
rm_rf
(
backup_repos_path
)
FileUtils
.
rm_rf
(
backup_repos_path
)
FileUtils
.
mkdir_p
(
backup_repos_path
,
mode:
0700
)
# Ensure the parent dir of backup_repos_path exists
FileUtils
.
mkdir_p
(
Gitlab
.
config
.
backup
.
path
)
# Fail if somebody raced to create backup_repos_path before us
FileUtils
.
mkdir
(
backup_repos_path
,
mode:
0700
)
end
end
def
silent
def
silent
...
...
lib/backup/uploads.rb
View file @
baa15792
...
@@ -10,7 +10,11 @@ module Backup
...
@@ -10,7 +10,11 @@ module Backup
# Copy uploads from public/uploads to backup/uploads
# Copy uploads from public/uploads to backup/uploads
def
dump
def
dump
FileUtils
.
mkdir_p
(
backup_uploads_dir
,
mode:
0700
)
FileUtils
.
rm_rf
(
backup_uploads_dir
)
# Ensure the parent dir of backup_uploads_dir exists
FileUtils
.
mkdir_p
(
Gitlab
.
config
.
backup
.
path
)
# Fail if somebody raced to create backup_uploads_dir before us
FileUtils
.
mkdir
(
backup_uploads_dir
,
mode:
0700
)
FileUtils
.
cp_r
(
app_uploads_dir
,
backup_dir
)
FileUtils
.
cp_r
(
app_uploads_dir
,
backup_dir
)
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