FIX: category logo & background URLs should not use the CDN
This commit is contained in:
parent
a6c62dbe73
commit
52b338db62
|
@ -12,8 +12,12 @@ module Jobs
|
|||
ignore_urls |= Category.uniq.where("background_url IS NOT NULL AND background_url != ''").pluck(:background_url)
|
||||
|
||||
# Any URLs in site settings are fair game
|
||||
ignore_urls |= [SiteSetting.logo_url, SiteSetting.logo_small_url, SiteSetting.favicon_url,
|
||||
SiteSetting.apple_touch_icon_url]
|
||||
ignore_urls |= [
|
||||
SiteSetting.logo_url,
|
||||
SiteSetting.logo_small_url,
|
||||
SiteSetting.favicon_url,
|
||||
SiteSetting.apple_touch_icon_url
|
||||
]
|
||||
|
||||
ids = []
|
||||
ids |= PostUpload.uniq.pluck(:upload_id)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# fix any bust caches post initial migration
|
||||
ActiveRecord::Base.send(:subclasses).each{|m| m.reset_column_information}
|
||||
ActiveRecord::Base.send(:subclasses).each { |m| m.reset_column_information }
|
||||
|
||||
SiteSetting.refresh!
|
||||
uncat_id = SiteSetting.uncategorized_category_id
|
||||
|
@ -10,9 +10,7 @@ if uncat_id == -1 || !Category.exists?(uncat_id)
|
|||
|
||||
result = Category.exec_sql "SELECT 1 FROM categories WHERE lower(name) = 'uncategorized'"
|
||||
name = 'Uncategorized'
|
||||
if result.count > 0
|
||||
name << SecureRandom.hex
|
||||
end
|
||||
name << SecureRandom.hex if result.count > 0
|
||||
|
||||
result = Category.exec_sql "INSERT INTO categories
|
||||
(name,color,slug,description,text_color, user_id, created_at, updated_at, position, name_lower)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
class FixCategoryLogoAndBackgroundUrls < ActiveRecord::Migration
|
||||
def up
|
||||
return true if Discourse.asset_host.blank?
|
||||
|
||||
Category.exec_sql <<-SQL
|
||||
UPDATE categories
|
||||
SET logo_url = replace(logo_url, '#{Discourse.asset_host}', '')
|
||||
, background_url = replace(background_url, '#{Discourse.asset_host}', '')
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue