Blog Sections Open
Cleaning Up Duplicate Resources with the Evolution CMS API
A practical API-driven cleanup approach for finding duplicate resources by title or TV value and deleting the extras systematically.
Bulk cleanup tasks are one of the best uses of the Evolution CMS API. The donor case dealt with a classic content problem: duplicate resources sharing the same title or TV-based identifier, where one copy should stay and the extra copies should be removed in a controlled way.
Core script idea
define('MODX_API_MODE', true);
include_once(dirname(__FILE__).'/index.php');
$modx->db->connect();
if (empty($modx->config)) {
$modx->getSettings();
}
require_once($basePath.'assets/libs/resourse.php');
$resourse = resourse::Instance($modx);
From there, the script grouped records by pagetitle and TV value, kept one canonical copy, and deleted the rest through the API instead of manual tree work.
Why this approach is safer
- You can log exactly what is about to be deleted.
- You can define a clear rule for which copy survives.
- You avoid ad hoc manual cleanup in large trees.
For large content sets, API-driven deduplication is almost always safer than trying to solve the same problem directly in the manager.
Keeping Jot Working with Friendly URLs Instead of Numeric Comment Links
How to stop Jot-driven comment links from falling back to numeric document URLs on Evolution CMS sites with friendly URLs.
Fixing Manager 500 Errors After Updating Evolution CMS 1.0.15
How to troubleshoot manager 500 errors that appear on specific document edit screens after an Evolution CMS update.