RM 1.1 Import Files from DownloadsII

Sadik B

Well-known member
This is more of a discussion thread and not a support question. My Oracle Forums has about 12000 files in DownloadsII. I have been considering moving this site to XF for over a year now.

Have any of you successfully imported from Downloads II several thousand files? Is there an importer I may have overlooked?

If not, I am considering coding an importer for my needs. Would there be any commercial interest in it? Else I could just import by directly running queries on the database and not bother with an importer. Thoughts?
 
Hi namesake! :)

Yes this is due. My version imports comments as well (other than the author's own comment). Not urls though.

I haven't been finding time to make a proper resource. But here is my final version importer. This will import categories, files and comments.

Regards

@Sadik B
Thanks for sharing your file. I imported the categories, files and comments successfully
One of the great things, the file ID is the same after the importing process
+ Your importer will not create any discussion thread in the forum, it will import the files and comments in the resources manager only and this is exactly what I need

I have two questions:
1- Number of downloads is showing zero for all files, how did you fix this in your forum?
2- Rating in all comments is showing (4/5), are you facing the same issue?
 
@Sadik B
Thanks for sharing your file. I imported the categories, files and comments successfully
One of the great things, the file ID is the same after the importing process
+ Your importer will not create any discussion thread in the forum, it will import the files and comments in the resources manager only and this is exactly what I need

I have two questions:
1- Number of downloads is showing zero for all files, how did you fix this in your forum?
2- Rating in all comments is showing (4/5), are you facing the same issue?

Yes I did not need the threads so I built it inside the importer to delete the threads.

The ratings was just too much trouble, plus no one really cares so instead of importing I hard coded it to 4/5. :) I would suggest you to leave it too unless ratings are a big part of your community.

About number of downloads, I ran a few post import queries to clean a few things. These queries require that your new xenforo database and your old vbulletin database be on the same server and the xenforo user has select permissions on the vbulletin database.

My vbulletin database was clubora_db. Modify this for your need.

The below query will fix downloads count.

Code:
update xf_resource xr, clubora_db.CO_dl2_files f1
set xr.download_count = f1.totaldownloads
where xr.resource_id = f1.id

This will fix the release date being all the day of import.

Code:
update xf_resource_version xrv, clubora_db.CO_dl2_files f1
set xrv.release_date = f1.dateadded
where xrv.resource_id = f1.id

This will update all version strings to be date of the release date

Code:
update xf_resource_version
set version_string = DATE_FORMAT(FROM_UNIXTIME(release_date),'%Y-%m-%d')

Hope this helps.
 
@sadiq6210

I merged the changes and added the download count as well.

Another change I made is that downloads that were posted by a user in the VB database that does not exist in the xf_user table will be skipped.

When testing the script, the resources were not created with the same IDs from the VB database. As a result, the comments were not be added to the correct resource. Please validate that the comments are being added to the correct reasources
 

Attachments

The ratings was just too much trouble, plus no one really cares so instead of importing I hard coded it to 4/5. :) I would suggest you to leave it too unless ratings are a big part of your community.
Thanks again Sadik
If it is much trouble and not possible to be transferred, then I think it is better to import the comments without rating. Did you try this option?
 
@sadiq6210

I merged the changes and added the download count as well.

Another change I made is that downloads that were posted by a user in the VB database that does not exist in the xf_user table will be skipped.

When testing the script, the resources were not created with the same IDs from the VB database. As a result, the comments were not be added to the correct resource. Please validate that the comments are being added to the correct reasources

We are closer to have a perfect importer, we appreciate this for you 0ptima

I tried your file, It is working and the downloads counter updated correctly
I found only one bug relating to file ID, if the file ID does not exist in vbulletin database (i.e. deleted) then the importer will give the file ID to another file.

Example:
In vbulletin database:
File ID#1: exist
File ID#2: exsit
File ID#3: does not exisit (deleted)
File ID#4: exist
File ID#5: exist

