- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I need to truncate the tables of a custom module when admin disable it in backend. There is any function for it. ? How can we do it ?
Could you please help?
Thank you!
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: When disable a custom module by admin how to truncate associated table of it?
Hi @arun_tr1,
One thing, when we disable custom module by admin then it is not fully disabled. It disable module output only.
You need to disable from app/etc/modules/MODULE_XML_FILE.xml.
You need to edit that file and make :
<active>true</active> to <active>false</active>
There is not any direct way to truncate table for disable module. You can truncate from the database.
TRUNCATE TABLE TABLE_NAME;
I hope it will help you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: When disable a custom module by admin how to truncate associated table of it?
Hi @Vimal Kumar
Thanks for your help but i have a little doubt on it. How we can make the change dynamically in code level. Is there any way ? Also i don't have such file (app/etc/modules/MODULE_XML_FILE.xml).
Is need to create it? I am a beginner in magento so could you please help me to solve this?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: When disable a custom module by admin how to truncate associated table of it?
There will be a module file, like ModuleNamespace_Modulename.xml.
For example: Mage_Catalog.xml ( this is only example, you don’t need to change this file.)
For change dynamic code, you need to edit the code or comment the code.
I hope it will help you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: When disable a custom module by admin how to truncate associated table of it?
Hi @Vimal Kumar
Thanks for your great effort. But my requirement is to truncate the table dynamically when admin disable that custom module, is there any function triggered or is any way to trigger a function truncate the table at the same time admin disable that module.
It will be great have a solution for it.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: When disable a custom module by admin how to truncate associated table of it?
You can truncate the table directly from database using mysql.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content