News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

Export category/subcategories to another jdownloads

Started by belini, 16.09.2022 17:46:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

belini

Today I manage two installations of jDownloads on different sites, each with their own categories and downloads. I'll call it site A and B, to simplify the questioning.

Site A has a jDownloads installation with several categories and subcategories, what I need to do is take a specific category from site A and export to site B, taking all subcategories and downloads from that specific category together, of course.

That is, what I need is to export an entire category, subcategory and downloads from site A to B, without losing the data that already exists on site B. What is the best way for me to do this process without having to manually create all items again on site B?

Initially I thought about the jDownloads backup/restore option, but that would erase the data from the destination site (B), at least that's what is written there in the help.

So I thought of doing it in parts, copying the physical directory and subdirectories from site A to B, then copying the database structures, so I don't have to retype all the titles of the files again, there are almost 600, more or less.

I verified that I need to export the data from the table jos_jdownloads_categories, jos_jdownloads_files and jos_assets.

Do you have any other tables or care that I should have in the migration? Apart from the issue of index conflict that can occur in database?

If anyone has any other tips or a better way to do this, please share. ;)
  •  

ColinM

Belini
My approach would be to would be to to copy all the directories and files you need from the jdowdnloads directory using FTP or  similar.  Then copy those directories and files to the corresponding jdownloads file on the other site.  Then  use the jD control panel to Check Download Area.  This will created the  Categories and Downloads as those in the original site - at this stage they will not have the correct titles and other items but they will have the important linking (id) items.  If you have a a large number of directories and files I would suggest you do it in several substages.

Now setup the permissions you need for the Downloads on the second site.

And test that all seems OK.

(As a temporary measure you could set the permissions of the top Category to a specific  Access to hide them temporarily from regular users - but do not use superuser for this as testing with superuser may not reflect a regular user).

I have assumed you are using phpmyadmin for this database work.

As an overview the objective is to get the files and categories tables database info from the  source database and then modify this to remove the id values as below, and then import the modified items into the target machine
1. Categories table omit 'id', 'parent_id', 'created_user_id', 'modified_user_id' and 'asset_id'
2. Files Table omit 'id', 'other_file_id', 'catid' and 'asset_id'

First step is to make backup copies of the files and categories database tables on the target machine.

Export the files and categories database tables from the 'source' database as csv files (microsoft). 
You can then edit them by deleting the relevant id columns.
Next import the modified csv files as CSV

If in doubt ask!!!

Colin

I would try it first on a devel site
Colin M
  •  

belini

Thanks for the answer. From what I understand your suggestion would be for me to copy, maybe compress the structure of files and directories into a file, move to the destination and unzip, the directory structure is already the structure of the categories.

So I can use the Check Download Area option, and jD will import and create all categories and files for its database. This certainly solves part of the problem, and I had already thought about it, the question now is how to adjust all the titles of the categories and files, since in these imports they will normally have the same name constant in the directory structure of the file system.

The second part of your suggestion would be to adjust this? I'm trying to understand how it would work.

So, would I export the categories and files from the original site in csv and then remove the "IDs" then import into the new site? Wouldn't there be some conflict? Even removing the "IDs", since the structure of categories and files was already created in the first step, when I used the Check Download Area function?

This part got me a little lost.

Here at the company we are using the DBeaver Community Edition universal database manager, I think there must be some way to export/import csv.
  •  

ColinM

Belini
Yes the second part is the challenging part.  The first stage will have set up all the id's  so after exporting the base site category and files tables they need to be edited  to remove the ID columns.  then that part is used to update the second site.  Normally these are SQL operations

Colin
Colin M
  •