Meow Apps

Media Cleaner: Debug Issues

Common Issues

First, I would like to say that getting the Pro version will not make everything better. If the free has an issue, the Pro will not fix it. It wouldn’t be fair for me to do that to my users. The Pro version adds interesting options, but it doesn’t mean it works better.

1. It suddenly… stops, or freezes!

This is a common issue. However, the cause cannot be guessed, there is an infinite number of possibilities. But basically, it’s either because an error happened (by any plugin)., or because the request wasn’t finished within the time allowed by the server.

  1. Check your PHP Error Logs. If you don’t know how it works, have a look here: Where are the PHP Error Logs. Pay attention to the time of the error. 
  2. Disable all the plugins except Media Cleaner, and try again. Does it work better?
  3. Run the scan with the Console Developer Tools (Google Chrome) opened. Have a look here: How to use the Network Tab

If it is a timeout, try to change the Media Cleaner settings. Those settings will make the scan quite slow but might help. Also have a look at this page, the section at the end: Debug WordPress.

Please note that it is absolutely necessary to find an error or an issue so that we can understand the issue. It is totally impossible to guess what to do otherwise. 

2. It detects too many entries as being not-used

Make sure your options are set right. Have a look at your PHP Error Logs. Is there any error? Is it related to the plugin?

Then you might be using a page builder or a specific plugin dealing with images that it is not supported by Media Cleaner (WPML Media for example). Are you using one? Check the Compatibility part of the description of the plugin here. If it’s not on the list, please comment below, as other users might also join the discussion and ask for this feature.

There is the last check you can do by yourself. Enable the Logs option in the plugin settings. Run the scan. At the end, a file will be created with debugging information about the latest scan. Under the Logs option, a link to the log file will be added when this file exists. You can open it, and have a look. In the first section of it, you will find the different media IDs and URLs referenced and grouped. In the second section (Checking Media…), the result of the analysis on each media. This second section looks like this:

Media Cleaner Logs

Basically, the ID or the URL of each media are being matched against the first section.

If nothing helps, and you still think that there is something wrong with Media Cleaner, first, you need to find an example how a file that is used (but detected as not used), and find exactly where and how it is used. For example: The Media 25 (titled “Holidays in Nagasaki”) is used as a background image in my article about Nagasaki, using a page builder called “Beaver Builder”. Those details are important. I will not be able to help you if I don’t know this.

Once you have those details, contact me and share them with me. I will be likely to ask you to replicate the issue on a fresh new install of WordPress (I can give you one), that will make me able to fix it more quickly.

3. It detects nothing as being not used

It means your images might have been used somewhere you didn’t suspect. Look at all your images and find one that you are sure is not used anywhere on your website. Click on it in the Media Library. On the right, there is a little widget called Media Cleaner.

Media Cleaner Usage

It will indicate to your something like: Seems to be used in a gallery, or Seems to be used in a post (and in that case, you will get a link to that post). Does this help you?

4. It is using too much memory

The latest versions of the plugin are much much, much faster and don’t timeout anymore, even on big installs. That is because most of the work is done during the posts’s analysis, and results stored in the cache. There are no redundant checks. This cache is stored in the database, as transients (WordPress feature). There is a reason: if anything wrong happens, of if the plugin is uninstalled, one week later those transients will be automatically cleared by WordPress. That way, everything is always clean.

Now, why is it using too much memory? That’s because the plugin needs to load the cached data, and update it with more data. This could be implemented a bit differently (by creating another table in the database only for this cache) but right now this problem is encountered by less than 1% of the users, and the implementation of this would affect too many of my users, without counting that I prefer to focus on making the plugin detection/analysis perfect before working on this issue.

Solutions would be to: disable all the plugins and re-run the scan (other plugins take also a lot of memory), increase the memory limit, or avoid to check all the options for the Media Cleaner (you probably don’t need all of them depending on what you are checking).