Ubuntu – Ubuntu tweak and Mozilla (firefox and thunderbird) cache

cachefirefoxthunderbirdubuntu-tweak

I usually use Ubuntu tweak to do cleanup jobs on my PC. This includes apt and program cached data and old kernels. This goes alright for most programs except Mozilla based application – Firefox and Thunderbird.

Ubuntu tweak doesn't seem to know where their cache folders are and always returns 'zero packages can be cleaned' even when the cache folder is full. Check screenshot below:

Screenshot showing empty firefox and thunderbird cache folders

I am looking for a way to clean up ALL my cache data and unneeded packages at one point.

If someone knows how to change the ubuntu tweak cache folders for Firefox and Thunderbird, that would be perfect.

I tried bleachbit last but it crashed my PC to a point I had to re-install Ubuntu.
I am using Ubuntu tweak 0.8.6.

EDIT
Same issue with the screenshot of this question: Why isn't Ubuntu Tweak's Janitor working?

EDIT 2
For the python programmers out there, this answer shows the commands that Ubuntu tweak janitor runs to clean up the system. Maybe something in there will shed more light to this issue.

Best Answer

As I tested Ubuntu Tweak 0.8.6 in Ubuntu 13.10. It seems that for both, late releases of Mozilla Firefox and Thunderbird moved their cache folders to ~/.cache. Profiles configuration kept in same place ~/.mozilla/firefox/profiles.ini and ~/.thunderbird/profiles.ini.

  • Firefox: ~/.mozilla/firefox/~/.cache/mozilla/firefox/

  • Thunderbird: ~/.thunderbird/~/.cache/thunderbird/

Quick patch:

sudo nano /usr/share/pyshared/ubuntutweak/janitor/mozilla_plugin.py

Add/Change all lines I include cache_path in them (3 new lines, 2 modified app_pathcache_path, keep app_path of the profiles.ini):

import os
import logging

from ubuntutweak.janitor import JanitorCachePlugin
from ubuntutweak.settings.configsettings import RawConfigSetting

log = logging.getLogger('MozillaCachePlugin')

class MozillaCachePlugin(JanitorCachePlugin):
    __category__ = 'application'

    targets = ['Cache',
               'OfflineCache']
    app_path = ''
    cache_path = ''

    @classmethod
    def get_path(cls):
        profiles_path = os.path.expanduser('%s/profiles.ini' % cls.app_path)
        if os.path.exists(profiles_path):
            config = RawConfigSetting(profiles_path)
            try:
                profile_id = config.get_value('General', 'StartWithLastProfile')
                for section in config.sections():
                    if section.startswith('Profile'):
                        relative_id = config.get_value(section, 'IsRelative')
                        if relative_id == profile_id:
                            return os.path.expanduser('%s/%s' % (cls.cache_path, config.get_value(section, 'Path')))
            except Exception, e:
                log.error(e)
                path = config.get_value('Profile0', 'Path')
                if path:
                    return os.path.expanduser('%s/%s' % (cls.cache_path, path))
        return cls.root_path


class FirefoxCachePlugin(MozillaCachePlugin):
    __title__ = _('Firefox Cache')

    app_path = '~/.mozilla/firefox'
    cache_path = '~/.cache/mozilla/firefox'

class ThunderbirdCachePlugin(MozillaCachePlugin):
    __title__ = _('Thunderbird Cache')

    cache_path = '~/.cache/thunderbird'
    app_path = '~/.thunderbird'

I filled an upstream bug report for this, See Cache path of Mozilla Firefox and Thunderbird changed to ~/.cache #24

enter image description here