# نقل منتدى Kunena 3 إلى Discourse

**URL:** https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776
**Category:** Sysadmins
**Tags:** how-to
**Created:** [6 مايو 2016، 5:25ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776 "2016-05-06T05:25:00Z")
**Posts on this page:** 15
**Page:** 2

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [23 يناير 2018، 1:24م UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/21 "2018-01-23T13:24:22Z")

</div>

It might make sense to import them as likes. A few importers do that and can serve as examples.

If you have a budget and need help, please see my contact information is in my profile.

---

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [1 فبراير 2018، 7:41ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/22 "2018-02-01T07:41:16Z")

</div>

FYI based on this howto I wrote this one:

> [@Install Discourse on Vultr and import from Kunena3](https://meta.discourse.org/t/howto-install-discouse-vultr-and-import-from-kunena3/74269):
>
> This guide shows how I was able to setup discourse and import 10.000+ users and 38.000+ posts from kunena. I was running an outdated Joomla! 2.5.28 version with kunena 3.0.8 on top and it was hacked. Therefore I was looking for a new solution for my site. I knew discourse from another forum I use as a visitor, not as an owner. For me, without other skills than basic SSH and unix skills, I found it very hard to install and import. I’m a medical doctor, a GP, not a programmer… I have spent a wee…

---

<div class="post-metadata">

### Author: ![pgr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pgr/32/156783_2.png) [@pgr](https://meta.discourse.org/u/pgr)
#### Post date: [3 أبريل 2018، 12:21م UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/23 "2018-04-03T12:21:09Z")

</div>

Hi Jay. I am working on the Import now, I have successfully done my first import with the Kunena3 script (with a Kunena4 database).

I got users, categories and posts converted, but now I want to fine-tune the process and get more information. Can you please point me to which conversion scripts you think are more complete (with the Likes or any other extras)? Thanks!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3 أبريل 2018، 12:40م UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/24 "2018-04-03T12:40:11Z")

</div>

What I do is `grep` the import script directory for what I’m looking for.

I’ve not imported likes before. I’m unclear whether setting the like count in the post model is all that is required or whether that field gets updated some other way.

You can also look in app/models to see what’s there.

---

<div class="post-metadata">

### Author: ![pgr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pgr/32/156783_2.png) [@pgr](https://meta.discourse.org/u/pgr)
#### Post date: [3 أبريل 2018، 12:50م UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/25 "2018-04-03T12:50:59Z")

</div>

Thanks! My database has info about which user liked which post. I’ll have to see how that fits into Discourse (if possible), but it’s not just a count, it’s a list of user names related to individual posts.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3 أبريل 2018، 1:09م UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/26 "2018-04-03T13:09:38Z")

</div>

You’ll need to look into the rails models to see how those are updated.

---

<div class="post-metadata">

### Author: ![pgr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pgr/32/156783_2.png) [@pgr](https://meta.discourse.org/u/pgr)
#### Post date: [3 أبريل 2018، 1:17م UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/27 "2018-04-03T13:17:46Z")

</div>

Probably this part of `app/models/post_action.rb` to update counts:

```ruby
    when :like
      # 'like_score' is weighted higher for staff accounts
      score = PostAction.joins(:user)
        .where(post_id: post_id)
        .sum("CASE WHEN users.moderator OR users.admin THEN #{SiteSetting.staff_like_weight} ELSE 1 END")
      Post.where(id: post_id).update_all ["like_count = :count, like_score = :score", count: count, score: score]

```

and maybe I’ll try using this to actually do the “like” which is a kind of `PostAction`:

> <https://github.com/discourse/discourse/blob/main/script/import_scripts/lithium.rb#L380-L469>

This is my first time even looking at Ruby code… this will be fun…

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [4 أبريل 2018، 9:06ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/28 "2018-04-04T09:06:29Z")

</div>

You can use the following method, if you don’t want to do everything with SQL like the Lithium importer does:

```ruby
PostAction.act(user, post, PostActionType.types[:like])

```

---

