Make import scripts work with frozen strings
This commit is contained in:
parent
c70d0c6659
commit
0f3c3bc309
|
@ -255,7 +255,7 @@ class ImportScripts::Answerbase < ImportScripts::Base
|
|||
upload = @uploader.create_upload(user_id, path, filename)
|
||||
|
||||
if upload.present? && upload.persisted? && !upload_ids.include?(upload.id)
|
||||
raw << "\n" << @uploader.html_for_upload(upload, filename)
|
||||
raw = "#{raw}\n#{@uploader.html_for_upload(upload, filename)}"
|
||||
end
|
||||
else
|
||||
STDERR.puts "Could not find file: #{path}"
|
||||
|
|
|
@ -239,7 +239,7 @@ class ImportScripts::MyAskBot < ImportScripts::Base
|
|||
# ask.cvxr.com/question/(\d+)/[^'"}]*
|
||||
# I am sure this is incomplete, but we didn't make heavy use of internal
|
||||
# links on our site.
|
||||
tmp = Regexp.quote("http://" << OLD_SITE)
|
||||
tmp = Regexp.quote("http://#{OLD_SITE}")
|
||||
r1 = /"(#{tmp})?\/question\/(\d+)\/[a-zA-Z-]*\/?"/
|
||||
r2 = /\((#{tmp})?\/question\/(\d+)\/[a-zA-Z-]*\/?\)/
|
||||
r3 = /<?#tmp\/question\/(\d+)\/[a-zA-Z-]*\/?>?/
|
||||
|
|
|
@ -24,7 +24,7 @@ module ImportScripts
|
|||
first = true
|
||||
row = nil
|
||||
|
||||
current_row = ""
|
||||
current_row = +""
|
||||
double_quote_count = 0
|
||||
|
||||
File.open(filename).each_line do |line|
|
||||
|
|
|
@ -67,7 +67,7 @@ class ImportScripts::Bespoke < ImportScripts::Base
|
|||
first = true
|
||||
row = nil
|
||||
|
||||
current_row = ""
|
||||
current_row = +""
|
||||
double_quote_count = 0
|
||||
|
||||
File.open(filename).each_line do |line|
|
||||
|
|
|
@ -787,7 +787,7 @@ class ImportScripts::DiscuzX < ImportScripts::Base
|
|||
FROM #{table_name 'forum_attachment'}
|
||||
WHERE pid = #{post.custom_fields['import_id']}"
|
||||
if !inline_attachments.empty?
|
||||
sql << " AND aid NOT IN (#{inline_attachments.join(',')})"
|
||||
sql = "#{sql} AND aid NOT IN (#{inline_attachments.join(',')})"
|
||||
end
|
||||
|
||||
results = mysql_query(sql)
|
||||
|
|
|
@ -69,7 +69,7 @@ class ImportScripts::Jive < ImportScripts::Base
|
|||
first = true
|
||||
row = nil
|
||||
|
||||
current_row = ""
|
||||
current_row = +""
|
||||
double_quote_count = 0
|
||||
|
||||
File.open(filename).each_line do |line|
|
||||
|
|
|
@ -129,7 +129,7 @@ class ImportScripts::JiveApi < ImportScripts::Base
|
|||
filters = "filter=entityDescriptor(#{entities.join(",")})"
|
||||
else
|
||||
path = "places/#{place["placeID"]}/contents"
|
||||
filters = "filter=status(published)"
|
||||
filters = +"filter=status(published)"
|
||||
if to_import[:filters]
|
||||
filters << "&filter=type(#{to_import[:filters][:type]})" if to_import[:filters][:type].present?
|
||||
filters << "&filter=creationDate(null,#{to_import[:filters][:created_after].strftime("%Y-%m-%dT%TZ")})" if to_import[:filters][:created_after].present?
|
||||
|
|
|
@ -1021,7 +1021,7 @@ SQL
|
|||
end
|
||||
|
||||
def html_for_attachments(user_id, files)
|
||||
html = ""
|
||||
html = +""
|
||||
|
||||
files.each do |file|
|
||||
upload, filename = find_upload(user_id, file["attachment_id"], file["file_name"])
|
||||
|
|
|
@ -137,7 +137,7 @@ module ImportScripts::Mbox
|
|||
body = receiver.add_attachments(body, user)
|
||||
end
|
||||
|
||||
body << Email::Receiver.elided_html(elided) if elided.present?
|
||||
body = "#{body}#{Email::Receiver.elided_html(elided)}" if elided.present?
|
||||
body
|
||||
end
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ module ImportScripts::Mbox
|
|||
end
|
||||
|
||||
def each_mail(filename)
|
||||
raw_message = ''
|
||||
raw_message = +''
|
||||
first_line_number = 1
|
||||
last_line_number = 0
|
||||
|
||||
|
@ -165,7 +165,7 @@ module ImportScripts::Mbox
|
|||
if line =~ @split_regex
|
||||
if last_line_number > 0
|
||||
yield raw_message, first_line_number, last_line_number
|
||||
raw_message = ''
|
||||
raw_message = +''
|
||||
first_line_number = last_line_number + 1
|
||||
end
|
||||
else
|
||||
|
|
|
@ -283,7 +283,7 @@ class String
|
|||
def indent(count, char = ' ')
|
||||
gsub(/([^\n]*)(\n|$)/) do |match|
|
||||
last_iteration = ($1 == "" && $2 == "")
|
||||
line = ""
|
||||
line = +""
|
||||
line << (char * count) unless last_iteration
|
||||
line << $1
|
||||
line << $2
|
||||
|
|
|
@ -26,8 +26,10 @@ module ImportScripts::PhpBB3
|
|||
require_relative 'database_3_1'
|
||||
Database_3_1.new(@database_client, @database_settings)
|
||||
else
|
||||
raise UnsupportedVersionError, "Unsupported version (#{version}) of phpBB detected.\n" \
|
||||
<< 'Currently only 3.0.x and 3.1.x are supported by this importer.'
|
||||
raise UnsupportedVersionError, <<~MSG
|
||||
Unsupported version (#{version}) of phpBB detected.
|
||||
Currently only 3.0.x and 3.1.x are supported by this importer.
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ module ImportScripts::PhpBB3
|
|||
# @param poll_data [ImportScripts::PhpBB3::PollData]
|
||||
def get_poll_text(poll_data)
|
||||
title = @text_processor.process_raw_text(poll_data.title)
|
||||
text = "#{title}\n\n"
|
||||
text = +"#{title}\n\n"
|
||||
|
||||
arguments = ["results=always"]
|
||||
arguments << "close=#{poll_data.close_time.iso8601}" if poll_data.close_time
|
||||
|
|
|
@ -319,7 +319,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
|||
"\n[#{tag}]#{$~[:inner].strip}[/#{tag}]\n"
|
||||
end
|
||||
body.gsub!(XListPattern) do |s|
|
||||
r = "\n[ul]"
|
||||
r = +"\n[ul]"
|
||||
s.lines.each { |l| r << '[li]' << l.strip.sub(/^\[x\]\s*/, '') << '[/li]' }
|
||||
r << "[/ul]\n"
|
||||
end
|
||||
|
@ -357,7 +357,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
|||
inner = $~[:inner].strip
|
||||
params = parse_tag_params($~[:params])
|
||||
if params['author'].present?
|
||||
quote = "[quote=\"#{params['author']}"
|
||||
quote = +"[quote=\"#{params['author']}"
|
||||
if QuoteParamsPattern =~ params['link']
|
||||
tl = topic_lookup_from_imported_post_id($~[:msg].to_i)
|
||||
quote << ", post:#{tl[:post_number]}, topic:#{tl[:topic_id]}" if tl
|
||||
|
|
Loading…
Reference in New Issue