Hi,
Trying to write an discourse importer from a elgg mysql database.
I managed to find most of the things I need (discussions, topics, groups, user) but I couldn't find where are the avatars in the database.
If you could help me this would be amazing :)
I'll publish the elgg mysql importer in discourse repo for people that would need it.
Thanks for your precioue time and help!
Pierre
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 1 like
- Pierre OK@pierreok
Pierre OK - 0 likes
- Pierre OK@pierreok
Pierre OK - 0 likes
- Pierre OK@pierreok
Pierre OK - 0 likes
- Pierre OK@pierreok
Pierre OK - 1 like
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- for which version of Elgg was this made because I see some references to tables that no longer exist is the current version of Elgg (https://github.com/discourse/discourse/pull/19140/files#diff-80357e7418ff4f7aba9a5b67d6a60d6d2718cbd67c9251763c8d1f7a628f8204R59 and https://github.com/discourse/discourse/pull/19140/files#diff-80357e7418ff4f7aba9a5b67d6a60d6d2718cbd67c9251763c8d1f7a628f8204R114)
- It looks like you have the database table prefix hard coded. Not everyone uses 'elgg_'
- The topic creation uses a hard coded subtype which isn't the same in every Elgg installation (https://github.com/discourse/discourse/pull/19140/files#diff-80357e7418ff4f7aba9a5b67d6a60d6d2718cbd67c9251763c8d1f7a628f8204R128) also again no longer present in the current version of Elgg
- The posts creation also uses a hard coded subtype, same remark as for the topics https://github.com/discourse/discourse/pull/19140/files#diff-80357e7418ff4f7aba9a5b67d6a60d6d2718cbd67c9251763c8d1f7a628f8204R182
- Pierre OK@pierreok
Pierre OK - 0 likes
You must log in to post replies.All uploaded content including avatars is stored in the data folder, not in the database.
References:
http://learn.elgg.org/en/stable/intro/install.html#create-a-data-folder
http://learn.elgg.org/en/stable/admin/duplicate-installation.html
Thanks a lot, I'll have a look!
Ok, I'm on an elgg forum, my profile is at this url:
https://url.com/profile/pierreok
When I click on the profile image, I get the image, it is there:
https://url.com/serve-file/e0/l1668871438/di/c1/XQm6jiVK-2tl_ibtpmCZdyuD4qjxX2raV0HfnPVYR_c/865000/865910/profile/865910large.jpg
On the server I find the image:
user@server (production/stable) ~ $ ls data/www/865000/865910/profile/865910large.jpg
data/www/865000/865910/profile/865910large.jpg
But how is elgg storing that pierreok has its profile image at this path. Isn't this information in the database?
I searched, but didn't find it.
Thanks for your precious help :)
I searched metastrings and objects_entity table with `like '%86591%' no luck :/
Ok, I found it, sorry for the noise!
The path is the user id.
Perfect, I have all I need, thanks!
And here is the script!
https://github.com/discourse/discourse/pull/19140
Thanks again for the help!
Awesome!.
Mentioned in Elgg Channel on Telegram.
The idea is good, however I see a few issues:
Thanks for the feedback @Jerome, I'm no elgg expert, and the version I had to export was 2.3.17 from what I see.
I also have this mysql query to export files to a local folder, to the export to nextcloud:
```
select concat('mkdir -p ', dest, ' && cp ', orig, ' ', dest) from (
select
concat('"./data/www/',bucket_id, '/',owner_guid,'/',filename,'"') orig,
concat('"./nextcloud/',group_user_name,'/',originalfilename,'"') dest
from (
select ee.owner_guid,
GREATEST(floor(ee.owner_guid / 5000) * 5000,1) bucket_id,
ce.type,
IF(ege.name IS NULL, eue2.username, ege.name) group_user_name,
eue2.username owner_username,
max(case when ems1.string='filename' then ems2.string end)filename,
max(case when ems1.string='originalfilename' then ems2.string end)originalfilename
from elgg_entities ee
join elgg_entities ce on ee.container_guid = ce.guid
join elgg_metadata em on em.entity_guid = ee.guid
join elgg_metastrings ems1 on ems1.id = em.name_id
join elgg_metastrings ems2 on ems2.id = em.value_id
join elgg_users_entity eue2 on eue2.guid = ee.owner_guid
left join elgg_groups_entity ege on ege.guid = ee.container_guid
left join elgg_users_entity eue on eue.guid = ee.container_guid
WHERE ee.subtype = 1 # files
group by ee.guid) as raw)
as orig_dest;
```
I don't know where is the best to put it, but here is better than none :)
Have a nice day everybody :)
Cheers!