After importing in xenforo database:
File ID#1: OK
File ID#2: OK
File ID#3: File ID#4 imported here and have a new ID, it was ID#4 and now it is ID#3. Because ID#3 does not exist, file ID#4 will become in file ID#3
File ID#4: File ID#5 will be imported here.

Therefore, the files ID's became different and the comments imported in wrong places.
If it is possible to import the files with same ID and ignore the ID that is does not exist, then the issue could be solved.

Thnaks @0ptima
 
A member can only create a comment once per resource version and a rating must be included.

What I propose is that if someone rates a DL2 entry and leaves a comment, then the rating along with the latest comment gets importer to the RM entry.
 
A member can only create a comment once per resource version and a rating must be included.

What I propose is that if someone rates a DL2 entry and leaves a comment, then the rating along with the latest comment gets importer to the RM entry.

What about the File ID @0ptima ?
The comments imported in wrong places because the file ID is not the same after imported in xenforo

I will appreciate if it is possible to fix this bug


Does DLII have ratings and discussions like XFRM and LDM?
Yes, in DownloadsII you can rate the files and add comments, but the rating system is separate. There is no relation between comments and rating.

This is example from DownloadsII:
الاستدي قايد مال مادة- econ 140 - Study_Guide - المكتبة الجامعية - :: UOB-BH :: منتديات طلبة جامعة البحرين
 
This has been fixed by creating the comments immediately after creating the resource. As such the import comments step has been removed.

I dont know why the file Ids are not being kept.

I deleted the resources and installed it again, then I started a fresh importing.

Comments:
I have 5325 comments but after completing the importing and updating the counters, I checked the database and only 66 comments imported !
The previous file (you attached here) imported all the comments successfully but it was in wrong places. If file ID issue solved, then the comments importer "done by Sadik" can be used.

File ID:
In vBulletin database, there is some rows missing because if I delete any file from (downloadsII), then the row will be deleted from database
See this screen-shot for vBulletin database, ID is 1-2-4-5 (There is no "3" because file ID#3 deleted from long time)

dl2_db1.webp



The problem happen because the importer is importing ID4 in ID3 just to fill ID3, it should ignore ID3 where there is no #3 in the vBulletin database.
See this screen-shot for xenforo database and compare it with the previous one. Row ID#3 should be 4, ID#4 should be 5 and so on ...

dl2_db2.webp



I noticed in categories importing this problem didn't happen, even if there is a missing category ID, the importer will move all the categories with it's exact ID without any change which is perfect.
See the screenshot, category ID#8 does not exist even after the importing (This is perfect)

dl2_db3.webp


I know we took a lot from your time but we really need this importer, we stuck with vBulletin from long time because nobody succeed to program this importer. we appreciate your work @0ptima
 
Last edited:
I have 5325 comments but after completing the importing and updating the counters, I checked the database and only 66 comments imported !

This does not surprise me as only unique user comments for downloads that had a rating were imported.

The attached version will import all unique user comments per download and set the rating to 4 stars.
Comments will be added once the resource is created so they will be associated to right resource.

Still dont know why ids are not being kept.....
 

Attachments

This does not surprise me as only unique user comments for downloads that had a rating were imported.

The attached version will import all unique user comments per download and set the rating to 4 stars.
Comments will be added once the resource is created so they will be associated to right resource.

Still dont know why ids are not being kept.....
Thanks for update
This is working perfect. I imported all the files and comments successfully
Importing with identical "Files ID's" is very important because like this it is not possible to redirect the links from old script to the new one
We have more than 5500 files from 2006 and we should redirect the url's to the same file.

Please let me know when you solve this, it could be great news for us :)
 
If you compare the code, the resource is created the same way in both versions so I do not see why IDs are kept in one and not the other.

@Sadik B Did you do anything special to ensure IDs were kept?
 
LDM has comments with and without ratings. Is this the same for Downloads II ?
LDM also has automatic forum thread creation, which is basically a thread tied to the resource. Some resources have it, while others do not. Comments are replicated in the thread.Does downloads II have something similar?
Any idea if this can be imported through downloads II into RM?
 
Top Bottom