Shrink Local Content
Use this workflow after ldev db sync or ldev db import when local Journal content volume is too large for practical reindexing or day-to-day use.
ldev portal content prune keeps the portal data model intact while reducing the number of Journal articles through Liferay APIs instead of manual SQL.
1. Inspect the portal first
ldev portal check
ldev portal inventory sites --json
ldev portal inventory sites --with-content --sort-by contentResolve the exact site and folder ids before deleting anything.
Use the global content view as a radar:
ldev portal inventory sites --with-content --sort-by contentThen switch to the exact scoped view for the site you are about to prune:
ldev portal inventory sites --group-id 2710030 --with-structures --limit 202. Preview the cleanup
Keep the most recent items per folder:
ldev portal content prune \
--group-id 2710030 \
--root-folder 15588732 \
--root-folder 30502509 \
--keep 100 \
--dry-runKeep the most recent items per structure across all selected folders:
ldev portal content prune \
--group-id 2739584 \
--root-folder 2987332 \
--root-folder 2987326 \
--keep 3 \
--keep-scope structure \
--dry-runReview:
folderCountarticleCountkeptCountdeletedCountBreakdown by structureFolders planned for removal
3. Apply when the plan looks correct
ldev portal content prune \
--group-id 2710030 \
--root-folder 15588732 \
--root-folder 30502509 \
--keep 100The command deletes articles first and only removes folders that end up empty.
4. Verify the reduced local dataset
ldev portal check
ldev logs diagnose --since 5m --jsonThis workflow is intended for local sanitation after importing a large database, not for editorial cleanup in shared environments.