jomaxro
(Joshua Rosenfeld)
26 أغسطس 2016، 8:05م
1
We just finished migrating from our knowledgebase from MediaWiki to Discourse. Yeah!
We had 4 users manually add all the posts (no migration scripts that I saw), and then used @techAPJ ’s guide to convert all the posts to a single user.
Want to change ownership of all the posts by a specific user? Let’s do it!
If your site is hosted by Discourse, please reach out to our support team at team@discourse.org if you need to change ownership of all posts from a user.
Access Your Site
First connect to your Droplet via SSH, and enter the Docker container for your Discourse instances:
cd /var/discourse
./launcher enter app
Change ownership of all public posts
rake users:change_post_ownership["old_username","new_usernam…
Now that all the topics are owned by the same user, is there any way to change them all to wiki via a rake command?
Not that I’m aware of, at the moment.
jomaxro
(Joshua Rosenfeld)
26 أغسطس 2016، 9:27م
3
codinghorror:
at the moment.
Alrighty then, I’ve changed this topic to feature . Hope wiki-posts can get some love in 1.7!
cpradio
(cpradio)
26 أغسطس 2016، 9:34م
4
You can do it via the Rails console.
Something along the lines of
p = Post.find_each(user_id: X)
p.each_entry(wiki: true)
Then you have to figure out how to call .save on each entry… I’m struggling with that part, but it should be possible.
إعجاب واحد (1)
jomaxro
(Joshua Rosenfeld)
26 أغسطس 2016، 9:35م
5
My knowledge of the codebase is minuscule compared to yours - I’ll do some digging.
cpradio
(cpradio)
26 أغسطس 2016، 9:36م
6
I think this is mostly knowing Ruby/Rails at this point, p becomes an enumeration, so figuring out how to call a method on each item in the enumeration would be the solution. I just haven’t had a chance to google that yet.
إعجاب واحد (1)
riking
(Kane York)
26 أغسطس 2016، 11:16م
7
u = User.find_by_username('abc')
Post.where(user: u).each do |p|
p.wiki = true
p.save
end
5 إعجابات
sam
(Sam Saffron)
26 أغسطس 2016، 11:21م
8
Is this for stonehearth or another site you are self-hosting, if it is for stonehearth we can run the commands for you.
إعجاب واحد (1)
jomaxro
(Joshua Rosenfeld)
26 أغسطس 2016، 11:32م
9
Another site, thanks @sam . We’re self hosting a site at the university where I work for an internal help desk knowledge base. We’re just finishing manually importing from MediaWiki.
إعجابَين (2)
jomaxro
(Joshua Rosenfeld)
27 أغسطس 2016، 1:18ص
10
Thanks @riking ! Just tried that and it worked! Unfortunately, I overlooked the fact that About this Category
pages were owned by the user, but it was easy enough to disable wiki via the UI for the 10 or so category topics.
This topic was automatically closed after 2842 days. New replies are no longer allowed.