mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:54:23 +08:00
DEV: Bump rubocop_discourse (#29608)
This commit is contained in:
parent
ff494f2f94
commit
57f4176b57
|
@ -469,7 +469,7 @@ GEM
|
|||
parser (>= 3.3.1.0)
|
||||
rubocop-capybara (2.21.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-discourse (3.8.3)
|
||||
rubocop-discourse (3.8.4)
|
||||
activesupport (>= 6.1)
|
||||
rubocop (>= 1.59.0)
|
||||
rubocop-capybara (>= 2.0.0)
|
||||
|
|
|
@ -1300,7 +1300,7 @@ class UsersController < ApplicationController
|
|||
render json: to_render
|
||||
end
|
||||
|
||||
AVATAR_TYPES_WITH_UPLOAD ||= %w[uploaded custom gravatar]
|
||||
AVATAR_TYPES_WITH_UPLOAD = %w[uploaded custom gravatar]
|
||||
|
||||
def pick_avatar
|
||||
user = fetch_user_from_params
|
||||
|
|
|
@ -181,8 +181,8 @@ class Category < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
TOPIC_CREATION_PERMISSIONS ||= [:full]
|
||||
POST_CREATION_PERMISSIONS ||= %i[create_post full]
|
||||
TOPIC_CREATION_PERMISSIONS = [:full]
|
||||
POST_CREATION_PERMISSIONS = %i[create_post full]
|
||||
|
||||
scope :topic_create_allowed,
|
||||
->(guardian) do
|
||||
|
|
|
@ -975,7 +975,7 @@ class Post < ActiveRecord::Base
|
|||
.count
|
||||
end
|
||||
|
||||
MAX_REPLY_LEVEL ||= 1000
|
||||
MAX_REPLY_LEVEL = 1000
|
||||
|
||||
def reply_ids(guardian = nil, only_replies_to_single_post: true)
|
||||
builder = DB.build(<<~SQL)
|
||||
|
|
|
@ -8,7 +8,7 @@ class Upload < ActiveRecord::Base
|
|||
|
||||
SHA1_LENGTH = 40
|
||||
SEEDED_ID_THRESHOLD = 0
|
||||
URL_REGEX ||= %r{(/original/\dX[/\.\w]*/(\h+)[\.\w]*)}
|
||||
URL_REGEX = %r{(/original/\dX[/\.\w]*/(\h+)[\.\w]*)}
|
||||
MAX_IDENTIFY_SECONDS = 5
|
||||
DOMINANT_COLOR_COMMAND_TIMEOUT_SECONDS = 5
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class NotificationEmailer
|
|||
|
||||
private
|
||||
|
||||
EMAILABLE_POST_TYPES ||= Set.new [Post.types[:regular], Post.types[:whisper]]
|
||||
EMAILABLE_POST_TYPES = Set.new [Post.types[:regular], Post.types[:whisper]]
|
||||
|
||||
def enqueue(type, delay = default_delay)
|
||||
return if notification.user.user_option.email_level == UserOption.email_level_types[:never]
|
||||
|
|
|
@ -517,7 +517,7 @@ class PostAlerter
|
|||
end
|
||||
end
|
||||
|
||||
COLLAPSED_NOTIFICATION_TYPES ||= [
|
||||
COLLAPSED_NOTIFICATION_TYPES = [
|
||||
Notification.types[:replied],
|
||||
Notification.types[:posted],
|
||||
Notification.types[:private_message],
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/column_dropper"
|
||||
|
||||
class DropGroupLockedTrustLevelFromUser < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS ||= { posts: %i[group_locked_trust_level] }
|
||||
DROPPED_COLUMNS = { posts: %i[group_locked_trust_level] }
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/table_dropper"
|
||||
|
||||
class DropUnusedAuthTablesAgain < ActiveRecord::Migration[5.2]
|
||||
DROPPED_TABLES ||= %i[facebook_user_infos twitter_user_infos]
|
||||
DROPPED_TABLES = %i[facebook_user_infos twitter_user_infos]
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require "migration/table_dropper"
|
||||
|
||||
class DropGithubUserInfos < ActiveRecord::Migration[6.0]
|
||||
DROPPED_TABLES ||= %i[github_user_infos]
|
||||
DROPPED_TABLES = %i[github_user_infos]
|
||||
|
||||
def up
|
||||
DROPPED_TABLES.each { |table| Migration::TableDropper.execute_drop(table) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
class DropPasswordColumnsFromUsers < ActiveRecord::Migration[7.1]
|
||||
DROPPED_COLUMNS ||= { users: %i[password_hash salt password_algorithm] }
|
||||
DROPPED_COLUMNS = { users: %i[password_hash salt password_algorithm] }
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
# Modified version of: https://github.com/steventen/base62-rb
|
||||
|
||||
module Base62
|
||||
KEYS ||= "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
KEYS_HASH ||= KEYS.each_char.with_index.to_h
|
||||
BASE ||= KEYS.length
|
||||
KEYS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
KEYS_HASH = KEYS.each_char.with_index.to_h
|
||||
BASE = KEYS.length
|
||||
|
||||
# Encodes base10 (decimal) number to base62 string.
|
||||
def self.encode(num)
|
||||
|
|
|
@ -330,7 +330,7 @@ module Discourse
|
|||
end
|
||||
|
||||
# list of pixel ratios Discourse tries to optimize for
|
||||
PIXEL_RATIOS ||= [1, 1.5, 2, 3]
|
||||
PIXEL_RATIOS = [1, 1.5, 2, 3]
|
||||
|
||||
def self.avatar_sizes
|
||||
# TODO: should cache these when we get a notification system for site settings
|
||||
|
@ -477,7 +477,7 @@ module Discourse
|
|||
end
|
||||
end
|
||||
|
||||
BUILTIN_AUTH ||= [
|
||||
BUILTIN_AUTH = [
|
||||
Auth::AuthProvider.new(
|
||||
authenticator: Auth::FacebookAuthenticator.new,
|
||||
frame_width: 580,
|
||||
|
@ -864,7 +864,7 @@ module Discourse
|
|||
user ||= (system_user || User.admins.real.order(:id).first)
|
||||
end
|
||||
|
||||
SYSTEM_USER_ID ||= -1
|
||||
SYSTEM_USER_ID = -1
|
||||
|
||||
def self.system_user
|
||||
@system_users ||= {}
|
||||
|
@ -1042,7 +1042,7 @@ module Discourse
|
|||
warning
|
||||
end
|
||||
|
||||
SIDEKIQ_NAMESPACE ||= "sidekiq"
|
||||
SIDEKIQ_NAMESPACE = "sidekiq"
|
||||
|
||||
def self.sidekiq_redis_config
|
||||
conf = GlobalSetting.redis_config.dup
|
||||
|
@ -1182,7 +1182,7 @@ module Discourse
|
|||
ENV["RAILS_ENV"] == "test" && ENV["TEST_ENV_NUMBER"]
|
||||
end
|
||||
|
||||
CDN_REQUEST_METHODS ||= %w[GET HEAD OPTIONS]
|
||||
CDN_REQUEST_METHODS = %w[GET HEAD OPTIONS]
|
||||
|
||||
def self.is_cdn_request?(env, request_method)
|
||||
return if CDN_REQUEST_METHODS.exclude?(request_method)
|
||||
|
|
|
@ -189,8 +189,8 @@ module FileStore
|
|||
get_path_for("optimized", upload.id, upload.sha1, extension)
|
||||
end
|
||||
|
||||
CACHE_DIR ||= "#{Rails.root}/tmp/download_cache/"
|
||||
CACHE_MAXIMUM_SIZE ||= 500
|
||||
CACHE_DIR = "#{Rails.root}/tmp/download_cache/"
|
||||
CACHE_MAXIMUM_SIZE = 500
|
||||
|
||||
def get_cache_path_for(filename)
|
||||
"#{CACHE_DIR}#{filename}"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module HighlightJs
|
||||
HIGHLIGHTJS_DIR ||=
|
||||
HIGHLIGHTJS_DIR =
|
||||
"#{Rails.root}/app/assets/javascripts/discourse/node_modules/@highlightjs/cdn-assets/"
|
||||
VERSION ||= 1 # bump to invalidate caches following core changes
|
||||
VERSION = 1 # bump to invalidate caches following core changes
|
||||
|
||||
def self.languages
|
||||
langs = Dir.glob(HIGHLIGHTJS_DIR + "languages/*.js").map { |path| File.basename(path)[0..-8] }
|
||||
|
|
|
@ -388,7 +388,7 @@ class HtmlToMarkdown
|
|||
end
|
||||
end
|
||||
|
||||
HTML5_BLOCK_ELEMENTS ||= %w[
|
||||
HTML5_BLOCK_ELEMENTS = %w[
|
||||
article
|
||||
aside
|
||||
details
|
||||
|
|
|
@ -256,7 +256,7 @@ module JsLocaleHelper
|
|||
output
|
||||
end
|
||||
|
||||
MOMENT_LOCALE_MAPPING ||= { "hy" => "hy-am", "ug" => "ug-cn" }
|
||||
MOMENT_LOCALE_MAPPING = { "hy" => "hy-am", "ug" => "ug-cn" }
|
||||
|
||||
def self.find_moment_locale(locale_chain, timezone_names: false)
|
||||
if timezone_names
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
module Onebox
|
||||
module SanitizeConfig
|
||||
HTTP_PROTOCOLS ||= ["http", "https", :relative].freeze
|
||||
HTTP_PROTOCOLS = ["http", "https", :relative].freeze
|
||||
|
||||
ONEBOX ||=
|
||||
ONEBOX =
|
||||
Sanitize::Config.freeze_config(
|
||||
Sanitize::Config.merge(
|
||||
Sanitize::Config::RELAXED,
|
||||
|
|
|
@ -165,7 +165,7 @@ module Oneboxer
|
|||
doc
|
||||
end
|
||||
|
||||
HTML5_BLOCK_ELEMENTS ||= %w[
|
||||
HTML5_BLOCK_ELEMENTS = %w[
|
||||
address
|
||||
article
|
||||
aside
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PlainTextToMarkdown
|
||||
SIGNATURE_SEPARATOR ||= "-- "
|
||||
SIGNATURE_SEPARATOR = "-- "
|
||||
|
||||
def initialize(plaintext, opts = {})
|
||||
@plaintext = plaintext
|
||||
|
|
|
@ -459,7 +459,7 @@ class PostRevisor
|
|||
remove_flags_and_unhide_post
|
||||
end
|
||||
|
||||
USER_ACTIONS_TO_REMOVE ||= [UserAction::REPLY, UserAction::RESPONSE]
|
||||
USER_ACTIONS_TO_REMOVE = [UserAction::REPLY, UserAction::RESPONSE]
|
||||
|
||||
def update_post
|
||||
if @fields.has_key?("user_id") && @fields["user_id"] != @post.user_id && @post.user_id != nil
|
||||
|
|
|
@ -689,9 +689,9 @@ module PrettyText
|
|||
|
||||
private
|
||||
|
||||
USER_TYPE ||= "user"
|
||||
GROUP_TYPE ||= "group"
|
||||
GROUP_MENTIONABLE_TYPE ||= "group-mentionable"
|
||||
USER_TYPE = "user"
|
||||
GROUP_TYPE = "group"
|
||||
GROUP_MENTIONABLE_TYPE = "group-mentionable"
|
||||
|
||||
def self.add_mentions(doc, user_id: nil)
|
||||
elements = doc.css("span.mention")
|
||||
|
|
|
@ -23,7 +23,7 @@ class S3Helper
|
|||
# Controls the following:
|
||||
#
|
||||
# * presigned put_object URLs for direct S3 uploads
|
||||
UPLOAD_URL_EXPIRES_AFTER_SECONDS ||= 10.minutes.to_i
|
||||
UPLOAD_URL_EXPIRES_AFTER_SECONDS = 10.minutes.to_i
|
||||
|
||||
def initialize(s3_bucket_name, tombstone_prefix = "", options = {})
|
||||
@s3_client = options.delete(:client)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module SvgSprite
|
||||
SVG_ICONS ||=
|
||||
SVG_ICONS =
|
||||
Set.new(
|
||||
%w[
|
||||
address-book
|
||||
|
|
|
@ -7,18 +7,18 @@ require "nokogiri"
|
|||
require "open-uri"
|
||||
require "file_helper"
|
||||
|
||||
EMOJI_GROUPS_PATH ||= "lib/emoji/groups.json"
|
||||
EMOJI_GROUPS_PATH = "lib/emoji/groups.json"
|
||||
|
||||
EMOJI_DB_PATH ||= "lib/emoji/db.json"
|
||||
EMOJI_DB_PATH = "lib/emoji/db.json"
|
||||
|
||||
EMOJI_IMAGES_PATH ||= "public/images/emoji"
|
||||
EMOJI_IMAGES_PATH = "public/images/emoji"
|
||||
|
||||
EMOJI_ORDERING_URL ||= "http://www.unicode.org/emoji/charts/emoji-ordering.html"
|
||||
EMOJI_ORDERING_URL = "http://www.unicode.org/emoji/charts/emoji-ordering.html"
|
||||
|
||||
# emoji aliases are actually created as images
|
||||
# eg: "right_anger_bubble" => [ "anger_right" ]
|
||||
# your app will physically have right_anger_bubble.png and anger_right.png
|
||||
EMOJI_ALIASES ||= {
|
||||
EMOJI_ALIASES = {
|
||||
"right_anger_bubble" => ["anger_right"],
|
||||
"ballot_box" => ["ballot_box_with_ballot"],
|
||||
"basketball_man" => %w[basketball_player person_with_ball],
|
||||
|
@ -210,7 +210,7 @@ EMOJI_ALIASES ||= {
|
|||
"frowning_with_open_mouth" => ["frowning_face_with_open_mouth"],
|
||||
}
|
||||
|
||||
EMOJI_GROUPS ||= [
|
||||
EMOJI_GROUPS = [
|
||||
{ "name" => "smileys_&_emotion", "tabicon" => "grinning" },
|
||||
{ "name" => "people_&_body", "tabicon" => "wave" },
|
||||
{ "name" => "animals_&_nature", "tabicon" => "evergreen_tree" },
|
||||
|
@ -222,12 +222,12 @@ EMOJI_GROUPS ||= [
|
|||
{ "name" => "flags", "tabicon" => "checkered_flag" },
|
||||
]
|
||||
|
||||
FITZPATRICK_SCALE ||= %w[1f3fb 1f3fc 1f3fd 1f3fe 1f3ff]
|
||||
FITZPATRICK_SCALE = %w[1f3fb 1f3fc 1f3fd 1f3fe 1f3ff]
|
||||
|
||||
DEFAULT_SET ||= "twitter"
|
||||
DEFAULT_SET = "twitter"
|
||||
|
||||
# Replace the platform by another when downloading the image (accepts names or categories)
|
||||
EMOJI_IMAGES_PATCH ||= {
|
||||
EMOJI_IMAGES_PATCH = {
|
||||
"apple" => {
|
||||
"snowboarder" => "twitter",
|
||||
},
|
||||
|
@ -236,7 +236,7 @@ EMOJI_IMAGES_PATCH ||= {
|
|||
},
|
||||
}
|
||||
|
||||
EMOJI_SETS ||= {
|
||||
EMOJI_SETS = {
|
||||
"apple" => "apple",
|
||||
"google" => "google",
|
||||
"google_blob" => "google_classic",
|
||||
|
@ -245,11 +245,11 @@ EMOJI_SETS ||= {
|
|||
"windows" => "win10",
|
||||
}
|
||||
|
||||
EMOJI_DB_REPO ||= "git@github.com:xfalcox/emoji-db.git"
|
||||
EMOJI_DB_REPO = "git@github.com:xfalcox/emoji-db.git"
|
||||
|
||||
EMOJI_DB_REPO_PATH ||= File.join("tmp", "emoji-db")
|
||||
EMOJI_DB_REPO_PATH = File.join("tmp", "emoji-db")
|
||||
|
||||
GENERATED_PATH ||= File.join(EMOJI_DB_REPO_PATH, "generated")
|
||||
GENERATED_PATH = File.join(EMOJI_DB_REPO_PATH, "generated")
|
||||
|
||||
def search_aliases(emojis)
|
||||
# Format is search pattern => associated emojis
|
||||
|
|
|
@ -33,7 +33,7 @@ task "import:ensure_consistency" => :environment do
|
|||
log "Done!"
|
||||
end
|
||||
|
||||
MS_SPEND_CREATING_POST ||= 5000
|
||||
MS_SPEND_CREATING_POST = 5000
|
||||
|
||||
# -- TODO: We need to check the queries are actually adding/updating the necessary
|
||||
# data, post migration. The ON CONFLICT DO NOTHING may cause the clauses to be ignored
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
GEOLITE_DBS ||= %w[GeoLite2-City GeoLite2-ASN]
|
||||
GEOLITE_DBS = %w[GeoLite2-City GeoLite2-ASN]
|
||||
|
||||
desc "downloads MaxMind's GeoLite2-City databases"
|
||||
task "maxminddb:get" => "environment" do
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
DATE_REGEX ||= /\A\d{4}-\d{2}-\d{2}/
|
||||
DATE_REGEX = /\A\d{4}-\d{2}-\d{2}/
|
||||
|
||||
CHANGE_TYPES ||= [
|
||||
CHANGE_TYPES = [
|
||||
{ pattern: /\AFEATURE:/, heading: "New Features" },
|
||||
{ pattern: /\AFIX:/, heading: "Bug Fixes" },
|
||||
{ pattern: /\AUX:/, heading: "UX Changes" },
|
||||
|
|
|
@ -4,7 +4,7 @@ module Jobs
|
|||
class DiscourseAutomation::Tracker < ::Jobs::Scheduled
|
||||
every 1.minute
|
||||
|
||||
BATCH_LIMIT ||= 300
|
||||
BATCH_LIMIT = 300
|
||||
|
||||
def execute(_args = nil)
|
||||
return unless SiteSetting.discourse_automation_enabled
|
||||
|
|
|
@ -9,7 +9,7 @@ module Chat
|
|||
class SearchChatable
|
||||
include Service::Base
|
||||
|
||||
SEARCH_RESULT_LIMIT ||= 10
|
||||
SEARCH_RESULT_LIMIT = 10
|
||||
|
||||
# @!method self.call(guardian:, params:)
|
||||
# @param [Guardian] guardian
|
||||
|
|
|
@ -15,8 +15,8 @@ enabled_site_setting :discourse_local_dates_enabled
|
|||
|
||||
after_initialize do
|
||||
module ::DiscourseLocalDates
|
||||
PLUGIN_NAME ||= "discourse-local-dates".freeze
|
||||
POST_CUSTOM_FIELD ||= "local_dates".freeze
|
||||
PLUGIN_NAME = "discourse-local-dates".freeze
|
||||
POST_CUSTOM_FIELD = "local_dates".freeze
|
||||
end
|
||||
|
||||
require_relative "lib/discourse_local_dates/engine"
|
||||
|
|
|
@ -849,7 +849,7 @@ class BulkImport::Base
|
|||
|
||||
CHAT_DIRECT_MESSAGE_CHANNEL_COLUMNS = %i[id group created_at updated_at]
|
||||
|
||||
CHAT_CHANNEL_COLUMNS ||= %i[
|
||||
CHAT_CHANNEL_COLUMNS = %i[
|
||||
id
|
||||
name
|
||||
description
|
||||
|
@ -867,7 +867,7 @@ class BulkImport::Base
|
|||
threading_enabled
|
||||
]
|
||||
|
||||
USER_CHAT_CHANNEL_MEMBERSHIP_COLUMNS ||= %i[
|
||||
USER_CHAT_CHANNEL_MEMBERSHIP_COLUMNS = %i[
|
||||
chat_channel_id
|
||||
user_id
|
||||
created_at
|
||||
|
@ -881,9 +881,9 @@ class BulkImport::Base
|
|||
last_viewed_at
|
||||
]
|
||||
|
||||
DIRECT_MESSAGE_USER_COLUMNS ||= %i[direct_message_channel_id user_id created_at updated_at]
|
||||
DIRECT_MESSAGE_USER_COLUMNS = %i[direct_message_channel_id user_id created_at updated_at]
|
||||
|
||||
CHAT_THREAD_COLUMNS ||= %i[
|
||||
CHAT_THREAD_COLUMNS = %i[
|
||||
id
|
||||
channel_id
|
||||
original_message_id
|
||||
|
@ -895,7 +895,7 @@ class BulkImport::Base
|
|||
replies_count
|
||||
]
|
||||
|
||||
USER_CHAT_THREAD_MEMBERSHIP_COLUMNS ||= %i[
|
||||
USER_CHAT_THREAD_MEMBERSHIP_COLUMNS = %i[
|
||||
user_id
|
||||
thread_id
|
||||
notification_level
|
||||
|
@ -903,7 +903,7 @@ class BulkImport::Base
|
|||
updated_at
|
||||
]
|
||||
|
||||
CHAT_MESSAGE_COLUMNS ||= %i[
|
||||
CHAT_MESSAGE_COLUMNS = %i[
|
||||
id
|
||||
chat_channel_id
|
||||
user_id
|
||||
|
@ -919,9 +919,9 @@ class BulkImport::Base
|
|||
thread_id
|
||||
]
|
||||
|
||||
CHAT_MESSAGE_REACTION_COLUMNS ||= %i[chat_message_id user_id emoji created_at updated_at]
|
||||
CHAT_MESSAGE_REACTION_COLUMNS = %i[chat_message_id user_id emoji created_at updated_at]
|
||||
|
||||
CHAT_MENTION_COLUMNS ||= %i[chat_message_id target_id type created_at updated_at]
|
||||
CHAT_MENTION_COLUMNS = %i[chat_message_id target_id type created_at updated_at]
|
||||
|
||||
def create_groups(rows, &block)
|
||||
create_records(rows, "group", GROUP_COLUMNS, &block)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class BulkImport::DiscourseMerger < BulkImport::Base
|
||||
NOW ||= "now()"
|
||||
NOW = "now()"
|
||||
CUSTOM_FIELDS = %w[category group post topic user]
|
||||
|
||||
# DB_NAME: name of database being merged into the current local db
|
||||
|
|
|
@ -6,8 +6,8 @@ require "htmlentities"
|
|||
require "ruby-bbcode-to-md"
|
||||
|
||||
class BulkImport::PhpBB < BulkImport::Base
|
||||
SUSPENDED_TILL ||= Date.new(3000, 1, 1)
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "phpbb_"
|
||||
SUSPENDED_TILL = Date.new(3000, 1, 1)
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "phpbb_"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -14,7 +14,7 @@ class BulkImport::Vanilla < BulkImport::Base
|
|||
BATCH_SIZE = 1000
|
||||
CONVERT_HTML = true
|
||||
|
||||
SUSPENDED_TILL ||= Date.new(3000, 1, 1)
|
||||
SUSPENDED_TILL = Date.new(3000, 1, 1)
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -6,10 +6,10 @@ require "htmlentities"
|
|||
require "parallel"
|
||||
|
||||
class BulkImport::VBulletin < BulkImport::Base
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "vb_"
|
||||
SUSPENDED_TILL ||= Date.new(3000, 1, 1)
|
||||
ATTACHMENT_DIR ||= ENV["ATTACHMENT_DIR"] || "/shared/import/data/attachments"
|
||||
AVATAR_DIR ||= ENV["AVATAR_DIR"] || "/shared/import/data/customavatars"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "vb_"
|
||||
SUSPENDED_TILL = Date.new(3000, 1, 1)
|
||||
ATTACHMENT_DIR = ENV["ATTACHMENT_DIR"] || "/shared/import/data/attachments"
|
||||
AVATAR_DIR = ENV["AVATAR_DIR"] || "/shared/import/data/customavatars"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -9,9 +9,9 @@ require "find"
|
|||
|
||||
class BulkImport::VBulletin5 < BulkImport::Base
|
||||
DB_PREFIX = ""
|
||||
SUSPENDED_TILL ||= Date.new(3000, 1, 1)
|
||||
ATTACH_DIR ||= ENV["ATTACH_DIR"] || "/shared/import/data/attachments"
|
||||
AVATAR_DIR ||= ENV["AVATAR_DIR"] || "/shared/import/data/customavatars"
|
||||
SUSPENDED_TILL = Date.new(3000, 1, 1)
|
||||
ATTACH_DIR = ENV["ATTACH_DIR"] || "/shared/import/data/attachments"
|
||||
AVATAR_DIR = ENV["AVATAR_DIR"] || "/shared/import/data/customavatars"
|
||||
ROOT_NODE = 2
|
||||
|
||||
def initialize
|
||||
|
|
|
@ -10,11 +10,11 @@ require "mysql2"
|
|||
require "open-uri"
|
||||
|
||||
class ImportScripts::AnswerHub < ImportScripts::Base
|
||||
DB_NAME ||= ENV["DB_NAME"] || "answerhub"
|
||||
DB_PASS ||= ENV["DB_PASS"] || "answerhub"
|
||||
DB_USER ||= ENV["DB_USER"] || "answerhub"
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "network1"
|
||||
BATCH_SIZE ||= ENV["BATCH_SIZE"].to_i || 1000
|
||||
DB_NAME = ENV["DB_NAME"] || "answerhub"
|
||||
DB_PASS = ENV["DB_PASS"] || "answerhub"
|
||||
DB_USER = ENV["DB_USER"] || "answerhub"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "network1"
|
||||
BATCH_SIZE = ENV["BATCH_SIZE"].to_i || 1000
|
||||
ATTACHMENT_DIR = ENV["ATTACHMENT_DIR"] || ""
|
||||
PROCESS_UPLOADS = ENV["PROCESS_UPLOADS"].to_i || 0
|
||||
ANSWERHUB_DOMAIN = ENV["ANSWERHUB_DOMAIN"]
|
||||
|
|
|
@ -586,7 +586,7 @@ class ImportScripts::Base
|
|||
[created, skipped]
|
||||
end
|
||||
|
||||
STAFF_GUARDIAN ||= Guardian.new(Discourse.system_user)
|
||||
STAFF_GUARDIAN = Guardian.new(Discourse.system_user)
|
||||
|
||||
def create_post(opts, import_id)
|
||||
user = User.find(opts[:user_id])
|
||||
|
|
|
@ -4,13 +4,13 @@ require "mysql2"
|
|||
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
||||
|
||||
class ImportScripts::Bbpress < ImportScripts::Base
|
||||
BB_PRESS_HOST ||= ENV["BBPRESS_HOST"] || "localhost"
|
||||
BB_PRESS_DB ||= ENV["BBPRESS_DB"] || "bbpress"
|
||||
BATCH_SIZE ||= 1000
|
||||
BB_PRESS_PW ||= ENV["BBPRESS_PW"] || ""
|
||||
BB_PRESS_USER ||= ENV["BBPRESS_USER"] || "root"
|
||||
BB_PRESS_PREFIX ||= ENV["BBPRESS_PREFIX"] || "wp_"
|
||||
BB_PRESS_ATTACHMENTS_DIR ||= ENV["BBPRESS_ATTACHMENTS_DIR"] || "/path/to/attachments"
|
||||
BB_PRESS_HOST = ENV["BBPRESS_HOST"] || "localhost"
|
||||
BB_PRESS_DB = ENV["BBPRESS_DB"] || "bbpress"
|
||||
BATCH_SIZE = 1000
|
||||
BB_PRESS_PW = ENV["BBPRESS_PW"] || ""
|
||||
BB_PRESS_USER = ENV["BBPRESS_USER"] || "root"
|
||||
BB_PRESS_PREFIX = ENV["BBPRESS_PREFIX"] || "wp_"
|
||||
BB_PRESS_ATTACHMENTS_DIR = ENV["BBPRESS_ATTACHMENTS_DIR"] || "/path/to/attachments"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -10,7 +10,7 @@ class ImportScripts::CsvRestoreStagedUsers < ImportScripts::Base
|
|||
CSV_CUSTOM_FIELDS = ENV["CSV_CUSTOM_FIELDS"]
|
||||
CSV_EMAILS = ENV["CSV_EMAILS"]
|
||||
|
||||
BATCH_SIZE ||= 1000
|
||||
BATCH_SIZE = 1000
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -4,7 +4,7 @@ require "mysql2"
|
|||
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
||||
|
||||
class ImportScripts::Elgg < ImportScripts::Base
|
||||
BATCH_SIZE ||= 1000
|
||||
BATCH_SIZE = 1000
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -8,11 +8,11 @@ require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
|||
|
||||
class ImportScripts::FLARUM < ImportScripts::Base
|
||||
#SET THE APPROPRIATE VALUES FOR YOUR MYSQL CONNECTION
|
||||
FLARUM_HOST ||= ENV["FLARUM_HOST"] || "db_host"
|
||||
FLARUM_DB ||= ENV["FLARUM_DB"] || "db_name"
|
||||
BATCH_SIZE ||= 1000
|
||||
FLARUM_USER ||= ENV["FLARUM_USER"] || "db_user"
|
||||
FLARUM_PW ||= ENV["FLARUM_PW"] || "db_user_pass"
|
||||
FLARUM_HOST = ENV["FLARUM_HOST"] || "db_host"
|
||||
FLARUM_DB = ENV["FLARUM_DB"] || "db_name"
|
||||
BATCH_SIZE = 1000
|
||||
FLARUM_USER = ENV["FLARUM_USER"] || "db_user"
|
||||
FLARUM_PW = ENV["FLARUM_PW"] || "db_user_pass"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -17,12 +17,12 @@ export FLUXBB_PREFIX=""
|
|||
# Call it like this:
|
||||
# RAILS_ENV=production bundle exec ruby script/import_scripts/fluxbb.rb
|
||||
class ImportScripts::FluxBB < ImportScripts::Base
|
||||
FLUXBB_HOST ||= ENV["FLUXBB_HOST"] || "localhost"
|
||||
FLUXBB_DB ||= ENV["FLUXBB_DB"] || "fluxbb"
|
||||
BATCH_SIZE ||= 1000
|
||||
FLUXBB_USER ||= ENV["FLUXBB_USER"] || "root"
|
||||
FLUXBB_PW ||= ENV["FLUXBB_PW"] || ""
|
||||
FLUXBB_PREFIX ||= ENV["FLUXBB_PREFIX"] || ""
|
||||
FLUXBB_HOST = ENV["FLUXBB_HOST"] || "localhost"
|
||||
FLUXBB_DB = ENV["FLUXBB_DB"] || "fluxbb"
|
||||
BATCH_SIZE = 1000
|
||||
FLUXBB_USER = ENV["FLUXBB_USER"] || "root"
|
||||
FLUXBB_PW = ENV["FLUXBB_PW"] || ""
|
||||
FLUXBB_PREFIX = ENV["FLUXBB_PREFIX"] || ""
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -32,23 +32,23 @@ export USERDIR="user"
|
|||
=end
|
||||
|
||||
class ImportScripts::IpboardSQL < ImportScripts::Base
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "ipboard"
|
||||
DB_PW ||= ENV["DB_PW"] || "ipboard"
|
||||
DB_USER ||= ENV["DB_USER"] || "ipboard"
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "ipb_"
|
||||
IMPORT_AFTER ||= ENV["IMPORT_AFTER"] || "1970-01-01"
|
||||
UPLOADS ||= ENV["UPLOADS"] || "http://UPLOADS+LOCATION+IS+NOT+SET/uploads"
|
||||
USERDIR ||= ENV["USERDIR"] || "user"
|
||||
URL ||= ENV["URL"] || "https://forum.example.com"
|
||||
AVATARS_DIR ||= ENV["AVATARS_DIR"] || "/home/pfaffman/data/example.com/avatars/"
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "ipboard"
|
||||
DB_PW = ENV["DB_PW"] || "ipboard"
|
||||
DB_USER = ENV["DB_USER"] || "ipboard"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "ipb_"
|
||||
IMPORT_AFTER = ENV["IMPORT_AFTER"] || "1970-01-01"
|
||||
UPLOADS = ENV["UPLOADS"] || "http://UPLOADS+LOCATION+IS+NOT+SET/uploads"
|
||||
USERDIR = ENV["USERDIR"] || "user"
|
||||
URL = ENV["URL"] || "https://forum.example.com"
|
||||
AVATARS_DIR = ENV["AVATARS_DIR"] || "/home/pfaffman/data/example.com/avatars/"
|
||||
BATCH_SIZE = 1000
|
||||
ID_FIRST = true
|
||||
QUIET = true
|
||||
DEBUG = false
|
||||
GALLERY_CAT_ID = 1_234_567
|
||||
GALLERY_CAT_NAME = "galeria"
|
||||
EMO_DIR ||= ENV["EMO_DIR"] || "default"
|
||||
EMO_DIR = ENV["EMO_DIR"] || "default"
|
||||
OLD_FORMAT = false
|
||||
if OLD_FORMAT
|
||||
MEMBERS_TABLE = "#{TABLE_PREFIX}core_members"
|
||||
|
|
|
@ -5,8 +5,8 @@ require "reverse_markdown"
|
|||
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
||||
|
||||
class ImportScripts::IPBoard3 < ImportScripts::Base
|
||||
BATCH_SIZE ||= 5000
|
||||
UPLOADS_DIR ||= "/path/to/uploads"
|
||||
BATCH_SIZE = 5000
|
||||
UPLOADS_DIR = "/path/to/uploads"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -5,7 +5,7 @@ require_relative "base"
|
|||
|
||||
class ImportScripts::JForum < ImportScripts::Base
|
||||
BATCH_SIZE = 1000
|
||||
REMOTE_AVATAR_REGEX ||= %r{\Ahttps?://}i
|
||||
REMOTE_AVATAR_REGEX = %r{\Ahttps?://}i
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -7,11 +7,11 @@ require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
|||
# https://developers.jivesoftware.com/api/v3/cloud/rest/index.html
|
||||
|
||||
class ImportScripts::JiveApi < ImportScripts::Base
|
||||
USER_COUNT ||= 1000
|
||||
POST_COUNT ||= 100
|
||||
STAFF_GUARDIAN ||= Guardian.new(Discourse.system_user)
|
||||
USER_COUNT = 1000
|
||||
POST_COUNT = 100
|
||||
STAFF_GUARDIAN = Guardian.new(Discourse.system_user)
|
||||
|
||||
TO_IMPORT ||= [
|
||||
TO_IMPORT = [
|
||||
#############################
|
||||
# WHOLE CATEGORY OF CONTENT #
|
||||
#############################
|
||||
|
|
|
@ -7,7 +7,7 @@ require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
|||
|
||||
class ImportScripts::JsonGeneric < ImportScripts::Base
|
||||
JSON_FILE_PATH = ENV["JSON_FILE"]
|
||||
BATCH_SIZE ||= 1000
|
||||
BATCH_SIZE = 1000
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -19,13 +19,13 @@ export PARENT_FIELD="parent_id" # "parent" in some versions
|
|||
=end
|
||||
|
||||
class ImportScripts::Kunena < ImportScripts::Base
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "kunena"
|
||||
DB_USER ||= ENV["DB_USER"] || "kunena"
|
||||
DB_PW ||= ENV["DB_PW"] || "kunena"
|
||||
KUNENA_PREFIX ||= ENV["KUNENA_PREFIX"] || "jos_" # "iff_" sometimes
|
||||
IMAGE_PREFIX ||= ENV["IMAGE_PREFIX"] || "http://EXAMPLE.com/media/kunena/attachments"
|
||||
PARENT_FIELD ||= ENV["PARENT_FIELD"] || "parent_id" # "parent" in some versions
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "kunena"
|
||||
DB_USER = ENV["DB_USER"] || "kunena"
|
||||
DB_PW = ENV["DB_PW"] || "kunena"
|
||||
KUNENA_PREFIX = ENV["KUNENA_PREFIX"] || "jos_" # "iff_" sometimes
|
||||
IMAGE_PREFIX = ENV["IMAGE_PREFIX"] || "http://EXAMPLE.com/media/kunena/attachments"
|
||||
PARENT_FIELD = ENV["PARENT_FIELD"] || "parent_id" # "parent" in some versions
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -9,15 +9,15 @@ class ImportScripts::Modx < ImportScripts::Base
|
|||
|
||||
# CHANGE THESE BEFORE RUNNING THE IMPORTER
|
||||
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "modx"
|
||||
DB_PW ||= ENV["DB_PW"] || "modex"
|
||||
DB_USER ||= ENV["DB_USER"] || "modx"
|
||||
TIMEZONE ||= ENV["TIMEZONE"] || "America/Los_Angeles"
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "modx_"
|
||||
ATTACHMENT_DIR ||= ENV["ATTACHMENT_DIR"] || "/path/to/your/attachment/folder"
|
||||
RANDOM_CATEGORY_COLOR ||= !ENV["RANDOM_CATEGORY_COLOR"].nil?
|
||||
SUSPEND_ALL_USERS ||= !ENV["SUSPEND_ALL_USERS"]
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "modx"
|
||||
DB_PW = ENV["DB_PW"] || "modex"
|
||||
DB_USER = ENV["DB_USER"] || "modx"
|
||||
TIMEZONE = ENV["TIMEZONE"] || "America/Los_Angeles"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "modx_"
|
||||
ATTACHMENT_DIR = ENV["ATTACHMENT_DIR"] || "/path/to/your/attachment/folder"
|
||||
RANDOM_CATEGORY_COLOR = !ENV["RANDOM_CATEGORY_COLOR"].nil?
|
||||
SUSPEND_ALL_USERS = !ENV["SUSPEND_ALL_USERS"]
|
||||
|
||||
# TODO: replace modx_ with #{TABLE_PREFIX}
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ export BASE="" #
|
|||
# Call it like this:
|
||||
# RAILS_ENV=production ruby script/import_scripts/mybb.rb
|
||||
class ImportScripts::MyBB < ImportScripts::Base
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "mybb"
|
||||
DB_PW ||= ENV["DB_PW"] || ""
|
||||
DB_USER ||= ENV["DB_USER"] || "root"
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "mybb_"
|
||||
UPLOADS_DIR ||= ENV["UPLOADS"] || "/data/limelightgaming/uploads"
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "mybb"
|
||||
DB_PW = ENV["DB_PW"] || ""
|
||||
DB_USER = ENV["DB_USER"] || "root"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "mybb_"
|
||||
UPLOADS_DIR = ENV["UPLOADS"] || "/data/limelightgaming/uploads"
|
||||
BATCH_SIZE = 1000
|
||||
BASE = ""
|
||||
QUIET = true
|
||||
|
|
|
@ -9,8 +9,8 @@ require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
|||
# If your forum has non-English usernames, don't forget to enable Unicode usernames in /admin/site_settings
|
||||
|
||||
class ImportScripts::MybbRu < ImportScripts::Base
|
||||
JSON_TOPICS_FILE_PATH ||= ENV["JSON_TOPICS_FILE"] || "mybbru_export/threads.json"
|
||||
JSON_USERS_FILE_PATH ||= ENV["JSON_USERS_FILE"] || "mybbru_export/users.json"
|
||||
JSON_TOPICS_FILE_PATH = ENV["JSON_TOPICS_FILE"] || "mybbru_export/threads.json"
|
||||
JSON_USERS_FILE_PATH = ENV["JSON_USERS_FILE"] || "mybbru_export/users.json"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -18,14 +18,14 @@ export BASE="forum"
|
|||
=end
|
||||
|
||||
class ImportScripts::MylittleforumSQL < ImportScripts::Base
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "mylittleforum"
|
||||
DB_PW ||= ENV["DB_PW"] || ""
|
||||
DB_USER ||= ENV["DB_USER"] || "root"
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "forum_"
|
||||
IMPORT_AFTER ||= ENV["IMPORT_AFTER"] || "1970-01-01"
|
||||
IMAGE_BASE ||= ENV["IMAGE_BASE"] || ""
|
||||
BASE ||= ENV["BASE"] || "forum/"
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "mylittleforum"
|
||||
DB_PW = ENV["DB_PW"] || ""
|
||||
DB_USER = ENV["DB_USER"] || "root"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "forum_"
|
||||
IMPORT_AFTER = ENV["IMPORT_AFTER"] || "1970-01-01"
|
||||
IMAGE_BASE = ENV["IMAGE_BASE"] || ""
|
||||
BASE = ENV["BASE"] || "forum/"
|
||||
BATCH_SIZE = 1000
|
||||
CONVERT_HTML = true
|
||||
QUIET = nil || ENV["VERBOSE"] == "TRUE"
|
||||
|
|
|
@ -10,12 +10,12 @@ class ImportScripts::Question2Answer < ImportScripts::Base
|
|||
|
||||
# CHANGE THESE BEFORE RUNNING THE IMPORTER
|
||||
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "qa_db"
|
||||
DB_PW ||= ENV["DB_PW"] || ""
|
||||
DB_USER ||= ENV["DB_USER"] || "root"
|
||||
TIMEZONE ||= ENV["TIMEZONE"] || "America/Los_Angeles"
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "qa_"
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "qa_db"
|
||||
DB_PW = ENV["DB_PW"] || ""
|
||||
DB_USER = ENV["DB_USER"] || "root"
|
||||
TIMEZONE = ENV["TIMEZONE"] || "America/Los_Angeles"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "qa_"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -4,9 +4,9 @@ require "mysql2"
|
|||
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
||||
|
||||
class ImportScripts::SimplePress < ImportScripts::Base
|
||||
SIMPLE_PRESS_DB ||= ENV["SIMPLEPRESS_DB"] || "simplepress"
|
||||
SIMPLE_PRESS_DB = ENV["SIMPLEPRESS_DB"] || "simplepress"
|
||||
TABLE_PREFIX = "wp_sf"
|
||||
BATCH_SIZE ||= 1000
|
||||
BATCH_SIZE = 1000
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -5,9 +5,9 @@ require "htmlentities"
|
|||
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
||||
|
||||
class ImportScripts::Smf1 < ImportScripts::Base
|
||||
BATCH_SIZE ||= 5000
|
||||
UPLOADS_DIR ||= ENV["UPLOADS_DIR"].presence
|
||||
FORUM_URL ||= ENV["FORUM_URL"].presence
|
||||
BATCH_SIZE = 5000
|
||||
UPLOADS_DIR = ENV["UPLOADS_DIR"].presence
|
||||
FORUM_URL = ENV["FORUM_URL"].presence
|
||||
|
||||
def initialize
|
||||
fail "UPLOADS_DIR env variable is required (example: '/path/to/attachments')" unless UPLOADS_DIR
|
||||
|
@ -492,7 +492,7 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
|||
end
|
||||
end
|
||||
|
||||
FEEDBACKS ||= -"feedbacks"
|
||||
FEEDBACKS = -"feedbacks"
|
||||
|
||||
def import_feedbacks
|
||||
return if mysql_query("SHOW TABLES LIKE 'smf_feedback'").first.nil?
|
||||
|
@ -613,7 +613,7 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
|||
ScreenedIpAddress.roll_up
|
||||
end
|
||||
|
||||
IGNORED_BBCODE ||= %w[
|
||||
IGNORED_BBCODE = %w[
|
||||
black
|
||||
blue
|
||||
center
|
||||
|
|
|
@ -417,7 +417,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
|||
end
|
||||
end
|
||||
|
||||
IGNORED_BBCODE ||= %w[
|
||||
IGNORED_BBCODE = %w[
|
||||
black
|
||||
blue
|
||||
center
|
||||
|
|
|
@ -5,7 +5,7 @@ require "tiny_tds"
|
|||
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
|
||||
|
||||
class ImportScripts::StackOverflow < ImportScripts::Base
|
||||
BATCH_SIZE ||= 1000
|
||||
BATCH_SIZE = 1000
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -39,19 +39,19 @@ require "tiny_tds"
|
|||
# }
|
||||
|
||||
class ImportScripts::Telligent < ImportScripts::Base
|
||||
BATCH_SIZE ||= 1000
|
||||
LOCAL_AVATAR_REGEX ||=
|
||||
BATCH_SIZE = 1000
|
||||
LOCAL_AVATAR_REGEX =
|
||||
%r{\A~/.*(?<directory>communityserver-components-(?:selectable)?avatars)/(?<path>[^/]+)/(?<filename>.+)}i
|
||||
REMOTE_AVATAR_REGEX ||= %r{\Ahttps?://}i
|
||||
ATTACHMENT_REGEXES ||= [
|
||||
REMOTE_AVATAR_REGEX = %r{\Ahttps?://}i
|
||||
ATTACHMENT_REGEXES = [
|
||||
%r{<a[^>]*\shref="[^"]*?/cfs-file(?:systemfile)?(?:\.ashx)?/__key/(?<directory>[^/]+)/(?<path>[^/]+)/(?<filename>.+?)".*?>.*?</a>}i,
|
||||
%r{<img[^>]*\ssrc="[^"]*?/cfs-file(?:systemfile)?(?:\.ashx)?/__key/(?<directory>[^/]+)/(?<path>[^/]+)/(?<filename>.+?)".*?>}i,
|
||||
%r{\[View:[^\]]*?/cfs-file(?:systemfile)?(?:\.ashx)?/__key/(?<directory>[^/]+)/(?<path>[^/]+)/(?<filename>.+?)(?:\:[:\d\s]*?)?\]}i,
|
||||
%r{\[(?<tag>img|url)\][^\[]*?cfs-file(?:systemfile)?(?:\.ashx)?/__key/(?<directory>[^/]+)/(?<path>[^/]+)/(?<filename>.+?)\[/\k<tag>\]}i,
|
||||
%r{\[(?<tag>img|url)=[^\[]*?cfs-file(?:systemfile)?(?:\.ashx)?/__key/(?<directory>[^/]+)/(?<path>[^/]+)/(?<filename>.+?)\][^\[]*?\[/\k<tag>\]}i,
|
||||
]
|
||||
PROPERTY_NAMES_REGEX ||= /(?<name>\w+):S:(?<start>\d+):(?<length>\d+):/
|
||||
INTERNAL_LINK_REGEX ||=
|
||||
PROPERTY_NAMES_REGEX = /(?<name>\w+):S:(?<start>\d+):(?<length>\d+):/
|
||||
INTERNAL_LINK_REGEX =
|
||||
%r{\shref=".*?/f/\d+(?:(/t/(?<topic_id>\d+))|(?:/p/\d+/(?<post_id>\d+))|(?:/p/(?<post_id>\d+)/reply))\.aspx[^"]*?"}i
|
||||
|
||||
CATEGORY_LINK_NORMALIZATION = '/.*?(f\/\d+)$/\1'
|
||||
|
|
|
@ -23,13 +23,13 @@ class ImportScripts::VBulletin < ImportScripts::Base
|
|||
|
||||
# CHANGE THESE BEFORE RUNNING THE IMPORTER
|
||||
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "vbulletin"
|
||||
DB_PW ||= ENV["DB_PW"] || ""
|
||||
DB_USER ||= ENV["DB_USER"] || "root"
|
||||
TIMEZONE ||= ENV["TIMEZONE"] || "America/Los_Angeles"
|
||||
TABLE_PREFIX ||= ENV["TABLE_PREFIX"] || "vb_"
|
||||
ATTACHMENT_DIR ||= ENV["ATTACHMENT_DIR"] || "/path/to/your/attachment/folder"
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "vbulletin"
|
||||
DB_PW = ENV["DB_PW"] || ""
|
||||
DB_USER = ENV["DB_USER"] || "root"
|
||||
TIMEZONE = ENV["TIMEZONE"] || "America/Los_Angeles"
|
||||
TABLE_PREFIX = ENV["TABLE_PREFIX"] || "vb_"
|
||||
ATTACHMENT_DIR = ENV["ATTACHMENT_DIR"] || "/path/to/your/attachment/folder"
|
||||
|
||||
puts "#{DB_USER}:#{DB_PW}@#{DB_HOST} wants #{DB_NAME}"
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ class ImportScripts::VBulletin < ImportScripts::Base
|
|||
|
||||
# override these using environment vars
|
||||
|
||||
URL_PREFIX ||= ENV["URL_PREFIX"] || "forum/"
|
||||
DB_PREFIX ||= ENV["DB_PREFIX"] || "vb_"
|
||||
DB_HOST ||= ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME ||= ENV["DB_NAME"] || "vbulletin"
|
||||
DB_PASS ||= ENV["DB_PASS"] || "password"
|
||||
DB_USER ||= ENV["DB_USER"] || "username"
|
||||
ATTACH_DIR ||= ENV["ATTACH_DIR"] || "/home/discourse/vbulletin/attach"
|
||||
AVATAR_DIR ||= ENV["AVATAR_DIR"] || "/home/discourse/vbulletin/avatars"
|
||||
URL_PREFIX = ENV["URL_PREFIX"] || "forum/"
|
||||
DB_PREFIX = ENV["DB_PREFIX"] || "vb_"
|
||||
DB_HOST = ENV["DB_HOST"] || "localhost"
|
||||
DB_NAME = ENV["DB_NAME"] || "vbulletin"
|
||||
DB_PASS = ENV["DB_PASS"] || "password"
|
||||
DB_USER = ENV["DB_USER"] || "username"
|
||||
ATTACH_DIR = ENV["ATTACH_DIR"] || "/home/discourse/vbulletin/attach"
|
||||
AVATAR_DIR = ENV["AVATAR_DIR"] || "/home/discourse/vbulletin/avatars"
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DropEmailLogs < ActiveRecord::Migration[5.2]
|
||||
DROPPED_TABLES ||= %i[email_logs]
|
||||
DROPPED_TABLES = %i[email_logs]
|
||||
|
||||
def change
|
||||
drop_table :email_logs
|
||||
|
|
|
@ -174,8 +174,8 @@ RSpec.describe HtmlToMarkdown do
|
|||
expect(html_to_markdown(%Q{<a href="foo.bar">Discourse</a>})).to eq("Discourse")
|
||||
end
|
||||
|
||||
HTML_WITH_IMG ||= %Q{<img src="https://www.discourse.org/logo.svg" alt="Discourse Logo">}
|
||||
HTML_WITH_CID_IMG ||= %Q{<img src="cid:ii_1525434659ddb4cb" title="Discourse Logo">}
|
||||
HTML_WITH_IMG = %Q{<img src="https://www.discourse.org/logo.svg" alt="Discourse Logo">}
|
||||
HTML_WITH_CID_IMG = %Q{<img src="cid:ii_1525434659ddb4cb" title="Discourse Logo">}
|
||||
|
||||
it "converts <img>" do
|
||||
expect(html_to_markdown(HTML_WITH_IMG)).to eq(
|
||||
|
|
Loading…
Reference in New Issue
Block a user