dotCMS / dotCMS/core

[TASK] Implement clean assets endpoints

Open
#35,202 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale Team : Modernization
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Implement POST /v1/maintenance/_cleanAssets and GET /v1/maintenance/_cleanAssets in MaintenanceResource.java. POST starts a background thread that walks the assets directory and deletes orphan binary folders with no matching contentlet. GET returns the current progress status.

Acceptance Criteria

POST /v1/maintenance/_cleanAssets

  • Endpoint must start CleanAssetsThread via CleanAssetsThread.getInstance(true, true)
  • API caller must receive the initial process status (totalFiles, currentFiles, deleted, running, status)
  • Must not start a new thread if one is already running
  • Must require CMS Administrator role and Maintenance portlet access

GET /v1/maintenance/_cleanAssets

  • API caller must receive current process status: totalFiles, currentFiles, deleted, running (boolean), status (string)
  • Status values: "Starting", "Counting", "Cleaning", "Finished", or "Error: ..."
  • Must require CMS Administrator role and Maintenance portlet access
Priority

None

Additional Context
  • CleanAssetsThread is a singleton thread that walks assets/0-f/0-f/* hex directory structure
  • For each directory: looks up contentlet by inode via ContentletAPI.find(inode), deletes if not found or has no identifier
  • Progress is updated via BasicProcessStatus and read via buildStatusMap() (uses BeanUtils.describe())
  • Angular should poll GET at ~1 second interval while running === "true"
  • DWR legacy: CMSMaintenanceAjax.cleanAssets() and getCleanAssetsStatus()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in MaintenanceResource.java and read CleanAssetsThread.getInstance(true, true), BasicProcessStatus, and buildStatusMap(). Trace the legacy CMSMaintenanceAjax.cleanAssets() and getCleanAssetsStatus() entry points for expected behavior. Done means POST and GET expose the specified progress fields, avoid duplicate runs, enforce the CMS Administrator and Maintenance portlet requirements, and return the documented status values.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.