3

Iv been developing a Magento site for a few months now, during this process I have installed and removed many extensions that themselves have created many tables within my database and files on the server, along with that I've tried building multiple extensions of my own including lots of files.

Im wondering if there is a way to monitor which files are being read and used, and then have the ability to remove any, unused tables, or files.

Basically i just want to clean up the store of unused files and tables.

does anyone know if this has been done before? also where to start looking if it has?

Regards

5
  • By the way, don't forget to accept answers. It looks like you have had some good answers for your questions, and it helps you and the SO community when answers are accepted (the checkbox below the vote indicator). Commented Nov 24, 2012 at 20:54
  • There you go. ;-) You can now upvote. You can accept answers no matter what your reputation is. Commented Nov 25, 2012 at 13:46
  • haha yeah, sorry I must have only tried to press the up arrow, I was getting a little annoyed at not being able to do anything to thank people :/ still learning this ins and outs of this site Commented Nov 25, 2012 at 13:48
  • can I ask what the difference between a green tick and the up arrow is? Commented Nov 25, 2012 at 13:49
  • The green check marks the question as answered. That answer will always be at the top of other answers, and helps other visitors know what fixed your problem. Mouse over the upvote (or downvote) buttons for a short description of what they do. Commented Nov 26, 2012 at 13:02

2 Answers 2

3

To my knowledge, there isn't a tool that will "remove all unused extension tables" automagically, as that could potentially be quite dangerous (removing still used, or tables where the extension is just disabled, etc).

If you want to proceed, BACK IT UP, BACK IT UP, BACK IT UP!!. Then, and only then, manually go through the database and look at each table (phpMyAdmin makes this a lot easier). If it starts with an extension's namespace that is not being used (usually table names are like: namespace_module_tablename), look at the table to see if it has current/relevant data in it. There is a handy reference for the Magento DB schema (http://www.magereverse.com/). However, I don't know how familiar you are with Magento DB, and if one is not careful/knowledgeable, you can cause tremendous damage.

If you aren't super familiar with Magento, I would steer you away from doing this operation. Depending on if it is a live store or just your development machine, you could always start over. Then you know it is a good, clean start.

Sign up to request clarification or add additional context in comments.

1 Comment

hmm, ok, im probably not classed as super familiar, although I have spent months staring at different tables while creating my site. I leave it be until I feel I fully understand the workings of the magento database system.(iv already experienced the "tremendous damage" you speak of :P ) Thanks for the response :)
3

Unused tables don't take up much room and removing them can cause so much more grief on version upgrades than the room you'll save if you're looking to remove any tables that Magento itself creates for Magento modules you've disabled.

As to working with third party modules, since Magento's free, it's best if you set up a separate test server for module installations to see if they're really useful and/or compatible and then install them in your dev installation for running with your website.

That being said, after the fact, every module has a mysql installer script that you can read to see what database changes were made so you can attempt to reverse them out. These usually live in app/code/local/(namespace)/(modulename)/sql/(modulename)_setup/* or app/code/community/(namespace)/(modulename)/sql/(modulename)_setup/*. They will be named along the lines of mysql4-install-*.php or mysql4-upgrade-*.php though any of the above conventions could be broken by third party developers who don't follow the conventions closely.

You can use the SQL code in these to reverse out the changes the module made. Backups highly recommended.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.