workaround incorrect uncategorized category id set in site settings

This commit is contained in:
Sam 2016-05-30 13:59:16 +10:00
parent 880b7e1053
commit 706624c9fc

View file

@ -2,7 +2,10 @@
ActiveRecord::Base.send(:subclasses).each{|m| m.reset_column_information}
SiteSetting.refresh!
if SiteSetting.uncategorized_category_id == -1 || !Category.exists?(SiteSetting.uncategorized_category_id)
uncat_id = SiteSetting.uncategorized_category_id
uncat_id = -1 unless Numeric === uncat_id
if uncat_id == -1 || !Category.exists?(uncat_id)
puts "Seeding uncategorized category!"
result = Category.exec_sql "SELECT 1 FROM categories WHERE lower(name) = 'uncategorized'"