summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAhmad Hassan <ahmad.hassan612@gmail.com>2018-12-17 13:18:50 +0200
committerAhmad Hassan <ahmad.hassan612@gmail.com>2018-12-17 13:18:50 +0200
commitd6886506a0bb8b7db3e6f4fa7dc4d5aa1632b84f (patch)
tree04b5625a927fb37e684d026cb5161b78f993b72e /config
parentdfc54352c001e8544972c3d40bfc82e55a11c6a0 (diff)
parent32b6129d8cef406b1cafa455fcf0bf83ddba46de (diff)
downloadgitlab-ce-d6886506a0bb8b7db3e6f4fa7dc4d5aa1632b84f.tar.gz
Merge remote-tracking branch 'origin/master' into support-gitaly-tls
Diffstat (limited to 'config')
-rw-r--r--config/application.rb13
-rw-r--r--config/boot.rb9
-rw-r--r--config/environment.rb7
-rw-r--r--config/environments/production.rb6
-rw-r--r--config/environments/test.rb9
-rw-r--r--config/initializers/active_record_array_type_casting.rb23
-rw-r--r--config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb104
-rw-r--r--config/initializers/active_record_data_types.rb2
-rw-r--r--config/initializers/active_record_locking.rb20
-rw-r--r--config/initializers/application_controller_renderer.rb12
-rw-r--r--config/initializers/ar5_batching.rb40
-rw-r--r--config/initializers/ar5_pg_10_support.rb58
-rw-r--r--config/initializers/mysql_set_length_for_binary_indexes.rb43
-rw-r--r--config/initializers/new_framework_defaults.rb40
-rw-r--r--config/initializers/postgresql_opclasses_support.rb23
-rw-r--r--config/initializers/static_files.rb23
-rw-r--r--config/initializers/trusted_proxies.rb12
-rw-r--r--config/routes/api.rb2
-rw-r--r--config/sidekiq_queues.yml1
19 files changed, 105 insertions, 342 deletions
diff --git a/config/application.rb b/config/application.rb
index f10b8ed5bd2..349c7258852 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -5,12 +5,6 @@ require 'rails/all'
Bundler.require(:default, Rails.env)
module Gitlab
- # This method is used for smooth upgrading from the current Rails 4.x to Rails 5.0.
- # https://gitlab.com/gitlab-org/gitlab-ce/issues/14286
- def self.rails5?
- !%w[0 false].include?(ENV["RAILS5"])
- end
-
class Application < Rails::Application
require_dependency Rails.root.join('lib/gitlab/redis/wrapper')
require_dependency Rails.root.join('lib/gitlab/redis/cache')
@@ -26,9 +20,6 @@ module Gitlab
# setting disabled
require_dependency Rails.root.join('lib/mysql_zero_date')
- # This can be removed when we drop support for rails 4
- require_dependency Rails.root.join('lib/rails4_migration_version')
-
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
@@ -86,7 +77,7 @@ module Gitlab
# namespaces/users.
# https://github.com/rails/rails/blob/5-0-stable/actioncable/lib/action_cable.rb#L38
# Please change this value when configuring ActionCable for real usage.
- config.action_cable.mount_path = "/-/cable" if rails5?
+ config.action_cable.mount_path = "/-/cable"
# Configure sensitive parameters which will be filtered from the log file.
#
@@ -213,8 +204,6 @@ module Gitlab
config.cache_store = :redis_store, caching_config_hash
- config.active_record.raise_in_transactional_callbacks = true unless rails5?
-
config.active_job.queue_adapter = :sidekiq
# This is needed for gitlab-shell
diff --git a/config/boot.rb b/config/boot.rb
index 725473ac7f6..2811f0e6188 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,11 +1,4 @@
-def rails5?
- !%w[0 false].include?(ENV["RAILS5"])
-end
-
-require 'rubygems' unless rails5?
-
-gemfile = rails5? ? "Gemfile" : "Gemfile.rails4"
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../#{gemfile}", __dir__)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
# Set up gems listed in the Gemfile.
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
diff --git a/config/environment.rb b/config/environment.rb
index 3a52656a2c1..7e55c7803d3 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,11 +1,6 @@
# Load the rails application
-# Remove this condition when upgraded to rails 5.0.
-if %w[0 false].include?(ENV["RAILS5"])
- require File.expand_path('application', __dir__)
-else
- require_relative 'application'
-end
+require_relative 'application'
# Initialize the rails application
Rails.application.initialize!
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 49a4e873093..09bcf49a9a5 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -9,11 +9,7 @@ Rails.application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
- if Gitlab.rails5?
- config.public_file_server.enabled = false
- else
- config.serve_static_files = false
- end
+ config.public_file_server.enabled = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 072f93150a3..3461099253a 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -19,13 +19,8 @@ Rails.application.configure do
# Configure static asset server for tests with Cache-Control for performance
config.assets.compile = false if ENV['CI']
- if Gitlab.rails5?
- config.public_file_server.enabled = true
- config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
- else
- config.serve_static_files = true
- config.static_cache_control = "public, max-age=3600"
- end
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
# Show full error reports and disable caching
config.consider_all_requests_local = true
diff --git a/config/initializers/active_record_array_type_casting.rb b/config/initializers/active_record_array_type_casting.rb
deleted file mode 100644
index a149e048ee2..00000000000
--- a/config/initializers/active_record_array_type_casting.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# Remove this initializer when upgraded to Rails 5.0
-unless Gitlab.rails5?
- module ActiveRecord
- class PredicateBuilder
- class ArrayHandler
- module TypeCasting
- def call(attribute, value)
- # This is necessary because by default ActiveRecord does not respect
- # custom type definitions (like our `ShaAttribute`) when providing an
- # array in `where`, like in `where(commit_sha: [sha1, sha2, sha3])`.
- model = attribute.relation&.engine
- type = model.user_provided_columns[attribute.name] if model
- value = value.map { |value| type.type_cast_for_database(value) } if type
-
- super(attribute, value)
- end
- end
-
- prepend TypeCasting
- end
- end
- end
-end
diff --git a/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb b/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
index ef4abb77bd7..3e765469995 100644
--- a/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
+++ b/config/initializers/active_record_avoid_type_casting_in_uniqueness_validator.rb
@@ -20,75 +20,73 @@
#
# This bug was fixed in Rails 5.1 by https://github.com/rails/rails/pull/24745/commits/aa062318c451512035c10898a1af95943b1a3803
-if Gitlab.rails5?
- if Rails.version.start_with?("5.1")
- raise "Remove this monkey patch: #{__FILE__}"
- end
+if Rails.version.start_with?("5.1")
+ raise "Remove this monkey patch: #{__FILE__}"
+end
- # Copy-paste from https://github.com/kamipo/rails/blob/aa062318c451512035c10898a1af95943b1a3803/activerecord/lib/active_record/validations/uniqueness.rb
- # including local fixes to make Rubocop happy again.
- module ActiveRecord
- module Validations
- class UniquenessValidator < ActiveModel::EachValidator # :nodoc:
- def validate_each(record, attribute, value)
- finder_class = find_finder_class_for(record)
- table = finder_class.arel_table
- value = map_enum_attribute(finder_class, attribute, value)
+# Copy-paste from https://github.com/kamipo/rails/blob/aa062318c451512035c10898a1af95943b1a3803/activerecord/lib/active_record/validations/uniqueness.rb
+# including local fixes to make Rubocop happy again.
+module ActiveRecord
+ module Validations
+ class UniquenessValidator < ActiveModel::EachValidator # :nodoc:
+ def validate_each(record, attribute, value)
+ finder_class = find_finder_class_for(record)
+ table = finder_class.arel_table
+ value = map_enum_attribute(finder_class, attribute, value)
- relation = build_relation(finder_class, table, attribute, value)
+ relation = build_relation(finder_class, table, attribute, value)
- if record.persisted?
- if finder_class.primary_key
- relation = relation.where.not(finder_class.primary_key => record.id_was || record.id)
- else
- raise UnknownPrimaryKey.new(finder_class, "Can not validate uniqueness for persisted record without primary key.")
- end
+ if record.persisted?
+ if finder_class.primary_key
+ relation = relation.where.not(finder_class.primary_key => record.id_was || record.id)
+ else
+ raise UnknownPrimaryKey.new(finder_class, "Can not validate uniqueness for persisted record without primary key.")
end
+ end
- relation = scope_relation(record, table, relation)
- relation = relation.merge(options[:conditions]) if options[:conditions]
+ relation = scope_relation(record, table, relation)
+ relation = relation.merge(options[:conditions]) if options[:conditions]
- if relation.exists?
- error_options = options.except(:case_sensitive, :scope, :conditions)
- error_options[:value] = value
+ if relation.exists?
+ error_options = options.except(:case_sensitive, :scope, :conditions)
+ error_options[:value] = value
- record.errors.add(attribute, :taken, error_options)
- end
- rescue RangeError
+ record.errors.add(attribute, :taken, error_options)
end
+ rescue RangeError
+ end
- protected
-
- def build_relation(klass, table, attribute, value) #:nodoc:
- if reflection = klass._reflect_on_association(attribute)
- attribute = reflection.foreign_key
- value = value.attributes[reflection.klass.primary_key] unless value.nil?
- end
+ protected
- # the attribute may be an aliased attribute
- if klass.attribute_alias?(attribute)
- attribute = klass.attribute_alias(attribute)
- end
+ def build_relation(klass, table, attribute, value) #:nodoc:
+ if reflection = klass._reflect_on_association(attribute)
+ attribute = reflection.foreign_key
+ value = value.attributes[reflection.klass.primary_key] unless value.nil?
+ end
- attribute_name = attribute.to_s
+ # the attribute may be an aliased attribute
+ if klass.attribute_alias?(attribute)
+ attribute = klass.attribute_alias(attribute)
+ end
- column = klass.columns_hash[attribute_name]
- cast_type = klass.type_for_attribute(attribute_name)
+ attribute_name = attribute.to_s
- comparison =
- if !options[:case_sensitive] && !value.nil?
- # will use SQL LOWER function before comparison, unless it detects a case insensitive collation
- klass.connection.case_insensitive_comparison(table, attribute, column, value)
- else
- klass.connection.case_sensitive_comparison(table, attribute, column, value)
- end
+ column = klass.columns_hash[attribute_name]
+ cast_type = klass.type_for_attribute(attribute_name)
- if value.nil?
- klass.unscoped.where(comparison)
+ comparison =
+ if !options[:case_sensitive] && !value.nil?
+ # will use SQL LOWER function before comparison, unless it detects a case insensitive collation
+ klass.connection.case_insensitive_comparison(table, attribute, column, value)
else
- bind = Relation::QueryAttribute.new(attribute_name, value, cast_type)
- klass.unscoped.where(comparison, bind)
+ klass.connection.case_sensitive_comparison(table, attribute, column, value)
end
+
+ if value.nil?
+ klass.unscoped.where(comparison)
+ else
+ bind = Relation::QueryAttribute.new(attribute_name, value, cast_type)
+ klass.unscoped.where(comparison, bind)
end
end
end
diff --git a/config/initializers/active_record_data_types.rb b/config/initializers/active_record_data_types.rb
index 717e30b5b7e..e95157bfde5 100644
--- a/config/initializers/active_record_data_types.rb
+++ b/config/initializers/active_record_data_types.rb
@@ -65,7 +65,7 @@ elsif Gitlab::Database.mysql?
prepend RegisterDateTimeWithTimeZone
# Add the class `DateTimeWithTimeZone` so we can map `timestamp` to it.
- class MysqlDateTimeWithTimeZone < (Gitlab.rails5? ? ActiveRecord::Type::DateTime : MysqlDateTime)
+ class MysqlDateTimeWithTimeZone < ActiveRecord::Type::DateTime
def type
:datetime_with_timezone
end
diff --git a/config/initializers/active_record_locking.rb b/config/initializers/active_record_locking.rb
index 21ff323927b..bfe41e6029a 100644
--- a/config/initializers/active_record_locking.rb
+++ b/config/initializers/active_record_locking.rb
@@ -64,21 +64,13 @@ module ActiveRecord
# This is patched because we want `lock_version` default to `NULL`
# rather than `0`
- if Gitlab.rails5?
- class LockingType
- def deserialize(value)
- super
- end
-
- def serialize(value)
- super
- end
+ class LockingType
+ def deserialize(value)
+ super
end
- else
- class LockingType < SimpleDelegator
- def type_cast_from_database(value)
- super
- end
+
+ def serialize(value)
+ super
end
end
end
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
deleted file mode 100644
index a65f8aecf9e..00000000000
--- a/config/initializers/application_controller_renderer.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# Remove this `if` condition when upgraded to rails 5.0.
-# The body must be kept.
-if Gitlab.rails5?
- # Be sure to restart your server when you modify this file.
-
- # ActiveSupport::Reloader.to_prepare do
- # ApplicationController.renderer.defaults.merge!(
- # http_host: 'example.org',
- # https: false
- # )
- # end
-end
diff --git a/config/initializers/ar5_batching.rb b/config/initializers/ar5_batching.rb
deleted file mode 100644
index 874455ce5af..00000000000
--- a/config/initializers/ar5_batching.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# Remove this file when upgraded to rails 5.0.
-unless Gitlab.rails5?
- module ActiveRecord
- module Batches
- # Differences from upstream: enumerator support was removed, and custom
- # order/limit clauses are ignored without a warning.
- def in_batches(of: 1000, start: nil, finish: nil, load: false)
- raise "Must provide a block" unless block_given?
-
- relation = self.reorder(batch_order).limit(of)
- relation = relation.where(arel_table[primary_key].gteq(start)) if start
- relation = relation.where(arel_table[primary_key].lteq(finish)) if finish
- batch_relation = relation
-
- loop do
- if load
- records = batch_relation.records
- ids = records.map(&:id)
- yielded_relation = self.where(primary_key => ids)
- yielded_relation.load_records(records)
- else
- ids = batch_relation.pluck(primary_key)
- yielded_relation = self.where(primary_key => ids)
- end
-
- break if ids.empty?
-
- primary_key_offset = ids.last
- raise ArgumentError.new("Primary key not included in the custom select clause") unless primary_key_offset
-
- yield yielded_relation
-
- break if ids.length < of
-
- batch_relation = relation.where(arel_table[primary_key].gt(primary_key_offset))
- end
- end
- end
- end
-end
diff --git a/config/initializers/ar5_pg_10_support.rb b/config/initializers/ar5_pg_10_support.rb
deleted file mode 100644
index 40548290ce8..00000000000
--- a/config/initializers/ar5_pg_10_support.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# Remove this file when upgraded to rails 5.0.
-if !Gitlab.rails5? && Gitlab::Database.postgresql?
- require 'active_record/connection_adapters/postgresql_adapter'
- require 'active_record/connection_adapters/postgresql/schema_statements'
-
- #
- # Monkey-patch the refused Rails 4.2 patch at https://github.com/rails/rails/pull/31330
- #
- # Updates sequence logic to support PostgreSQL 10.
- #
- # rubocop:disable all
- module ActiveRecord
- module ConnectionAdapters
-
- # We need #postgresql_version to be public as in ActiveRecord 5 for seed_fu
- # to work. In ActiveRecord 4, it is protected.
- # https://github.com/mbleigh/seed-fu/issues/123
- class PostgreSQLAdapter
- public :postgresql_version
- end
-
- module PostgreSQL
- module SchemaStatements
- # Resets the sequence of a table's primary key to the maximum value.
- def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
- unless pk and sequence
- default_pk, default_sequence = pk_and_sequence_for(table)
-
- pk ||= default_pk
- sequence ||= default_sequence
- end
-
- if @logger && pk && !sequence
- @logger.warn "#{table} has primary key #{pk} with no default sequence"
- end
-
- if pk && sequence
- quoted_sequence = quote_table_name(sequence)
- max_pk = select_value("SELECT MAX(#{quote_column_name pk}) FROM #{quote_table_name(table)}")
- if max_pk.nil?
- if postgresql_version >= 100000
- minvalue = select_value("SELECT seqmin FROM pg_sequence WHERE seqrelid = #{quote(quoted_sequence)}::regclass")
- else
- minvalue = select_value("SELECT min_value FROM #{quoted_sequence}")
- end
- end
-
- select_value <<-end_sql, 'SCHEMA'
- SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false})
- end_sql
- end
- end
- end
- end
- end
- end
- # rubocop:enable all
-end
diff --git a/config/initializers/mysql_set_length_for_binary_indexes.rb b/config/initializers/mysql_set_length_for_binary_indexes.rb
index 0445d8fcae2..552f3a20a95 100644
--- a/config/initializers/mysql_set_length_for_binary_indexes.rb
+++ b/config/initializers/mysql_set_length_for_binary_indexes.rb
@@ -2,28 +2,6 @@
# MySQL adapter apply a length of 20. Otherwise MySQL can't create an index on
# binary columns.
-# This module can be removed once a Rails 5 schema is used.
-# It can't be wrapped in a check that checks Gitlab.rails5? because
-# the old Rails 4 schema layout is still used
-module MysqlSetLengthForBinaryIndex
- def add_index(table_name, column_names, options = {})
- options[:length] ||= {}
- Array(column_names).each do |column_name|
- column = ActiveRecord::Base.connection.columns(table_name).find { |c| c.name == column_name }
-
- if column&.type == :binary
- options[:length][column_name] = 20
- end
- end
-
- super(table_name, column_names, options)
- end
-end
-
-if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
- ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, MysqlSetLengthForBinaryIndex)
-end
-
module MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema
# This method is used in Rails 5 schema loading as t.index
def index(column_names, options = {})
@@ -34,15 +12,6 @@ module MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema
return
end
- # when running rails 4 with rails 5 schema, rails 4 doesn't support multiple
- # indexes on the same set of columns. Mysql doesn't support partial indexes, so if
- # an index already exists and we add another index, skip it if it's partial:
- # see https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21492#note_102821326
- if !Gitlab.rails5? && indexes[column_names] && options[:where]
- warn "WARNING: index on columns #{column_names} already exists and partial index is not supported, skipping."
- return
- end
-
options[:length] ||= {}
Array(column_names).each do |column_name|
column = columns.find { |c| c.name == column_name }
@@ -56,14 +25,6 @@ module MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema
end
end
-def mysql_adapter?
- defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
-end
-
-if Gitlab.rails5?
- if defined?(ActiveRecord::ConnectionAdapters::MySQL::TableDefinition)
- ActiveRecord::ConnectionAdapters::MySQL::TableDefinition.send(:prepend, MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema)
- end
-elsif mysql_adapter? && defined?(ActiveRecord::ConnectionAdapters::TableDefinition)
- ActiveRecord::ConnectionAdapters::TableDefinition.send(:prepend, MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema)
+if defined?(ActiveRecord::ConnectionAdapters::MySQL::TableDefinition)
+ ActiveRecord::ConnectionAdapters::MySQL::TableDefinition.send(:prepend, MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema)
end
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
index 2d130bc0bf8..5adb9f7a4b4 100644
--- a/config/initializers/new_framework_defaults.rb
+++ b/config/initializers/new_framework_defaults.rb
@@ -1,29 +1,27 @@
# Remove this `if` condition when upgraded to rails 5.0.
# The body must be kept.
-if Gitlab.rails5?
- # Be sure to restart your server when you modify this file.
- #
- # This file contains migration options to ease your Rails 5.0 upgrade.
- #
- # Once upgraded flip defaults one by one to migrate to the new default.
- #
- # Read the Guide for Upgrading Ruby on Rails for more info on each option.
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
- Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
+Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
- # Enable per-form CSRF tokens. Previous versions had false.
- Rails.application.config.action_controller.per_form_csrf_tokens = false
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = false
- # Enable origin-checking CSRF mitigation. Previous versions had false.
- Rails.application.config.action_controller.forgery_protection_origin_check = false
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = false
- # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
- # Previous versions had false.
- ActiveSupport.to_time_preserves_timezone = false
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = false
- # Require `belongs_to` associations by default. Previous versions had false.
- Rails.application.config.active_record.belongs_to_required_by_default = false
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = false
- # Do not halt callback chains when a callback returns false. Previous versions had true.
- ActiveSupport.halt_callback_chains_on_return_false = true
-end
+# Do not halt callback chains when a callback returns false. Previous versions had true.
+ActiveSupport.halt_callback_chains_on_return_false = true
diff --git a/config/initializers/postgresql_opclasses_support.rb b/config/initializers/postgresql_opclasses_support.rb
index 07b06629dea..70b530415f5 100644
--- a/config/initializers/postgresql_opclasses_support.rb
+++ b/config/initializers/postgresql_opclasses_support.rb
@@ -41,10 +41,7 @@ module ActiveRecord
# Abstract representation of an index definition on a table. Instances of
# this type are typically created and returned by methods in database
# adapters. e.g. ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#indexes
- attrs = [:table, :name, :unique, :columns, :lengths, :orders, :where, :type, :using, :opclasses]
-
- # In Rails 5 the second last attribute is newly `:comment`
- attrs.insert(-2, :comment) if Gitlab.rails5?
+ attrs = [:table, :name, :unique, :columns, :lengths, :orders, :where, :type, :using, :comment, :opclasses]
class IndexDefinition < Struct.new(*attrs) #:nodoc:
end
@@ -81,7 +78,7 @@ module ActiveRecord
if index_name.length > max_index_length
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{max_index_length} characters"
end
- if table_exists?(table_name) && index_name_exists?(table_name, index_name, false)
+ if data_source_exists?(table_name) && index_name_exists?(table_name, index_name, false)
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' already exists"
end
index_columns = quoted_columns_for_index(column_names, options).join(", ")
@@ -112,15 +109,8 @@ module ActiveRecord
result.map do |row|
index_name = row[0]
- unique = if Gitlab.rails5?
- row[1]
- else
- row[1] == 't'
- end
- indkey = row[2].split(" ")
- if Gitlab.rails5?
- indkey = indkey.map(&:to_i)
- end
+ unique = row[1]
+ indkey = row[2].split(" ").map(&:to_i)
inddef = row[3]
oid = row[4]
@@ -144,8 +134,7 @@ module ActiveRecord
[column, opclass] if opclass
end.compact]
- index_attrs = [table_name, index_name, unique, column_names, [], orders, where, nil, using, opclasses]
- index_attrs.insert(-2, nil) if Gitlab.rails5? # include index comment for Rails 5
+ index_attrs = [table_name, index_name, unique, column_names, [], orders, where, nil, using, nil, opclasses]
IndexDefinition.new(*index_attrs)
end
@@ -205,7 +194,7 @@ module ActiveRecord
index_parts << "using: #{index.using.inspect}" if index.using
index_parts << "type: #{index.type.inspect}" if index.type
index_parts << "opclasses: #{index.opclasses.inspect}" if index.opclasses.present?
- index_parts << "comment: #{index.comment.inspect}" if Gitlab.rails5? && index.comment
+ index_parts << "comment: #{index.comment.inspect}" if index.comment
index_parts
end
diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb
index a0b8b68f3ef..e02f0868e9f 100644
--- a/config/initializers/static_files.rb
+++ b/config/initializers/static_files.rb
@@ -1,26 +1,17 @@
app = Rails.application
-if (Gitlab.rails5? && app.config.public_file_server.enabled) || app.config.serve_static_files
+if app.config.public_file_server.enabled
# The `ActionDispatch::Static` middleware intercepts requests for static files
# by checking if they exist in the `/public` directory.
# We're replacing it with our `Gitlab::Middleware::Static` that does the same,
# except ignoring `/uploads`, letting those go through to the GitLab Rails app.
- if Gitlab.rails5?
- app.config.middleware.swap(
- ActionDispatch::Static,
- Gitlab::Middleware::Static,
- app.paths["public"].first,
- headers: app.config.public_file_server.headers
- )
- else
- app.config.middleware.swap(
- ActionDispatch::Static,
- Gitlab::Middleware::Static,
- app.paths["public"].first,
- app.config.static_cache_control
- )
- end
+ app.config.middleware.swap(
+ ActionDispatch::Static,
+ Gitlab::Middleware::Static,
+ app.paths["public"].first,
+ headers: app.config.public_file_server.headers
+ )
# If webpack-dev-server is configured, proxy webpack's public directory
# instead of looking for static assets
diff --git a/config/initializers/trusted_proxies.rb b/config/initializers/trusted_proxies.rb
index ca2eed664ed..7af465d8443 100644
--- a/config/initializers/trusted_proxies.rb
+++ b/config/initializers/trusted_proxies.rb
@@ -26,12 +26,10 @@ Rails.application.config.action_dispatch.trusted_proxies = (
# A monkey patch to make trusted proxies work with Rails 5.0.
# Inspired by https://github.com/rails/rails/issues/5223#issuecomment-263778719
# Remove this monkey patch when upstream is fixed.
-if Gitlab.rails5?
- module TrustedProxyMonkeyPatch
- def ip
- @ip ||= (get_header("action_dispatch.remote_ip") || super).to_s
- end
+module TrustedProxyMonkeyPatch
+ def ip
+ @ip ||= (get_header("action_dispatch.remote_ip") || super).to_s
end
-
- ActionDispatch::Request.send(:include, TrustedProxyMonkeyPatch)
end
+
+ActionDispatch::Request.send(:include, TrustedProxyMonkeyPatch)
diff --git a/config/routes/api.rb b/config/routes/api.rb
index b1aebf4d606..3719b7d3a1e 100644
--- a/config/routes/api.rb
+++ b/config/routes/api.rb
@@ -1,4 +1,4 @@
-constraints(::Constraints::FeatureConstrainer.new(:graphql)) do
+constraints(::Constraints::FeatureConstrainer.new(:graphql, default_enabled: true)) do
post '/api/graphql', to: 'graphql#execute'
mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql'
end
diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml
index 5985569bef4..3ee32678f34 100644
--- a/config/sidekiq_queues.yml
+++ b/config/sidekiq_queues.yml
@@ -84,3 +84,4 @@
- [object_pool, 1]
- [repository_cleanup, 1]
- [delete_stored_files, 1]
+ - [remote_mirror_notification, 2]