<div class="post-metadata">

### Author: ![pgr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pgr/32/156783_2.png) [@pgr](https://meta.discourse.org/u/pgr)
#### Post date: [4 أبريل 2018، 9:20ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/29 "2018-04-04T09:20:23Z")

</div>

Thanks. It might be just my Ruby/Discourse newbieness tricking me, but it seems the Lithium importer is doing more stuff, I wonder if it is necessary? It seems to add rows both in UserActions and PostActions. And it has some extra logic to add only “missing” actions, why is that?

And if I use the method you suggest, do I still need to update Like counts, or does it take care of that? Thanks!

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [4 أبريل 2018، 9:29ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/30 "2018-04-04T09:29:17Z")

</div>

Calling `PostAction.act` should take care of all necessary stuff. The same method gets called when you like a post in the UI.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [4 أبريل 2018، 12:40م UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/31 "2018-04-04T12:40:58Z")

</div>

I wrote a couple importers before I knew ruby. My Programming Languages professor told us in 1986 that if a job requirement was to know some language, we didn’t need to worry. He was right.

I recommend doing things the rails way rather than mucking with the database directly.

---

<div class="post-metadata">

### Author: ![JetForMe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jetforme/32/120697_2.png) [@JetForMe](https://meta.discourse.org/u/JetForMe)
#### Post date: [31 يناير 2023، 12:02ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/32 "2023-01-31T00:02:05Z")

</div>

يوجد نصان مختلفان لاستيراد Kunena. أحدهما هو `kunena.rb`، والآخر `kunena3.rb`. Kunena نفسه يصل إلى الإصدار 6.x. أي نص يجب استخدامه للإصدارات الأحدث من Kunena؟

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [31 يناير 2023، 7:30ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/33 "2023-01-31T07:30:58Z")

</div>

ما سأفعله هو تجربة `kunena.rb` أولاً.

---

<div class="post-metadata">

### Author: ![pgr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pgr/32/156783_2.png) [@pgr](https://meta.discourse.org/u/pgr)
#### Post date: [31 يناير 2023، 11:40ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/34 "2023-01-31T11:40:09Z")

</div>

@JetForMe

لقد نشرت للتو نصوصي النهائية كملخص. بصراحة لا أتذكر ما فعلته هناك، أو مدى خصوصية ذلك لمجتمعي. ولكن ربما يمكنك مقارنة هذه النصوص بالأصول ورؤية بعض المشكلات التي قمت بحلها، والأشياء التي أضفتها. حاولت جعل الاستيراد أكثر اكتمالاً، وأكره فقدان المعلومات في عمليات الترحيل.

–\< [importing-from-kunena-3-to-discourse · GitHub](https://gist.github.com/pgorod/a5a61cd7ee7f4c6e4b4fd774549df8ee)  
و  
–\< [importing-from-kunena-3-to-discourse-2 · GitHub](https://gist.github.com/pgorod/bdf1fc319847168c79c393a413ef3576)

آمل أن يساعد هذا.

تحرير: لقد تذكرت للتو أنني استخدمت مزيجًا من نصوص Ruby وأوامر SQL (أوصي بـ DBWeaver لوحدة تحكم SQL عملية أثناء عمليات الترحيل). يمكنني نشر أجزاء SQL إذا كان هناك اهتمام.

---

<div class="post-metadata">

### Author: ![maaatt](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@maaatt](https://meta.discourse.org/u/maaatt)
#### Post date: [14 ديسمبر 2023، 9:33ص UTC](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776/35 "2023-12-14T09:33:11Z")

</div>

تمكنت من تثبيت `mariadb-server` و `default-mysql-client` (لم يعد `libmysqlclient-dev` موجودًا).  
ولكن الآن لدي الخطأ التالي:

```plaintext
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)

```

إذًا، كيف يمكنني بدء تشغيل مثيل MySQL؟ `mysql.server start` لا يعمل.

[Previous page](https://meta.discourse.org/t/migrate-a-kunena-3-forum-to-discourse/43776.md?page=1)
