News:

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

Main Menu
Support-Forum

How to delete cateories with subcateogires?

Started by galbur, 27.11.2017 12:00:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

galbur

Hi




Somebody uploaded hundreds of folders via FTP into the jdwonload folder.
I moved this structure to another place but now the jdwonload DB is full of Categories, sub-subcategories. But it seems, its' not possible to delete categories that includes subcategories. So i have to delete about 1500 Cateogories one by one? Or is there another solution?
thank you  Christoph
  •  

ColinM

#1
Hi
The Categories and all the subcats are not just directories but also entries in the database.  In essence jD only allows deletes from empty categoreies in the database, that is there are no subcats or Downloads.  This is to ensure protection - but not helpful in your case
So to check out I created a new top level Cat with 2 subcats and one sub-subcat.
Then I actually deleted the actual directories and sub directoies etc.
Then in backend I tried to delete the top level cat.  As expected I got the message
Notice
One or more of the selected Categories cannot be deleted because they have Subcategories. You need to delete Subcategories and any Downloads in a Category before you can delete it.

This is where you are at.

So I next ran the 'Check Download area now.' on the jD Control Page.  This gave the result:
"4 Categories were found that no longer have the relevant directory and therefore those categories were not published."
It also gave me the list of directories it did not find which are now unpublished.
It is now possible to get rid of the non existent Categories (I assume here that there were no files in the Cats) by using MySQL commands.  Obviously take a Backup first!!

Now using MySQL I executed
SELECT * FROM `prefix_jdownloads_categories` WHERE `published`=0
Having seen that the correct categories were selected I then gave the SQL command
DELETE FROM `prefix_jdownloads_categories` WHERE `published`=0  Note no *

I then used Rebuild on the Categories page and all was well.

If you are not happy to use MySQL directly then please let us know.

Colin
EDIT If there were any Downloads in the cats then we need to get rid of them first - please advise
Colin M
  •