BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
55fdf967
Commit
55fdf967
authored
Jun 22, 2017
by
Douwe Maan
Committed by
James Edwards-Jones
Jul 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'bvl-remove-appearance-symlink' into 'security-9-3'
Remove the `appearance` symlink that was previously missed See merge request !2124
parent
89523d9e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
1 deletion
+103
-1
bvl-remove-appearance-symlink.yml
changelogs/unreleased/bvl-remove-appearance-symlink.yml
+4
-0
20170406111121_clean_upload_symlinks.rb
db/post_migrate/20170406111121_clean_upload_symlinks.rb
+1
-1
20170613111224_clean_appearance_symlinks.rb
db/post_migrate/20170613111224_clean_appearance_symlinks.rb
+52
-0
clean_appearance_symlinks_spec.rb
spec/migrations/clean_appearance_symlinks_spec.rb
+46
-0
No files found.
changelogs/unreleased/bvl-remove-appearance-symlink.yml
0 → 100644
View file @
55fdf967
---
title
:
Remove uploads/appearance symlink. A leftover from a previous migration.
merge_request
:
author
:
db/post_migrate/20170406111121_clean_upload_symlinks.rb
View file @
55fdf967
...
...
@@ -6,7 +6,7 @@ class CleanUploadSymlinks < ActiveRecord::Migration
disable_ddl_transaction!
DOWNTIME
=
false
DIRECTORIES_TO_MOVE
=
%w(user project note group appear
e
ance)
DIRECTORIES_TO_MOVE
=
%w(user project note group appearance)
def
up
return
unless
file_storage?
...
...
db/post_migrate/20170613111224_clean_appearance_symlinks.rb
0 → 100644
View file @
55fdf967
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
CleanAppearanceSymlinks
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
def
up
return
unless
file_storage?
symlink_location
=
File
.
join
(
old_upload_dir
,
dir
)
return
unless
File
.
symlink?
(
symlink_location
)
say
"removing symlink:
#{
symlink_location
}
"
FileUtils
.
rm
(
symlink_location
)
end
def
down
return
unless
file_storage?
symlink
=
File
.
join
(
old_upload_dir
,
dir
)
destination
=
File
.
join
(
new_upload_dir
,
dir
)
return
if
File
.
directory?
(
symlink
)
return
unless
File
.
directory?
(
destination
)
say
"Creating symlink
#{
symlink
}
->
#{
destination
}
"
FileUtils
.
ln_s
(
destination
,
symlink
)
end
def
file_storage?
CarrierWave
::
Uploader
::
Base
.
storage
==
CarrierWave
::
Storage
::
File
end
def
dir
'appearance'
end
def
base_directory
Rails
.
root
end
def
old_upload_dir
File
.
join
(
base_directory
,
"public"
,
"uploads"
)
end
def
new_upload_dir
File
.
join
(
base_directory
,
"public"
,
"uploads"
,
"system"
)
end
end
spec/migrations/clean_appearance_symlinks_spec.rb
0 → 100644
View file @
55fdf967
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20170613111224_clean_appearance_symlinks.rb'
)
describe
CleanAppearanceSymlinks
do
let
(
:migration
)
{
described_class
.
new
}
let
(
:test_dir
)
{
File
.
join
(
Rails
.
root
,
"tmp"
,
"tests"
,
"clean_appearance_test"
)
}
let
(
:uploads_dir
)
{
File
.
join
(
test_dir
,
"public"
,
"uploads"
)
}
let
(
:new_uploads_dir
)
{
File
.
join
(
uploads_dir
,
"system"
)
}
let
(
:original_path
)
{
File
.
join
(
new_uploads_dir
,
'appearance'
)
}
let
(
:symlink_path
)
{
File
.
join
(
uploads_dir
,
'appearance'
)
}
before
do
FileUtils
.
remove_dir
(
test_dir
)
if
File
.
directory?
(
test_dir
)
FileUtils
.
mkdir_p
(
uploads_dir
)
allow
(
migration
).
to
receive
(
:base_directory
).
and_return
(
test_dir
)
allow
(
migration
).
to
receive
(
:say
)
end
describe
"#up"
do
before
do
FileUtils
.
mkdir_p
(
original_path
)
FileUtils
.
ln_s
(
original_path
,
symlink_path
)
end
it
'removes the symlink'
do
migration
.
up
expect
(
File
.
symlink?
(
symlink_path
)).
to
be
(
false
)
end
end
describe
'#down'
do
before
do
FileUtils
.
mkdir_p
(
File
.
join
(
original_path
))
FileUtils
.
touch
(
File
.
join
(
original_path
,
'dummy.file'
))
end
it
'creates a symlink'
do
expected_path
=
File
.
join
(
symlink_path
,
"dummy.file"
)
migration
.
down
expect
(
File
.
exist?
(
expected_path
)).
to
be
(
true
)
expect
(
File
.
symlink?
(
symlink_path
)).
to
be
(
true
)
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