Taxonomy Delete Batch module allows you to delete large vocabularies and orphaned terms. This module aims to help you if you want to delete thousands of terms at once.
If you try to delete a Vocabulary what contains a huge amount of terms, you will probably face memory or execution time limitations.
Taxonomy Delete Batch aims to solve that problem using the Batch API of Drupal core.
You may find this module helpful, if you are building or administering a site what generates a huge amount of data, and you need to do a clean-up sometimes.
Comparison
I've tried other modules before writing Taxonomy Delete Batch, but none of them was able to handle thousands of terms, or the intended usage is drush, what is not available on shared hosts. This module can be used on shared hosts.
Installation
As usual.
Usage
The User who has the administer taxonomy permission is able to use Taxonomy Delete Batch.
It integrates into the edit page of vocabularies, and deletes all vocabularies using the Batch API if the user deletes a vocabulary using the admin UI.
Start
How to Batch delete orphaned terms and large vocabularies
- Navigate to admin/structure/taxonomy/delete-batch
- Select vocabularies what have orphaned terms
- Select vocabularies you would like to delete altogether
- Click the Start button
How to Delete a vocabulary
- Navigate to admin/structure/taxonomy
- Click edit of any of the vocabularies you want to delete
- Click delete on the edit page of the vocabulary
- Confirm the deletion
Continue
- Navigate to admin/structure/taxonomy/delete-batch
- Click the Continue button
Terminate
- Navigate to admin/structure/taxonomy/delete-batch
- Click the Terminate button
Remarks
- Term-Node relations are handled only. Other entities and field relations are not supported.
- Drupal 7 only.
Link to project page
http://drupal.org/sandbox/imre.horjan/1831062
Version Control
Git instructions
http://drupal.org/node/1831062/git-instructions/7.x-1.x/nonmaintainer
Direct link to git repository
http://git.drupal.org/sandbox/imre.horjan/1831062.git
Git clone
git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/imre.horjan/1831062.git taxonomy_delete_batch
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Screenshot-1.png | 58.78 KB | udaksh |
| taxonomy_delete_batch.operation.png | 7.31 KB | imre.horjan | |
| taxonomy_delete_batch.form.png | 28.69 KB | imre.horjan |
Comments
Comment #0.0
imre.horjanTermination usage information added
Comment #0.1
imre.horjanTermination information updated
Comment #1
aritra.ghosh commentedHii,
Looks like this is going to be a nice module.
Quick manual Review:
1. Please remove license.txt. It will be automatically added by Drupal while packaging.
2. Some of the function headers are missing and some comment structures are not according to Drupal standard.
Please make sure to run your module and correct the errors through drupal automatic code sniffer. Currently is shows a large number of them: http://ventral.org/pareview/httpgitdrupalorgsandboximrehorjan1831062git
Thanks,
Aritra
Comment #2
aritra.ghosh commentedChanging the status to needs work.
Comment #3
imre.horjanHi,
Thanks for your advise.
I've polished the code to meet Drupal standards.
There is no recognized errors on the page, except acccording to the git repository.
Comment #4
imre.horjanStill have some coding-standard errors, currently working on fixing them...
Comment #5
udaksh commentedHi Imre.horjan,
I tried to run your module but it is giving following error when i clicked on start button:
An AJAX HTTP request terminated abnormally. Debugging information follows. Path: /drupal/batch?id=65&op=do StatusText: ResponseText: ReadyState: 4
Also as a security point you must use check_plain() or other filters for getting the vocabulary names.
Your 108 line in file taxonomy_delete_batch_form.inc should be $options[$vocabulary->vid] = check_plain($vocabulary->name); because here you getting the value from some other module.
Regards,
Comment #6
imre.horjanEverything is fixed, no errors, no warnings.
http://ventral.org/pareview/httpgitdrupalorgsandboximrehorjan1831062git
The git repository also seems to be correct.
Comment #7
imre.horjanHi udaksh,
I will correct those.
Comment #8
imre.horjanHi udaksh,
You are right, that filtering data is important.
However your suggested modifications are not important here, because data must be filtered in theme layer.
If you take a look at drupal core's include/form.inc you will find those filtering codes in theme_ functions, in this case the following:
I've tested the module again, and works fine on a clean install. Generated 10000 terms with devel generate, and the process finished without any errors.
I see you are running drupal in a subdirectory, not sure whether it can be the cause or not, but I think you may encounter other AJAX / batch related issues. My other idea is that non-ASCII characters can cause errors somehow.
I suggest you to checkout the source code from the 7.x-1.x branch again. I think the git repository was messed up that time, when you tested the module.
Could you please take a look again, and if you get error messages, could you provide me more details?
Comment #9
imre.horjanComment #10
udaksh commentedHi Imre.horjan,
I tried with the updated source code of 7.x-1.x, and now it is running fine. I have not seen your code in depth but i will review it soon. Thanks i can see that check_plain() is not required there.
Also,I can see that the functionalities provided by your module is also being provided by Taxonomy Manager http://drupal.org/project/taxonomy_manager. We prefer collaboration over competition. Please be ensure that your project is providing unique functionalities than any other existing project on drupal.org.
Comment #11
imre.horjanActually, I'm using Taxonomy Manager, but it's functionality differs.
I will take a look whether I can collaborate with the maintainers, however my plans are a bit different, I plan to rewrite the code and replace core's delete functionality.
I would be more happy if I could merge it into D8 core if it can be done before the code freeze.
Comment #12
imre.horjanThat's what I've found:
http://drupal.org/node/189192
Francewhoa suggests to use http://drupal.org/project/delete_orphaned_terms , admitting that it can not handle large vocabularies.
However, even if I've used taxonomy manager, I prefer Views with VBO for that use case.
I've been thinking about your suggestion, but my opinion is that Taxonomy Manager and Taxonomy Delete Batch are for different use cases. In Taxonomy Manager you work with terms, meanwhile in Taxonomy Delete Batch you work with vocabularies.
I admit that there are two other similar modules out there:
Both of them have similarities to Taxonomy Delete Batch, but have fundamental differences.
The reason I wrote this module is that I couldn't find any module what was able to handle such amount of data. I was building a site, what has more that 15000 nodes, connected to more than 15000 terms, and there were no module what was able to delete unnecessary terms.
Comment #13
imre.horjanCommitted the above mentioned changes to 7.x-1.x.
Vocabulary delete functionality is replaced to use Taxonomy Delete Batch.
When the user navigates to admin/structure/taxonomy, clicks edit next to a vocabulary, and selects delete > Confirm delete, it uses the batch processing for the deletion.
Comment #13.0
imre.horjanGit information changed to use the 7.x-1.x branch
Comment #13.1
imre.horjanThe newly commited version integrates into the admin UI, and uses Taxonomy Delete Batch on Vocabulary Deletion.
Comment #13.2
imre.horjan* Start button
* Headers
* Links
* Codes
Comment #13.3
imre.horjanGit clone => H3
Comment #13.4
imre.horjan-The
Comment #14
imre.horjanThe module is under a total rewrite (implementing new features, being more stable and user-friendly).
Closing this thread until I can publish the newer version.
Comment #14.0
imre.horjanEntity info