diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-06-06 12:28:28 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-06-26 17:48:41 +0200 |
commit | 3e84b6336f3d61ff56e3e8ef5cc5d8ca08ef0432 (patch) | |
tree | e9986669e0b69eb93efac959b105b6318d69232f /lib | |
parent | 36ecbb6934c73dc7a446c51766b8d43d98be7c12 (diff) | |
download | gitlab-ce-3e84b6336f3d61ff56e3e8ef5cc5d8ca08ef0432.tar.gz |
Track all renames in redis
Diffstat (limited to 'lib')
3 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base.rb b/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base.rb index d8163d7da11..a8febf4ec62 100644 --- a/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base.rb +++ b/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base.rb @@ -114,6 +114,11 @@ module Gitlab end end + def track_rename(type, old_path, new_path) + key = "rename:#{migration.version}:#{type}" + Gitlab::Redis.with { |redis| redis.lpush(key, [old_path, new_path].to_json) } + end + def file_storage? CarrierWave::Uploader::Base.storage == CarrierWave::Storage::File end diff --git a/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces.rb b/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces.rb index da7e2cb2e85..a84af02e67b 100644 --- a/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces.rb +++ b/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces.rb @@ -26,6 +26,8 @@ module Gitlab def rename_namespace(namespace) old_full_path, new_full_path = rename_path_for_routable(namespace) + track_rename('namespace', old_full_path, new_full_path) + move_repositories(namespace, old_full_path, new_full_path) move_uploads(old_full_path, new_full_path) move_pages(old_full_path, new_full_path) diff --git a/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects.rb b/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects.rb index 448717eb744..59e47120159 100644 --- a/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects.rb +++ b/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects.rb @@ -16,6 +16,8 @@ module Gitlab def rename_project(project) old_full_path, new_full_path = rename_path_for_routable(project) + track_rename('project', old_full_path, new_full_path) + move_repository(project, old_full_path, new_full_path) move_repository(project, "#{old_full_path}.wiki", "#{new_full_path}.wiki") move_uploads(old_full_path, new_full_path) |