User.joins(:user_stat).where("user_stats.post_count = 0 AND previous_visit_at <= '2016-05-22'::timestamp").destroy_all
Should do the trick Of course make sure to make a backup first
Edit:
Sorry, forgot usage tips Of course you have to log into your server, go into the discourse directory [probably /var/discourse], enter your Docker container [probably ./launcher enter app] and then enter rails console by typing rails c . These are defaults on docker based installations @treb0r
The users were originally imported into Discourse from BBpress, and that’s where the spam users came from.
I think there’s probably about 5000 or so.
What is the syntax to get a count of users before I run the destroy?
Then you can try anything out in your sandbox, including checking that the latest OS patches and Discourse updates are ok. Our live site is on AWS, but if you run your sandbox on a different provider than your live site then you’ll be open to differences in OS/Droplet changes.
I don’t run any mail on the sandbox, so regardless of what I mess up it won’t start sending stuff to the users.
It depends. If you leave .com in .css, for example, then the sandbox will keep taking you to the live site.
iirc I just went through the settings and changed any that seemed might cause a problem, but to be absolutely safe you might want to change all of them.
Also, if you’re using S3 for storage, do something about that so that you are sure that you’re not influencing the live site.
Links to other posts inside the sandbox resolve to the corresponding item in the sandbox, but I think this might be dependent what you do with hostname in app.yml (if you copy your app.yml over from your live site then be veewy, veewy cawefuw…)