Ckan: [Enhancement suggestion] Purge old downloads from cache

Created on 4 May 2018  Â·  5Comments  Â·  Source: KSP-CKAN/CKAN

I think it would be great when a mod updates to a newer version of ksp(a version the player has currently installed) ckan should delete the older version from ..\Kerbal Space Program\CKAN\downloads folder, replacing it with the version that is installed alongside with the currently installed version of ksp.

Issue: I see at least two different versions of many mods in my ckan downloads folder, and all ive been doing is updating mods to new versions when I see them available. it looks like ckan doesn't touch the older versions of mods once a newer version is installed alongside an updated version of ksp.

Since Ckan can point to multiple ksp installs, a decision should be made if: Can I use this with multiple KSP installs at the same time(lets say I have 1.4.3 and 1.3.2 installed in different directories)? Can the settings be set based off what ksp version im currently using(we obviously don't want 1.4+ mods installing to a 1.3.0-2 just like that, or mods simply not appearing at all for a 1.3 install when you also have 1.4+ available )

Thank you!! I'm glad I could help!

Background

CKAN Version: 1.25.1

KSP Version: 1.4.3

Operating System: Windows 10 x64

Core (ckan.dll) Enhancement

Most helpful comment

That sounds nice :+1: .
I think the "tidy up" process would be best after install, because that's when we would hit the cache limit. "Delete all incompatible entries" should be called everytime after install, whereas the other deletions then depend on cache > limit

All 5 comments

This would be nice to do after all instances share a cache (see #2185). I picture it as a checkbox setting with a name like "Auto-purge old mods from cache," possibly on by default since turning it off seems like the more power-user thing to do. It might also be desirable to allow users to specify a maximum cache size; e.g., if you say to limit the cache to 500 MB, then once we get over that limit we start deleting files till we're back under the limit (presumably we delete the oldest incompatible file first, then the rest of the incompatibles, then the oldest compatible, and so on). Might have to think about what would happen if a user specified 0 MB; would things break?

We could loop through all the instances and check their versions to identify out of date downloads (though we would want to check the chosen compatible versions list rather than just the actual game version). I would think any download where the highest KSP version is older than the user's oldest game instance could be deleted safely. Registry.GetSha1Index could be used to map from cache entries to their CkanModules quickly.

When to do it though? Startup? Shutdown? Install? Refresh?

That sounds nice :+1: .
I think the "tidy up" process would be best after install, because that's when we would hit the cache limit. "Delete all incompatible entries" should be called everytime after install, whereas the other deletions then depend on cache > limit

Definitely need a checkbox in settings to allow this option to be turned off if implemented. I have never deleted a mod from my cache and don't intend to!

Would also be good to throw a dialog box asking users to confirm they want this on after they auto-upgrade, so people aren't caught by surprise. IE, if the setting doesn't exist in the CKAN settings, prompt rather than force it on. Or default to the pre-existing behaviour.

this is developing into a nice idea. Keep it up guys! Yall ROCK!!

On Mon, May 14, 2018 at 7:38 AM, Myk notifications@github.com wrote:

Would also be good to throw a dialog box asking users to confirm they want
this on after they auto-upgrade, so people aren't caught by surprise. IE,
if the setting doesn't exist in the CKAN settings, prompt rather than force
it on. Or default to the pre-existing behaviour.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/KSP-CKAN/CKAN/issues/2438#issuecomment-388801903, or mute
the thread
https://github.com/notifications/unsubscribe-auth/Ag_Lks3zvFj0XsLheOXzJIMEBqEi33AMks5tyXrLgaJpZM4TyAN2
.

Was this page helpful?
0 / 5 - 0 ratings