Remove dead code and wire generated-image cleanup (ImageGenerator, ImageHelper::cleanup, buildOrganization) #104
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Several unused code paths ship, and one of them is a real disk-growth leak:
ImageGenerator(whole class) —generate()has no callers insource/; ships a TTF-font-dependent feature that is never wired up.ImageHelper::cleanup()— has no callers, so the generated-image cache inimages/mokoog/generated/grows unbounded over time. (ImageHelper::validate()is also unused.)JsonLdBuilder::buildOrganization()(:152) — no callers.Fix
ImageGeneratoror wire it to an actual feature.ImageHelper::cleanup()on a schedule (e.g. a console/cron task or on plugin save) with an age/size cap so generated images are pruned. (This part is a real leak — prioritise.)buildOrganization()/ImageHelper::validate().Note
Also fold in the duplicated crop logic:
ImageHelper::resizeToSize()is a near-verbatim copy ofresize()— consolidate.Branch created:
feature/104-remove-dead-code-and-wire-generated-imagMostly fixed in PR #111 (merged to
dev):ImageGeneratorclass andJsonLdBuilder::buildOrganization().ImageHelper::pruneOldFiles()(recursively deletes generated images older than 30 days, skipsindex.html) and call it on content save, so the generated-image cache is now bounded.Minor leftovers (kept open):
ImageHelper::validate()is still unused, andresizeToSize()duplicates most ofresize()— both are cosmetic cleanups, not the leak. Closing the leak portion; leaving this open for the consolidation, or it can be closed if you'd rather track that separately.Consolidation done in PR #117 (merged to
dev):resize()is now a thin wrapper overresizeToSize()(gained a$qualityparam), removing ~80 lines of duplicated crop/encode logic with identical output paths/files (behavior unchanged), and the unusedImageHelper::validate()was removed. Combined with the earlier dead-code removal + image-cache pruning (PR #111), all of #104 is now resolved. Closing.