Importer SiteSettings recommendations

I’ve done several imports recently and find it helpful to include these SiteSettings:

    SiteSetting.disable_emails = true
    SiteSetting.login_required = true
    SiteSetting.allow_index_in_robots_txt=false
    SiteSetting.title = "Legacy Forum Name import"

In case it’s not clear:

  • I live in fear of uploading some uploading a demo import to someone and having Discourse send out a zillion emails.
  • I live in fear of having someone’s not-ready site show up in Google (he wasn’t very happy!)
  • Having a title makes it a tiny bit easier to guess which backup I’m looking for.

Unless someone says not to, I’m going to include these in future PRs when I make improvements to importers.

deactivate_all_users

This is along the same lines, and I’ll throw it in here rather than start another thread.

Also handy is a function to deactivate all users so that if you do want to make a site functional enough to log in but don’t want a bunch of people getting emails. (And yeah, that happened too. :frowning:)

It it OK to submit a PR with this in base.rb? That’ll keep me from adding it to every importer I touch.

  def deactivate_all_users
    User.where("active = true and admin != true").update_all(active: false)
  end
6 Likes

Seems fine to me :+1:

3 Likes